Python pyusb no backend available

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

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

Pyusb-No backend available error #215

Pyusb-No backend available error #215

Comments

I am trying to find USB Mass Storage devices attached to my PC using usb.core.find() from command prompt in windows 7. I am using Python 3.7, pyusb 1.02 and libusb1.0.22b1. After importing usb.core, I am using the above mentioned command and I am getting the following error:

File «C. my_path. \usb\core.py», line 1263, in findusb.core.No BackendError: NO backend available

I read core.py file and understood that this is because core.py is not able to access libusb0.py, libusb1.py or openusb which are located in a folder named ‘backend’ which is in the same folder as core.py.

Читайте также:  Тег SELECT, атрибут name

Could any one tell me if my understanding is correct or not. If yes,please suggest a way to make libusb1.py accessible from core.py.(I ‘ve tried adding the path to environment variableand didn;t work) and please correct me if I am wrong and suggest the necessary changes.

The text was updated successfully, but these errors were encountered:

Источник

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

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

No backend available #120

No backend available #120

Comments

Hello,when I use pyusb.It occured a error.I don’t know how to solve it.
All the error :
dev = usb.core.find(idVendor=0x0416,idProduct=0x5011)
File «/usr/lib/python2.7/site-packages/usb/core.py», line 1199, in find
raise ValueError(‘No backend available’)
ValueError:No backend available

The text was updated successfully, but these errors were encountered:

Getting this when trying to use it on a Synology DiskStation. Somehow there ctypes.util.find_library returns None for anything.

I would also like to bump this issue.

Is there any easy way to specify/hardcode where libraries are lying, instead of relying on the mechanisms to locate them?

Apologizes for the long delay, I am treating a disease and had to dedicate my free time to recovery. I just pushed a FAQ which intends to address common issues. It is a WIP doc.

The documentation is not very clear on this.

Remember that you need libusb (1.0 or 0.1) or OpenUSB running on your system. For Windows users, libusb 0.1 is provided through libusb-win32 package. Check the libusb website for updates (http://www.libusb.org).

But how and where do we install it? libusb-win32 is just a zip file. Lots of people having trouble with this:

I install it on openwrt system.A linux system.I will try to update my libusb.Thank you.

发自网易邮箱大师
在2016年01月12日 23:11,endolith 写道:

The documentation is not very clear on this.

Remember that you need libusb (1.0 or 0.1) or OpenUSB running on your system. For Windows users, libusb 0.1 is provided through libusb-win32 package. Check the libusb website for updates (http://www.libusb.org).

But how and where do we install it? libusb-win32 is just a zip file. Lots of people having trouble with this:

Pyusb on windows — no backend available
Pyusb on windows 8.1 — no backend available — how to install libusb?
libusb installed- but pyUSB backend not found
PyUSB ValueError: No backend available
PyUSB backend not accessible


Reply to this email directly or view it on GitHub.

all three backends are not working properly. How do you fix this error?

usb.core.find()
2016-01-12 22:02:52,362 ERROR:usb.libloader:Libusb 1 (/usr/local/lib/libusb-1.0.dylib) could not be loaded
Traceback (most recent call last):
File «/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/usb/libloader.py», line 116, in load_library
return ctypes.CDLL(lib)
File «/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/ctypes/init.py», line 351, in init
self._handle = _dlopen(self._name, mode)
OSError: dlopen(/usr/local/lib/libusb-1.0.dylib, 6): no suitable image found. Did find:
/usr/local/lib/libusb-1.0.dylib: mach-o, but wrong architecture
2016-01-12 22:02:52,390 ERROR:usb.backend.libusb1:Error loading libusb 1.0 backend
dlerror: dlopen(/Library/Frameworks/openusb.framework/Versions/1.1.11/lib/openusb_backend/darwin.so, 1): Symbol not found: _usbi_devices
Referenced from: /Library/Frameworks/openusb.framework/Versions/1.1.11/lib/openusb_backend/darwin.so
Expected in: flat namespace
in /Library/Frameworks/openusb.framework/Versions/1.1.11/lib/openusb_backend/darwin.so
fail to load /Library/Frameworks/openusb.framework/Versions/1.1.11/lib/openusb_backend/darwin.so
2016-01-12 22:02:52,393 ERROR:usb.backend.openusb:Error loading OpenUSB backend
Traceback (most recent call last):
File «/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/usb/backend/openusb.py», line 738, in get_backend
_ctx = _Context()
File «/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/usb/backend/openusb.py», line 512, in init
_check(_lib.openusb_init(0, byref(self.handle)))
File «/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/usb/backend/openusb.py», line 506, in _check
raise USBError(_lib.openusb_strerror(ret), ret, _openusb_errno[ret])
usb.core.USBError: [Errno None] b’Unspecified kernel/driver failure’
2016-01-12 22:02:52,394 ERROR:usb.libloader:’Libusb 0′ could not be found
2016-01-12 22:02:52,394 ERROR:usb.backend.libusb0:Error loading libusb 0.1 backend
Traceback (most recent call last):
File «», line 1, in
File «/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/usb/core.py», line 1199, in find
raise ValueError(‘No backend available’)
ValueError: No backend available

import usb.core
from usb.backend import libusb1
be = libusb1()

TypeError: ‘module’ object is not callable

TypeError: ‘module’ object is not callable

your FAQ has errors!

all three backends are not working properly. How do you fix this error?

Your libusb install has problems. I suggest you reach libusb guys out.

I did contact them and posted my question on stack overflow but I haven’t heard from anyone. I installed libusb1 using Homebrew on my Mac OS X, however, I am getting a dlerror because the linker cannot find the backend library. Do you have any ideas on how to fix that? How did you make your backend work properly?

import usb.core
from usb.backend import libusb1
b = libusb1.get_backend()
b
print(b)
None
dev= usb.core.find()
dlerror: dlopen(/Library/Frameworks/openusb.framework/Versions/1.1.11/lib/openusb_backend/darwin.so, 1): Symbol not found: _usbi_devices
Referenced from: /Library/Frameworks/openusb.framework/Versions/1.1.11/lib/openusb_backend/darwin.so
Expected in: flat namespace
in /Library/Frameworks/openusb.framework/Versions/1.1.11/lib/openusb_backend/darwin.so
fail to load /Library/Frameworks/openusb.framework/Versions/1.1.11/lib/openusb_backend/darwin.so
Traceback (most recent call last):
File «», line 1, in
File «/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/usb/core.py», line 1199, in find
raise ValueError(‘No backend available’)
ValueError: No backend available

I did contact them and posted my question on stack overflow but I haven’t heard from anyone. I installed libusb1 using Homebrew on my Mac OS X, however, I am getting a dlerror because the linker cannot find the backend library. Do you have any ideas on how to fix that? How did you make your backend work properly?

How did you install libusb? Can any program linked to it work?

FYI for OSX 10.11:
I had previously installed pyusb using sudo pip3 install pyusb then subsequently installed libusb1 from source and pyusb was not finding my libusb1. I then removed the pip pyusb sudo pip3 uninstall pyusb and installed pyusb from source

python3 setup.py build sudo python3 setup.py install 

and it finds the libusb library just fine..

Источник

Pyusb on windows — no backend available

I had a similar issue recently trying to talk to a USB device I am developing. I scoured the web looking for libusb-1.0.dll’s and had no luck. I found source code, but nothing built and ready to install. I ended up installing the libusb-win32 binaries, which is the libusb0.dll.

PyUSB will search for libusb-1.0, libusb0, and openUSB backends.

libusb0.dll was already on my system, but something was still not set up right, do PyUSB was not working.

I followed the directions here to download and install the driver using the GUI tools provided to install the filter driver, and the INF wizard. Note, it didn’t work until I ran the INF wizard.

I’m pretty new to programming and I’ve found the lack of clear documentation/examples to string this all together rather frustrating.

Solution 3

I am using Python 2.6.5, libusb-win32-device.bin-0.1.12.1 and pyusb-1.0.0-a0 on a windows XP system and kept receiving ValueError: No backend available .

Since there wasn’t any real help on the web for this problem I spent a lot of time finding that ctypes util.py uses the Path variable to find the library file. My path did not include windows\system32 and PYUSB didn’t find the library. I updated the path variable and now the USB is working.

Solution 4

There’s a simpler solution.

Download and unpack to C:\PATH the libusb-1.0.20 from download link

backend = usb.backend.libusb1.get_backend(find_library=lambda x: «C:\PATH\libusb-1.0.20\MS32\dll\libusb-1.0.dll»)

dev = usb.core.find(backend=backend, find_all=True)

Depending on your system, try either MS64 or MS32 version of the .dll

Update of 17/01/2020, after a request to share more code:

import usb.core import usb.util from infi.devicemanager import DeviceManager dm = DeviceManager() devices = dm.all_devices for i in devices: try: print ('<> : address: <>, bus: <>, location: <>'.format(i.friendly_name, i.address, i.bus_number, i.location)) except Exception: pass import usb.backend.libusb1 backend = usb.backend.libusb1.get_backend(find_library=lambda x: "C:\\libusb-1.0.20\\MS32\\dll\\libusb-1.0.dll") dev = usb.core.find(backend=backend, find_all=True) def EnumerateUSB(): #I use a simple function that scans all known USB connections and saves their info in the file with open("EnumerateUSBLog.txt", "w") as wf: counter = 0 for d in dev: try: wf.write("USB Device number " + str(counter) + ":" + "\n") wf.write(d._get_full_descriptor_str() + "\n") wf.write(d.get_active_configuration() + "\n") wf.write("\n") counter += 1 except NotImplementedError: wf.write("Device number " + str(counter) + "is busy." + "\n") wf.write("\n") counter += 1 except usb.core.USBError: wf.write("Device number " + str(counter) + " is either disconnected or not found." + "\n") wf.write("\n") counter += 1 wf.close() 

Solution 5

2021 and the problem still occurs on Windows (Windows 10). I solved it by installing pyusb and libusb and adding libusb path to Windows environment:

  1. pip install pyusb
  2. pip install libusb
  3. libusb-1.0.dll will be automatically added to:

\venv\Lib\site-packages\libusb\_platform\_windows\x64
and
\venv\Lib\site-packages\libusb\_platform\_windows\x32

  1. Now just add those paths (the full path) to Windows Path and restart CMD / PyCharm.

Источник

Оцените статью