Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"OSError: [WinError 126] The specified module could not be found" when trying to import strym on windows machine #8

Closed
iejones opened this issue Jul 1, 2020 · 1 comment

Comments

@iejones
Copy link

iejones commented Jul 1, 2020

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
@iejones
Copy link
Author

iejones commented Jul 1, 2020

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:

  1. Downloaded the binary snapshots for libusb-1.0 for windows here or here
  2. Extract it with 7-zip
  3. Copy libusb-1.0.dll into the folder in the directory with phython.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

@iejones iejones closed this as completed Jul 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant