pymcuprog icon indicating copy to clipboard operation
pymcuprog copied to clipboard

Installation of dependencies failed, tool unusable

Open ygoe opened this issue 1 month ago • 4 comments

I recently had to reinstall Python for Windows because something in it broke completely by itself. I have no clue what it was but the other tool I use that requires Python is working again. I used the current official recommended install manager from the Python website.

Now I needed to run pymcuprog again and, of course, it didn't work anymore. Some package was missing. So I installed all of its dependencies again and one of them seems to fail. The output is very extensive and I don't understand what's going on. My Python knowledge is very basic and I'm unable to debug such errors.

So here's my environment first:

  • Windows 11 x64
  • Python 3.14.0 from install manager
  • pymcuprog based on commit dbd4904c82 from 2024-03-22 (I made some extensions, but that's not the issue here)

I have these two files:

  • install.cmd
  • requirements.txt

First, the requirements files has this content:

pyserial
IntelHex
PyYAML
appdirs
pyedbglib>=2.24

And install.cmd does this:

cd /d "%~dp0"
python -m pip install -r requirements.txt
@pause

And here's the full output of the desaster:

Collecting pyserial (from -r requirements.txt (line 1))
  Downloading pyserial-3.5-py2.py3-none-any.whl.metadata (1.6 kB)
Collecting IntelHex (from -r requirements.txt (line 2))
  Downloading intelhex-2.3.0-py2.py3-none-any.whl.metadata (2.7 kB)
Collecting PyYAML (from -r requirements.txt (line 3))
  Downloading pyyaml-6.0.3-cp314-cp314-win_amd64.whl.metadata (2.4 kB)
Collecting appdirs (from -r requirements.txt (line 4))
  Downloading appdirs-1.4.4-py2.py3-none-any.whl.metadata (9.0 kB)
Collecting pyedbglib>=2.24 (from -r requirements.txt (line 5))
  Downloading pyedbglib-2.24.2.18-py3-none-any.whl.metadata (8.5 kB)
Collecting cython (from pyedbglib>=2.24->-r requirements.txt (line 5))
  Downloading cython-3.2.0-cp314-cp314-win_amd64.whl.metadata (3.7 kB)
Collecting hidapi (from pyedbglib>=2.24->-r requirements.txt (line 5))
  Downloading hidapi-0.14.0.post4.tar.gz (174 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Collecting setuptools>=19.0 (from hidapi->pyedbglib>=2.24->-r requirements.txt (line 5))
  Using cached setuptools-80.9.0-py3-none-any.whl.metadata (6.6 kB)
Downloading pyserial-3.5-py2.py3-none-any.whl (90 kB)
Downloading intelhex-2.3.0-py2.py3-none-any.whl (50 kB)
Downloading pyyaml-6.0.3-cp314-cp314-win_amd64.whl (156 kB)
Downloading appdirs-1.4.4-py2.py3-none-any.whl (9.6 kB)
Downloading pyedbglib-2.24.2.18-py3-none-any.whl (70 kB)
Using cached cython-3.2.0-cp314-cp314-win_amd64.whl (2.8 MB)
Using cached setuptools-80.9.0-py3-none-any.whl (1.2 MB)
Building wheels for collected packages: hidapi
  Building wheel for hidapi (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for hidapi (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [29 lines of output]
      C:\Users\Yves\AppData\Local\Temp\pip-build-env-xn12e1es\overlay\Lib\site-packages\setuptools\dist.py:759: SetuptoolsDeprecationWarning: License classifiers are deprecated.
      !!

              ********************************************************************************
              Please consider removing the following classifiers in favor of a SPDX license expression:

              License :: OSI Approved :: BSD License
              License :: OSI Approved :: GNU General Public License v3 (GPLv3)

              See https://packaging.python.org/en/latest/guides/writing-pyproject-toml/#license for details.
              ********************************************************************************

      !!
        self._finalize_license_expression()
      running bdist_wheel
      running build
      running build_ext
      building 'hid' extension
      creating build\temp.win-amd64-cpython-314\Release\Users\Yves\AppData\Local\Temp\pip-install-7dy4jjmj\hidapi_c9d506db5b1847c2a698a9ea2b446205\hidapi\windows
      "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.44.35207\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -IC:\Users\Yves\AppData\Local\Temp\pip-install-7dy4jjmj\hidapi_c9d506db5b1847c2a698a9ea2b446205\hidapi\hidapi -IC:\Users\Yves\AppData\Local\Python\pythoncore-3.14-64\include -IC:\Users\Yves\AppData\Local\Python\pythoncore-3.14-64\Include "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.44.35207\include" "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.44.35207\ATLMFC\include" "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.26100.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.26100.0\\um" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.26100.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.26100.0\\winrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.26100.0\\cppwinrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" /TcC:\Users\Yves\AppData\Local\Temp\pip-install-7dy4jjmj\hidapi_c9d506db5b1847c2a698a9ea2b446205\hidapi\windows\hid.c /Fobuild\temp.win-amd64-cpython-314\Release\Users\Yves\AppData\Local\Temp\pip-install-7dy4jjmj\hidapi_c9d506db5b1847c2a698a9ea2b446205\hidapi\windows\hid.obj -DHID_API_NO_EXPORT_DEFINE
      hid.c
      "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.44.35207\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -IC:\Users\Yves\AppData\Local\Temp\pip-install-7dy4jjmj\hidapi_c9d506db5b1847c2a698a9ea2b446205\hidapi\hidapi -IC:\Users\Yves\AppData\Local\Python\pythoncore-3.14-64\include -IC:\Users\Yves\AppData\Local\Python\pythoncore-3.14-64\Include "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.44.35207\include" "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.44.35207\ATLMFC\include" "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.26100.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.26100.0\\um" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.26100.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.26100.0\\winrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.26100.0\\cppwinrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" /Tchid.c /Fobuild\temp.win-amd64-cpython-314\Release\hid.obj -DHID_API_NO_EXPORT_DEFINE
      hid.c
      hid.c(3079): warning C4267: "=": Konvertierung von "size_t" nach "int", Datenverlust m”glich
      hid.c(4194): warning C4244: "=": Konvertierung von "Py_ssize_t" in "int", m”glicher Datenverlust
      creating C:\Users\Yves\AppData\Local\Temp\pip-install-7dy4jjmj\hidapi_c9d506db5b1847c2a698a9ea2b446205\build\lib.win-amd64-cpython-314
      "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.44.35207\bin\HostX86\x64\link.exe" /nologo /INCREMENTAL:NO /LTCG /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO /LIBPATH:C:\Users\Yves\AppData\Local\Python\pythoncore-3.14-64\libs /LIBPATH:C:\Users\Yves\AppData\Local\Python\pythoncore-3.14-64 /LIBPATH:C:\Users\Yves\AppData\Local\Python\pythoncore-3.14-64\PCbuild\amd64 "/LIBPATH:C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.44.35207\ATLMFC\lib\x64" "/LIBPATH:C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.44.35207\lib\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\lib\um\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.26100.0\ucrt\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\\lib\10.0.26100.0\\um\x64" setupapi.lib /EXPORT:PyInit_hid build\temp.win-amd64-cpython-314\Release\Users\Yves\AppData\Local\Temp\pip-install-7dy4jjmj\hidapi_c9d506db5b1847c2a698a9ea2b446205\hidapi\windows\hid.obj build\temp.win-amd64-cpython-314\Release\hid.obj /OUT:build\lib.win-amd64-cpython-314\hid.cp314-win_amd64.pyd /IMPLIB:build\temp.win-amd64-cpython-314\Release\Users\Yves\AppData\Local\Temp\pip-install-7dy4jjmj\hidapi_c9d506db5b1847c2a698a9ea2b446205\hidapi\windows\hid.cp314-win_amd64.lib
      LINK : fatal error LNK1104: Datei "build\temp.win-amd64-cpython-314\Release\Users\Yves\AppData\Local\Temp\pip-install-7dy4jjmj\hidapi_c9d506db5b1847c2a698a9ea2b446205\hidapi\windows\hid.cp314-win_amd64.exp" kann nicht ge”ffnet werden.
      error: command 'C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.44.35207\\bin\\HostX86\\x64\\link.exe' failed with exit code 1104
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for hidapi
Failed to build hidapi

[notice] A new release of pip is available: 25.2 -> 25.3
[notice] To update, run: C:\Users\Yves\AppData\Local\Python\pythoncore-3.14-64\python.exe -m pip install --upgrade pip
error: failed-wheel-build-for-install

× Failed to build installable wheels for some pyproject.toml based projects
╰─> hidapi

(Sorry, colours are not visible here.)

So something in the dependency "hidapi" that apparently was built from C code didn't work. There are notices, warnings and errors in this output. I can't really tell them apart.

What do I need to do to make this Python-based tool usable again? Can I also use pymcuprog without relying on Python because that regularly causes trouble?

ygoe avatar Nov 09 '25 14:11 ygoe

Hi ygoe

The short answer to your last question is: Download the compressed Windows iotprovision binary from the repo https://github.com/microchip-pic-avr-tools/iotprovision-bin , extract the Windows binary, and rename it to pymcuprog.exe. The README in the repo gives the technical background.

felias-fogg avatar Nov 09 '25 15:11 felias-fogg

Thank you, this has helped for now.

I'm still curious how the issue could be resolved. I made some changes to the pymcuprog tool a while ago (https://github.com/microchip-pic-avr-tools/pymcuprog/pull/46) and would like to keep them for one of my projects that needs it. But it doesn't look like Microchip is really interested in community contributions or open source in general.

ygoe avatar Nov 09 '25 15:11 ygoe

With 3.13.9, the installation under Windows is successful. With 3.14.0, the hidapi installation fails the same way as it did in your case.

As far as I understood it, Microchip has published its in-house software in this repo in order to allow people like me to make use of it (PyAvrOCD), but they are not interested in PRs.

felias-fogg avatar Nov 09 '25 20:11 felias-fogg

HIDAPI does not have a binary build for python 3.14 (yet) which means that if you run 3.14 it will try to build it itself. This works [usually] on Linux machines where build systems are part of the distro, but Windows has little chance of building anything automatically. Best use 3.10->3.13 until someone™️makes a build for the hidapi package and bundles it.

mraardvark avatar Nov 09 '25 20:11 mraardvark