Skip to content
This repository has been archived by the owner on Jun 5, 2019. It is now read-only.

Error when importing libusb1 on Windows #218

Closed
bauerj opened this issue Feb 20, 2018 · 6 comments
Closed

Error when importing libusb1 on Windows #218

bauerj opened this issue Feb 20, 2018 · 6 comments

Comments

@bauerj
Copy link

bauerj commented Feb 20, 2018

Using 0.9.0 on Windows yields this error:

 bauerj@DESKTOP-5KP26RC  ~  python
Python 3.6.2 (v3.6.2:5fd33b5, Jul  8 2017, 04:14:34) [MSC v.1900 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from trezorlib.device import TrezorDevice
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "c:\python3.6.2\lib\site-packages\trezorlib\device.py", line 23, in <module>
    from .transport_webusb import WebUsbTransport
  File "c:\python3.6.2\lib\site-packages\trezorlib\transport_webusb.py", line 24, in <module>
    import usb1
  File "c:\python3.6.2\lib\site-packages\usb1\__init__.py", line 61, in <module>
    from . import libusb1
  File "c:\python3.6.2\lib\site-packages\usb1\libusb1.py", line 199, in <module>
    libusb = _loadLibrary()
  File "c:\python3.6.2\lib\site-packages\usb1\libusb1.py", line 173, in _loadLibrary
    return dll_loader('libusb-1.0' + suffix, **loader_kw)
  File "c:\python3.6.2\lib\ctypes\__init__.py", line 348, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: [WinError 126] The specified module could not be found
@prusnak
Copy link
Member

prusnak commented Feb 20, 2018

That is a result of non-working installation of python-libusb1 dependency. Please see the following issue for resolution: vpelletier/python-libusb1#7

@bauerj
Copy link
Author

bauerj commented Feb 20, 2018

Does it mean that pip installs a broken version of python-libusb1 by default or that this is merely an issue with my installation?

@prusnak
Copy link
Member

prusnak commented Feb 20, 2018

I guess that python-libusb1 does not install the required libusb-1.0 dll by default, but best would be to ask in the linked issue.

@bauerj
Copy link
Author

bauerj commented Feb 20, 2018

I think that is correct. In that case, wouldn't it make sense to add that to the installation instructions for python-trezor?

@prusnak
Copy link
Member

prusnak commented Feb 20, 2018

I agree, but let's first find out what to put there ...

@bauerj
Copy link
Author

bauerj commented Feb 20, 2018

For me, the following worked:

  1. Download libusb-1.0.21.7z
  2. Copy MS{32,64}\dll\libusb-1.0.dll to the location of your python.exe

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants