Discussion:
[pyusb-users] No backend available with windows 7
Michel Allaire
2015-03-02 05:06:05 UTC
Permalink
Hi,



In my current project I must communicate through the USB bus with several
micro controllers which are USB ready.



I want to do this in Python running on Windows 7-64bits.



PyUSB 1.0.0b2 is installed as well as libusb-win32 (
libusb-win32-devel-filter-1.2.6.0.exe was used without adding a filter for a
particular device)



The file libusb0.dll is present in C:\Windows\System32\ and the file
libusb0.sys is present in C:\Windows\System32\drivers\.





My test script is the following



import os

os.environ['PYUSB_DEBUG']='debug'

os.environ['PYUSB_LOG_FILENAME']="D:\LOG_ERR_TEST.txt"



import usb.core

import usb.util



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









And it produces the following error:



Traceback (most recent call last):

File "C:\Python34\Test PYUSB.py", line 13, in <module>

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

File "C:\Python34\usb\core.py", line 1219, in find

raise ValueError('No backend available')

ValueError: No backend available





The error log file goes like this:



2015-02-27 22:22:24,995 ERROR:usb.libloader:'Libusb 1' could not be found

2015-02-27 22:22:24,996 ERROR:usb.backend.libusb1:Error loading libusb 1.0
backend

2015-02-27 22:22:25,000 ERROR:usb.libloader:'OpenUSB library' could not be
found

2015-02-27 22:22:25,001 ERROR:usb.backend.openusb:Error loading OpenUSB
backend

2015-02-27 22:22:25,012 ERROR:usb.libloader:Libusb 0
(C:\WinAVR-20100110\bin\libusb0.dll) could not be loaded

Traceback (most recent call last):

File "C:\Python34\usb\libloader.py", line 116, in load_library

return ctypes.CDLL(lib)

File "C:\Python34\lib\ctypes\__init__.py", line 351, in __init__

self._handle = _dlopen(self._name, mode)

OSError: [WinError 193] %1 n'est pas une application Win32 valide (in
English : "not a valid Win32 application")

2015-02-27 22:22:25,013 ERROR:usb.backend.libusb0:Error loading libusb 0.1
backend

2015-02-27 22:25:16,570 ERROR:usb.libloader:'Libusb 1' could not be found

2015-02-27 22:25:16,571 ERROR:usb.backend.libusb1:Error loading libusb 1.0
backend

2015-02-27 22:25:16,575 ERROR:usb.libloader:'OpenUSB library' could not be
found

2015-02-27 22:25:16,576 ERROR:usb.backend.openusb:Error loading OpenUSB
backend

2015-02-27 22:25:16,586 ERROR:usb.libloader:Libusb 0
(C:\WinAVR-20100110\bin\libusb0.dll) could not be loaded

Traceback (most recent call last):

File "C:\Python34\usb\libloader.py", line 116, in load_library

return ctypes.CDLL(lib)

File "C:\Python34\lib\ctypes\__init__.py", line 351, in __init__

self._handle = _dlopen(self._name, mode)

OSError: [WinError 193] %1 n'est pas une application Win32 valide (in
English : "not a valid Win32 application")

2015-02-27 22:25:16,588 ERROR:usb.backend.libusb0:Error loading libusb 0.1
backend

2015-02-27 22:35:31,821 ERROR:usb.libloader:'Libusb 1' could not be found

2015-02-27 22:35:31,822 ERROR:usb.backend.libusb1:Error loading libusb 1.0
backend

2015-02-27 22:35:31,827 ERROR:usb.libloader:'OpenUSB library' could not be
found

2015-02-27 22:35:31,827 ERROR:usb.backend.openusb:Error loading OpenUSB
backend

2015-02-27 22:35:31,838 ERROR:usb.libloader:Libusb 0
(C:\WinAVR-20100110\bin\libusb0.dll) could not be loaded

Traceback (most recent call last):

File "C:\Python34\usb\libloader.py", line 116, in load_library

return ctypes.CDLL(lib)

File "C:\Python34\lib\ctypes\__init__.py", line 351, in __init__

self._handle = _dlopen(self._name, mode)

OSError: [WinError 193] %1 n'est pas une application Win32 valide (in
English : "not a valid Win32 application")

2015-02-27 22:35:31,840 ERROR:usb.backend.libusb0:Error loading libusb 0.1
backend

2015-02-27 22:40:53,266 ERROR:usb.libloader:'Libusb 1' could not be found

2015-02-27 22:40:53,267 ERROR:usb.backend.libusb1:Error loading libusb 1.0
backend

2015-02-27 22:40:53,272 ERROR:usb.libloader:'OpenUSB library' could not be
found

2015-02-27 22:40:53,272 ERROR:usb.backend.openusb:Error loading OpenUSB
backend

2015-02-27 22:40:53,282 ERROR:usb.libloader:Libusb 0
(C:\WinAVR-20100110\bin\libusb0.dll) could not be loaded

Traceback (most recent call last):

File "C:\Python34\usb\libloader.py", line 116, in load_library

return ctypes.CDLL(lib)

File "C:\Python34\lib\ctypes\__init__.py", line 351, in __init__

self._handle = _dlopen(self._name, mode)

OSError: [WinError 193] %1 n'est pas une application Win32 valide

2015-02-27 22:40:53,284 ERROR:usb.backend.libusb0:Error loading libusb 0.1
backend

2015-02-27 22:41:37,963 ERROR:usb.libloader:'Libusb 1' could not be found

2015-02-27 22:41:37,964 ERROR:usb.backend.libusb1:Error loading libusb 1.0
backend

2015-02-27 22:41:37,969 ERROR:usb.libloader:'OpenUSB library' could not be
found

2015-02-27 22:41:37,969 ERROR:usb.backend.openusb:Error loading OpenUSB
backend

2015-02-27 22:41:37,979 ERROR:usb.libloader:Libusb 0
(C:\WinAVR-20100110\bin\libusb0.dll) could not be loaded

Traceback (most recent call last):

File "C:\Python34\usb\libloader.py", line 116, in load_library

return ctypes.CDLL(lib)

File "C:\Python34\lib\ctypes\__init__.py", line 351, in __init__

self._handle = _dlopen(self._name, mode)

OSError: [WinError 193] %1 n'est pas une application Win32 valide (in
English : "not a valid Win32 application")

2015-02-27 22:41:37,981 ERROR:usb.backend.libusb0:Error loading libusb 0.1
backend

2015-02-27 22:42:38,367 ERROR:usb.libloader:'Libusb 1' could not be found

2015-02-27 22:42:38,368 ERROR:usb.backend.libusb1:Error loading libusb 1.0
backend

2015-02-27 22:42:38,372 ERROR:usb.libloader:'OpenUSB library' could not be
found

2015-02-27 22:42:38,373 ERROR:usb.backend.openusb:Error loading OpenUSB
backend

2015-02-27 22:42:38,383 ERROR:usb.libloader:Libusb 0
(C:\WinAVR-20100110\bin\libusb0.dll) could not be loaded

Traceback (most recent call last):

File "C:\Python34\usb\libloader.py", line 116, in load_library

return ctypes.CDLL(lib)

File "C:\Python34\lib\ctypes\__init__.py", line 351, in __init__

self._handle = _dlopen(self._name, mode)

OSError: [WinError 193] %1 n'est pas une application Win32 valide

2015-02-27 22:42:38,384 ERROR:usb.backend.libusb0:Error loading libusb 0.1
backend

2015-02-28 12:23:20,858 ERROR:usb.libloader:'Libusb 1' could not be found

2015-02-28 12:23:20,858 ERROR:usb.backend.libusb1:Error loading libusb 1.0
backend

2015-02-28 12:23:20,858 ERROR:usb.libloader:'OpenUSB library' could not be
found

2015-02-28 12:23:20,858 ERROR:usb.backend.openusb:Error loading OpenUSB
backend

2015-02-28 12:23:20,858 ERROR:usb.libloader:Libusb 0
(C:\WinAVR-20100110\bin\libusb0.dll) could not be loaded

Traceback (most recent call last):

File "C:\Python34\usb\libloader.py", line 116, in load_library

return ctypes.CDLL(lib)

File "C:\Python34\lib\ctypes\__init__.py", line 351, in __init__

self._handle = _dlopen(self._name, mode)

OSError: [WinError 193] %1 n'est pas une application Win32 valide (in
English : "not a valid Win32 application")

2015-02-28 12:23:20,878 ERROR:usb.backend.libusb0:Error loading libusb 0.1
backend

2015-02-28 16:51:36,357 ERROR:usb.libloader:'Libusb 1' could not be found

2015-02-28 16:51:36,367 ERROR:usb.backend.libusb1:Error loading libusb 1.0
backend

2015-02-28 16:51:36,367 ERROR:usb.libloader:'OpenUSB library' could not be
found

2015-02-28 16:51:36,367 ERROR:usb.backend.openusb:Error loading OpenUSB
backend

2015-02-28 16:51:36,367 ERROR:usb.libloader:Libusb 0
(C:\WinAVR-20100110\bin\libusb0.dll) could not be loaded

Traceback (most recent call last):

File "C:\Python34\usb\libloader.py", line 116, in load_library

return ctypes.CDLL(lib)

File "C:\Python34\lib\ctypes\__init__.py", line 351, in __init__

self._handle = _dlopen(self._name, mode)

OSError: [WinError 193] %1 n'est pas une application Win32 valide (in
English : "not a valid Win32 application")

2015-02-28 16:51:36,367 ERROR:usb.backend.libusb0:Error loading libusb 0.1
backend





Can you help me solve this problem?



Thanking you in advance





Michel Allaire
Xiaofan Chen
2015-03-02 13:05:31 UTC
Permalink
Post by Michel Allaire
2015-02-27 22:41:37,979 ERROR:usb.libloader:Libusb 0
(C:\WinAVR-20100110\bin\libusb0.dll) could not be loaded
You probably want to delete this file and try again.
C:\WinAVR-20100110\bin\libusb0.dll
--
Xiaofan
Michel Allaire
2015-03-02 18:40:24 UTC
Permalink
Thank you for your fast response.

Before receiving your response, I had tried this:

I was working initially with Python 3.4.3 so I uninstalled it and installed
version 2.7.9.

Then the "No backend available" error disappeared.

I uninstalled Python 2.27.9 and came back to Python 3.4.3 and still no
error.

Puzzling!

But it seems that I can't access the list devices on the bus with the
following script:

import usb.core
import usb.util

list_dev = usb.core.find(find_all=True)
n = 0
for dev in list_dev:
n = n+1
print (n, " " , dev)


Could it be because I did not specified any filter or .INF file since I want
to scan the bus myself to connect to microcontrollers in a arbitrary number
and USB ready

Will this behavior also exists on my target operating system with will be
Linux running on à Raspberry PI.



Best regards

Michel Allaire




-----Message d'origine-----
De : Xiaofan Chen [mailto:***@gmail.com]
Envoyé : 2 mars 2015 08:06
À : pyusb-***@lists.sourceforge.net
Objet : Re: [pyusb-users] No backend available with windows 7
Post by Michel Allaire
2015-02-27 22:41:37,979 ERROR:usb.libloader:Libusb 0
(C:\WinAVR-20100110\bin\libusb0.dll) could not be loaded
You probably want to delete this file and try again.
C:\WinAVR-20100110\bin\libusb0.dll

--
Xiaofan

----------------------------------------------------------------------------
--
Dive into the World of Parallel Programming The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
pyusb-users mailing list
pyusb-***@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pyusb-users
Xiaofan Chen
2015-03-03 01:20:06 UTC
Permalink
Post by Michel Allaire
But it seems that I can't access the list devices on the bus with the
import usb.core
import usb.util
list_dev = usb.core.find(find_all=True)
n = 0
n = n+1
print (n, " " , dev)
Could it be because I did not specified any filter or .INF file since I want
to scan the bus myself to connect to microcontrollers in a arbitrary number
and USB ready
Yes. If you use libusb-win32 under Windows, you have to have
one supported device with libusb0.sys driver.

If you use libusb-1.0 backend (libusb Windows backend), then you
do not need to have a device with a supported driver (eg WinUSB) to find
the device, but then you need to have such a device if you want to do
more than that (read/write endpoint, etc).
Post by Michel Allaire
Will this behavior also exists on my target operating system with will be
Linux running on à Raspberry PI.
No. Linux is different since libusb uses usbfs under Linux (you do need
to detach non-usbfs driver first).
--
Xiaofan
Michel Allaire
2015-03-04 02:22:06 UTC
Permalink
Thank you very much and my best regards

Michel Allaire

-----Message d'origine-----
De : Xiaofan Chen [mailto:***@gmail.com]
Envoyé : 2 mars 2015 20:20
À : pyusb-***@lists.sourceforge.net
Objet : Re: [pyusb-users] No backend available with windows 7
Post by Michel Allaire
But it seems that I can't access the list devices on the bus with the
import usb.core
import usb.util
n = n+1
print (n, " " , dev)
Could it be because I did not specified any filter or .INF file since
I want to scan the bus myself to connect to microcontrollers in a
arbitrary number and USB ready
Yes. If you use libusb-win32 under Windows, you have to have one supported device with libusb0.sys driver.

If you use libusb-1.0 backend (libusb Windows backend), then you do not need to have a device with a supported driver (eg WinUSB) to find the device, but then you need to have such a device if you want to do more than that (read/write endpoint, etc).
Post by Michel Allaire
Will this behavior also exists on my target operating system with will
be Linux running on à Raspberry PI.
No. Linux is different since libusb uses usbfs under Linux (you do need to detach non-usbfs driver first).



--
Xiaofan

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
pyusb-users mailing list
pyusb-***@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pyusb-users

Loading...