NordicSemiconductor / pynrfjprog

Python wrapper around the nrfjprog dynamic link library (DLL)
Other
74 stars 26 forks source link

MSVCP140.dll runtime dependency is not provided on Windows #39

Open Skorodum opened 5 months ago

Skorodum commented 5 months ago

nrfjprog.dll has dependency on MSVCP140.dll which is not part of the package. On clean Win10 it gives the following error:

(venv) PS C:\Users\novelda> pip install pynrfjprog
....
(venv) PS C:\Users\novelda> pip show pynrfjprog
Name: pynrfjprog
Version: 10.24.0
...
(venv) PS C:\Users\novelda> python
...
>>> from pynrfjprog import LowLevel
>>> LowLevel.API()
Traceback (most recent call last):
  File "C:\Users\novelda\venv\lib\site-packages\pynrfjprog\LowLevel.py", line 132, in __init__
    self._lib = ctypes.cdll.LoadLibrary(nrfjprog_dll_path)
  File "C:\Users\novelda\AppData\Local\Programs\Python\Python310\lib\ctypes\__init__.py", line 452, in LoadLibrary
    return self._dlltype(name)
  File "C:\Users\novelda\AppData\Local\Programs\Python\Python310\lib\ctypes\__init__.py", line 374, in __init__
    self._handle = _dlopen(self._name, mode)
FileNotFoundError: Could not find module 'C:\Users\novelda\venv\lib\site-packages\pynrfjprog\lib_x64\nrfjprog.dll' (or one of its dependencies). Try using the full path with constructor syntax.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\novelda\venv\lib\site-packages\pynrfjprog\LowLevel.py", line 134, in __init__
    raise RuntimeError(f"Could not load the NRFJPROG DLL: '{error}'.")
RuntimeError: Could not load the NRFJPROG DLL: 'Could not find module 'C:\Users\novelda\venv\lib\site-packages\pynrfjprog\lib_x64\nrfjprog.dll' (or one of its dependencies). Try using the full path with constructor syntax.'.

Dependency Walker:

Screenshot from 2024-02-02 13-52-29

Skorodum commented 5 months ago

Note: Segger J-Link 7.94 comes with msvcp100.dll, so using J-Link installer will not solve the problem.