0

Error Installing MCP2221A on Windows
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Error Installing MCP2221A on Windows

by hermaml on Fri Jan 24, 2020 11:44 am

Summary;
Trying to install onto Windows 10, using Python, files needed for MCP2221A breakout board.
After installing Python 3.8.1, I tried to install hidapi (version 20.0.1). Using the following command
py -3 -mpip install hidapi. I get the error ERROR: Command errored out with exit status 1: I tried to upgrade pip with
py -3 -mpip install --upgrade pip. This upgrade worked but no luck rerunning the hidapi install.

I also installed adafruit-blinka using py -3 -mpip install adafruit-blinka and Set the enviroment set BLINKA_MCP2221=1.
When I run python using py, then try to import board I get ModuleNotFoundError Not sure if my issues is
Windows 10, the Python 3.8.1, my hidapi installment error, or the path to the board lib.
Please advise?

DETAILS FOLLOWING;
--------------------------------------------------------------------------------------------------
>py --version
Python 3.8.1
--------------------------------------------------------------------------------------------------
>py -3 -mpip install hidapi
Collecting hidapi
Downloading https://files.pythonhosted.org/packages ... t21.tar.gz (51kB)
|████████████████████████████████| 61kB 326kB/s
ERROR: Command errored out with exit status 1:
command: 'C:\Users\herma\AppData\Local\Programs\Python\Python38\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\herma\\AppData\\Local\\Temp\\pip-install-uzew3wx_\\hidapi\\setup.py'"'"'; __file__='"'"'C:\\Users\\herma\\AppData\\Local\\Temp\\pip-install-uzew3wx_\\hidapi\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base pip-egg-info
cwd: C:\Users\herma\AppData\Local\Temp\pip-install-uzew3wx_\hidapi\ ....
--------------------------------------------------------------------------------------------------
py -3 -mpip install --upgrade pip
Collecting pip
Downloading https://files.pythonhosted.org/packages ... ne-any.whl (1.5MB)
|████████████████████████████████| 1.5MB 142kB/s
Installing collected packages: pip
Found existing installation: pip 19.2.3
Uninstalling pip-19.2.3:
Successfully uninstalled pip-19.2.3
Successfully installed pip-20.0.1
--------------------------------------------------------------------------------------------------
py -3 -mpip install hidapi
Collecting hidapi
Using cached hidapi-0.7.99.post21.tar.gz (51 kB)
ERROR: Command errored out with exit status 1:
command: 'C:\Users\herma\AppData\Local\Programs\Python\Python38\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\herma\\AppData\\Local\\Temp\\pip-install-oq_f45x2\\hidapi\\setup.py'"'"'; __file__='"'"'C:\\Users\\he
--------------------------------------------------------------------------------------------------
>py -3 -mpip install adafruit-blinka
Collecting adafruit-blinka
Downloading Adafruit-Blinka-3.7.1.tar.gz (81 kB)
|████████████████████████████████| 81 kB 521 kB/s
Collecting Adafruit-PlatformDetect
Downloading Adafruit-PlatformDetect-2.1.0.tar.gz (16 kB)
Collecting Adafruit-PureIO
Downloading Adafruit_PureIO-1.0.4.tar.gz (16 kB)
Collecting pyftdi>=0.40.0
Downloading pyftdi-0.42.2.tar.gz (86 kB)
|████████████████████████████████| 86 kB 737 kB/s
Collecting pyusb>=1.0.0
Downloading pyusb-1.0.2.tar.gz (54 kB)
|████████████████████████████████| 54 kB 787 kB/s
Collecting pyserial>=3.0
Downloading pyserial-3.4-py2.py3-none-any.whl (193 kB)
|████████████████████████████████| 193 kB 595 kB/s
Installing collected packages: Adafruit-PlatformDetect, Adafruit-PureIO, pyusb, pyserial, pyftdi, adafruit-blinka
Running setup.py install for Adafruit-PlatformDetect ... done
Running setup.py install for Adafruit-PureIO ... done
Running setup.py install for pyusb ... done
Running setup.py install for pyftdi ... done
Running setup.py install for adafruit-blinka ... done
Successfully installed Adafruit-PlatformDetect-2.1.0 Adafruit-PureIO-1.0.4 adafruit-blinka-3.7.1 pyftdi-0.42.2 pyserial-3.4 pyusb-1.0.2
--------------------------------------------------------------------------------------------------
>set BLINKA_MCP2221=1
--------------------------------------------------------------------------------------------------
py
Python 3.8.1 (tags/v3.8.1:1b293b6, Dec 18 2019, 23:11:46) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import board
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\herma\AppData\Local\Programs\Python\Python38\lib\site-packages\board.py", line 32, in <module>
from adafruit_blinka.agnostic import board_id, detector
File "C:\Users\herma\AppData\Local\Programs\Python\Python38\lib\site-packages\adafruit_blinka\agnostic\__init__.py", line 18, in <module>
chip_id = detector.chip.id
File "C:\Users\herma\AppData\Local\Programs\Python\Python38\lib\site-packages\adafruit_platformdetect\chip.py", line 34, in id
import hid # pylint: disable=import-error
ModuleNotFoundError: No module named 'hid'

hermaml
 
Posts: 8
Joined: Fri Jan 24, 2020 11:15 am

Re: Error Installing MCP2221A on Windows

by jklem on Sun Jan 26, 2020 1:00 am

I had a similar problem installing hidapi. Traceback concluded:
distutils.errors.DistutilsError: Setup script exited with error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": https://visualstudio.microsoft.com/downloads/

Downloaded "Build Tools for Visual Studio 2019" at
https://visualstudio.microsoft.com/down ... tudio-2019
and installed just the C++ build tools. hidapi installed OK after that.

jklem
 
Posts: 12
Joined: Sun Dec 08, 2019 10:20 pm

Re: Error Installing MCP2221A on Windows

by adafruit_support_carter on Mon Jan 27, 2020 3:57 pm

Hmm. Ideally it would take care of any requirements.

@hermaml Have you tried the above and seen if it helps?

adafruit_support_carter
 
Posts: 15621
Joined: Tue Nov 29, 2016 2:45 pm

Re: Error Installing MCP2221A on Windows

by hermaml on Wed Jan 29, 2020 9:56 am

First I want to thank jklem for the great advice! Fixed my problems installing hidapi and provided me a great tool for future software development.

Step by step:
Step 1. Installed Microsoft Visual Studio 2019 (takes a long time) https://visualstudio.microsoft.com/downloads/
Downloaded the following options
Python development
Node.js development
.NET desktop development
Desktop development with C++
Universal Windows Platform development
Mobil development with .NET
Mobil development with C++
Data science and analytical applications
Visual Studio extension development
Linux development with C++
.NET core cross platform development

Step 2. Re-installed hidapi from dos
py -3 -mpip install hidapi

Collecting hidapi
Using cached hidapi-0.7.99.post21.tar.gz (51 kB)
Requirement already satisfied: setuptools>=19.0 in c:\users\herma\appdata\local\programs\python\python38\lib\site-packages (from hidapi) (41.2.0)
Installing collected packages: hidapi
Running setup.py install for hidapi ... done
Successfully installed hidapi-0.7.99.post21

Step 3. Verify installment from dos
set BLINKA_MCP2221=1

Run python in dos >py
>>> import board
>>> import os
>>> os.environ["BLINKA_MCP2221"]
'1'
>>> dir(board)
['G0', 'G1', 'G2', 'G3', 'I2C', 'SCL', 'SDA', 'SPI', '__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__spec__', 'ap_board', 'board_id', 'detector', 'pin', 'sys']
>>>

hermaml
 
Posts: 8
Joined: Fri Jan 24, 2020 11:15 am

Re: Error Installing MCP2221A on Windows

by adafruit_support_carter on Wed Jan 29, 2020 12:07 pm

OK, it sounds like maybe we should check what's going on with the dependency in terms of being able to even install hidapi. That didn't seem necessary on our Windows test machine, but could just be that it was in a different state and we didn't hit that.

@hermaml Now that the library is installed, does it seem to work OK? Or are you also running into issues similar to others in this thread:
viewtopic.php?f=60&t=160414

adafruit_support_carter
 
Posts: 15621
Joined: Tue Nov 29, 2016 2:45 pm

Re: Error Installing MCP2221A on Windows

by hermaml on Wed Jan 29, 2020 5:35 pm

The lib is installed with out errors:) However, I now have connection issues like what is described in the other forum thread. I switched to that thread to keep the issues common.
viewtopic.php?f=60&t=160414

hermaml
 
Posts: 8
Joined: Fri Jan 24, 2020 11:15 am

Re: Error Installing MCP2221A on Windows

by adafruit_support_carter on Wed Jan 29, 2020 6:55 pm

Thanks for joining that other thread. We are still working on trying to reproduce that here.

adafruit_support_carter
 
Posts: 15621
Joined: Tue Nov 29, 2016 2:45 pm

Re: Error Installing MCP2221A on Windows

by doctorwho8 on Sat Mar 07, 2020 12:06 pm

Hello!
But I am getting this strange sequence of events even getting started:
Code: Select all | TOGGLE FULL SIZE
PS C:\Users\hanso> python
Python 3.8.2 (tags/v3.8.2:7b3ab59, Feb 25 2020, 23:03:10) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import board
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\hanso\AppData\Local\Programs\Python\Python38\lib\site-packages\board.py", line 144, in <module>
    raise NotImplementedError("Board not supported {}".format(board_id))
NotImplementedError: Board not supported None
>>>         

I even installed VS2019 and included Python with it, also have Python 3 installed as it says there.

doctorwho8
 
Posts: 67
Joined: Sat Aug 01, 2009 10:24 pm
Location: USA

Re: Error Installing MCP2221A on Windows

by adafruit_support_carter on Sat Mar 07, 2020 1:33 pm

PS C:\Users\hanso> python

Are you using powershell? If so, try this syntax for setting the environment variable:
Code: Select all | TOGGLE FULL SIZE
$env:BLINKA_MCP2221=1

If not, then like this:
https://learn.adafruit.com/circuitpytho ... iable-3-30

adafruit_support_carter
 
Posts: 15621
Joined: Tue Nov 29, 2016 2:45 pm

Re: Error Installing MCP2221A on Windows

by doctorwho8 on Tue Mar 10, 2020 3:53 pm

adafruit_support_carter wrote:
PS C:\Users\hanso> python

Are you using powershell? If so, try this syntax for setting the environment variable:
Code: Select all | TOGGLE FULL SIZE
$env:BLINKA_MCP2221=1

If not, then like this:
https://learn.adafruit.com/circuitpytho ... iable-3-30


Hello!
I tried that. Now it throws up this one:
Code: Select all | TOGGLE FULL SIZE
PS C:\Users\hanso> python
Python 3.8.2 (tags/v3.8.2:7b3ab59, Feb 25 2020, 23:03:10) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import board
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\hanso\AppData\Local\Programs\Python\Python38\lib\site-packages\board.py", line 32, in <module>
    from adafruit_blinka.agnostic import board_id, detector
  File "C:\Users\hanso\AppData\Local\Programs\Python\Python38\lib\site-packages\adafruit_blinka\agnostic\__init__.py", line 18, in <module>
    chip_id = detector.chip.id
  File "C:\Users\hanso\AppData\Local\Programs\Python\Python38\lib\site-packages\adafruit_platformdetect\chip.py", line 28, in id
    count = len(UsbTools.find_all([(0x0403, 0x6014)]))
  File "C:\Users\hanso\AppData\Local\Programs\Python\Python38\lib\site-packages\pyftdi\usbtools.py", line 98, in find_all
    devs.update(UsbTools._find_devices(vid, pid, nocache))
  File "C:\Users\hanso\AppData\Local\Programs\Python\Python38\lib\site-packages\pyftdi\usbtools.py", line 268, in _find_devices
    raise ValueError('No backend available')
ValueError: No backend available


But I already installed the library with the pip command , and it shows,
Code: Select all | TOGGLE FULL SIZE
PS C:\Users\hanso> pip install adafruit-blinka
Requirement already satisfied: adafruit-blinka in c:\users\hanso\appdata\local\programs\python\python38\lib\site-packages (4.1.0)
Requirement already satisfied: Adafruit-PlatformDetect in c:\users\hanso\appdata\local\programs\python\python38\lib\site-packages (from adafruit-blinka) (2.3.0)
Requirement already satisfied: Adafruit-PureIO in c:\users\hanso\appdata\local\programs\python\python38\lib\site-packages (from adafruit-blinka) (1.0.4)
Requirement already satisfied: pyftdi>=0.40.0 in c:\users\hanso\appdata\local\programs\python\python38\lib\site-packages (from adafruit-blinka) (0.44.2)
Requirement already satisfied: pyusb>=1.0.0 in c:\users\hanso\appdata\local\programs\python\python38\lib\site-packages (from pyftdi>=0.40.0->adafruit-blinka) (1.0.2)
Requirement already
 satisfied: pyserial>=3.0 in c:\users\hanso\appdata\local\programs\python\python38\lib\site-packages (from pyftdi>=0.40.0->adafruit-blinka) (3.4)
PS C:\Users\hanso> 


So do I need to follow all of the steps on the same page for enabling functions to work for the MCP2221A widget that the company sells?

doctorwho8
 
Posts: 67
Joined: Sat Aug 01, 2009 10:24 pm
Location: USA

Re: Error Installing MCP2221A on Windows

by adafruit_support_carter on Tue Mar 10, 2020 3:58 pm

@doctorwho8 It would be better if you could please start a new thread for your issue.

adafruit_support_carter
 
Posts: 15621
Joined: Tue Nov 29, 2016 2:45 pm

Re: Error Installing MCP2221A on Windows

by doctorwho8 on Tue Mar 10, 2020 4:42 pm

I should? I suppose. But my issue seems to be the same as the original ones. I should also mention that this is my first interaction with CircuitPython. I've used Python before, but never in these surrounds.

doctorwho8
 
Posts: 67
Joined: Sat Aug 01, 2009 10:24 pm
Location: USA

Re: Error Installing MCP2221A on Windows

by adafruit_support_carter on Wed Mar 11, 2020 2:12 pm

@doctorwho8 Yes, please start a new thread. Even issues that appear to be identical can often diverge into specifics for each setup. It's best to troubleshoot each one in a separate thread. Linking to similar threads to help provide more info is OK though.

Some additional information has been added to cover the potential need for the MSVC Build Tools mentioned above:
https://learn.adafruit.com/circuitpytho ... hidapi-3-3

adafruit_support_carter
 
Posts: 15621
Joined: Tue Nov 29, 2016 2:45 pm

Please be positive and constructive with your questions and comments.