"OSError: [WinError 126] The specified module could not be found" when trying to import strym on windows machine
iejones opened this issue · 1 comments
I am working with windows on Anaconda. As suggested on the Conda website, I made an enviroment and installed the other packages I wanted with conda before installing strym with pip (https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html#using-pip-in-an-environment). Strym appears to have installed properly and Anaconda Navigator shows that I have it installed. When I try to import styrm
I receive this error message:
OSError Traceback (most recent call last)
<ipython-input-4-f6f98c63973a> in <module>
----> 1 import strym
D:\GamesAndPrograms\Anaconda3\envs\copyCat\lib\site-packages\strym\__init__.py in <module>
----> 1 from .strym import strym
2 from .strym import __version__
3 from .strym import __author__
4 from .strym import __email__
5 from .strymread import *
D:\GamesAndPrograms\Anaconda3\envs\copyCat\lib\site-packages\strym\strym.py in <module>
63 from os.path import expanduser
64
---> 65 import libusb1
66 import usb1
67
D:\GamesAndPrograms\Anaconda3\envs\copyCat\lib\site-packages\libusb1.py in <module>
6 )
7 del warnings
----> 8 from usb1.libusb1 import *
D:\GamesAndPrograms\Anaconda3\envs\copyCat\lib\site-packages\usb1\__init__.py in <module>
59 import contextlib
60 import inspect
---> 61 from . import libusb1
62 if sys.version_info[:2] >= (2, 6):
63 # pylint: disable=wrong-import-order,ungrouped-imports
D:\GamesAndPrograms\Anaconda3\envs\copyCat\lib\site-packages\usb1\libusb1.py in <module>
190 return dll_loader(libusb_path, **loader_kw)
191
--> 192 libusb = _loadLibrary()
193
194 # libusb.h
D:\GamesAndPrograms\Anaconda3\envs\copyCat\lib\site-packages\usb1\libusb1.py in _loadLibrary()
164 loader_kw['use_last_error'] = True
165 try:
--> 166 return dll_loader('libusb-1.0' + suffix, **loader_kw)
167 except OSError:
168 libusb_path = None
D:\GamesAndPrograms\Anaconda3\envs\copyCat\lib\ctypes\__init__.py in __init__(self, name, mode, handle, use_errno, use_last_error)
362
363 if handle is None:
--> 364 self._handle = _dlopen(self._name, mode)
365 else:
366 self._handle = handle
OSError: [WinError 126] The specified module could not be found
I found a solution. In accordance with this line of the error message, --> 166 return dll_loader('libusb-1.0' + suffix, **loader_kw)
, I could not find libusb-1.0.dll
in my environment directory. These steps fixed it:
- Downloaded the binary snapshots for
libusb-1.0
for windows here or here - Extract it with 7-zip
- Copy
libusb-1.0.dll
into the folder in the directory withphython.exe
For me, that folder was my environment folder, D:\GamesAndPrograms\Anaconda3\envs\copycat
Now, import strym
does not produce the error.
I also used these pages to find this solution: https://github.com/libusb/libusb/wiki/Windows and trezor/python-trezor#218