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

usb.core NoBackendError #1891

Closed
eslavko opened this issue Mar 17, 2016 · 17 comments
Closed

usb.core NoBackendError #1891

eslavko opened this issue Mar 17, 2016 · 17 comments
Labels
area:hooks Caused by or effecting some hook kind:support

Comments

@eslavko
Copy link

eslavko commented Mar 17, 2016

Hello...
I'm not expert in python nor pyinstaller. But I try all (at least I think) possible solutions to solve problem.
So as problem is near same as in other example I steal minimal program and it is this piece:
all work is done in WinXP running virtualbox hosted by ubuntu.

import usb

print 'pyusb.version:{}'.format(usb.__version__)

dev = usb.core.find()

print dev

and result is:

_pyusb.version:1.0.0rc1
Traceback (most recent call last):
  File "<string>", line 3, in <module>
  File "site-packages\usb\core.py", line 1263, in find 
usb.core.NoBackendError: No backend available
t returned -1_

I do compile with: pyinstaller -F c:\xx\t.py and here is log:

_C:\xx>pyinstaller -F c:\xx\t.py
70 INFO: PyInstaller: 3.1.1
70 INFO: Python: 2.7.11
70 INFO: Platform: Windows-XP-5.1.2600-SP3
70 INFO: wrote C:\xx\t.spec
80 INFO: UPX is not available.
80 INFO: Extending PYTHONPATH with paths
['c:\\xx', 'C:\\xx']
80 INFO: checking Analysis
80 INFO: Building Analysis because out00-Analysis.toc is non existent
80 INFO: Initializing module dependency graph...
80 INFO: Initializing module graph hooks...
120 INFO: running Analysis out00-Analysis.toc
130 INFO: Adding Microsoft.VC90.CRT to dependent assemblies of final executable
  required by C:\Python27\python.exe
130 INFO: Found C:\WINDOWS\WinSxS\Policies\x86_policy.9.0.Microsoft.VC90.CRT_1fc
8b3b9a1e18e3b_x-ww_b7353f75\9.0.30729.1.policy
130 INFO: Found C:\WINDOWS\WinSxS\Policies\x86_policy.9.0.Microsoft.VC90.CRT_1fc
8b3b9a1e18e3b_x-ww_b7353f75\9.0.30729.4148.policy
140 INFO: Searching for assembly x86_Microsoft.VC90.CRT_1fc8b3b9a1e18e3b_9.0.307
29.4148_x-ww ...
140 INFO: Found manifest C:\WINDOWS\WinSxS\Manifests\x86_Microsoft.VC90.CRT_1fc8
b3b9a1e18e3b_9.0.30729.4148_x-ww_d495ac4e.manifest
140 INFO: Searching for file msvcr90.dll
140 INFO: Found file C:\WINDOWS\WinSxS\x86_Microsoft.VC90.CRT_1fc8b3b9a1e18e3b_9
.0.30729.4148_x-ww_d495ac4e\msvcr90.dll
140 INFO: Searching for file msvcp90.dll
140 INFO: Found file C:\WINDOWS\WinSxS\x86_Microsoft.VC90.CRT_1fc8b3b9a1e18e3b_9
.0.30729.4148_x-ww_d495ac4e\msvcp90.dll
140 INFO: Searching for file msvcm90.dll
140 INFO: Found file C:\WINDOWS\WinSxS\x86_Microsoft.VC90.CRT_1fc8b3b9a1e18e3b_9
.0.30729.4148_x-ww_d495ac4e\msvcm90.dll
140 INFO: Found C:\WINDOWS\WinSxS\Policies\x86_policy.9.0.Microsoft.VC90.CRT_1fc
8b3b9a1e18e3b_x-ww_b7353f75\9.0.30729.1.policy
140 INFO: Found C:\WINDOWS\WinSxS\Policies\x86_policy.9.0.Microsoft.VC90.CRT_1fc
8b3b9a1e18e3b_x-ww_b7353f75\9.0.30729.4148.policy
140 INFO: Adding redirect Microsoft.VC90.CRT version (9, 0, 21022, 8) -> (9, 0,
30729, 4148)
190 INFO: Analyzing c:\xx\t.py
1542 INFO: Looking for import hooks ...
1552 INFO: Processing hook   hook-usb.py
1552 INFO: Processing hook   hook-encodings.py
2003 INFO: Looking for ctypes DLLs
2023 INFO: Analyzing run-time hooks ...
2023 INFO: Including run-time hook 'pyi_rth_usb.py'
2032 INFO: Looking for dynamic libraries
2083 INFO: Looking for eggs
2083 INFO: Using Python library C:\WINDOWS\system32\python27.dll
2083 INFO: Found binding redirects:
[BindingRedirect(name=u'Microsoft.VC90.CRT', language=None, arch=u'x86', oldVers
ion=(9, 0, 21022, 8), newVersion=(9, 0, 30729, 4148), publicKeyToken=u'1fc8b3b9a
1e18e3b')]
2083 INFO: Warnings written to C:\xx\build\t\warnt.txt
2163 INFO: checking PYZ
2163 INFO: Building PYZ because out00-PYZ.toc is non existent
2163 INFO: Building PYZ (ZlibArchive) C:\xx\build\t\out00-PYZ.pyz
2383 INFO: checking PKG
2383 INFO: Building PKG because out00-PKG.toc is non existent
2383 INFO: Building PKG (CArchive) out00-PKG.pkg
2413 INFO: Redirecting Microsoft.VC90.CRT version (9, 0, 21022, 8) -> (9, 0, 307
29, 4148)
3545 INFO: Bootloader C:\Python27\lib\site-packages\pyinstaller-3.1.1-py2.7.egg\
PyInstaller\bootloader\Windows-32bit\run.exe
3545 INFO: checking EXE
3545 INFO: Building EXE because out00-EXE.toc is non existent
3545 INFO: Building EXE from out00-EXE.toc
3545 INFO: Appending archive to EXE C:\xx\dist\t.exe

Warnings written to C:\xx\build\t\warnt.txt

missing module named usb.core.USBError - imported by usb.core, usb.backend.libusb1, usb.backend.libusb0, usb.backend.openusb
missing module named _functools.partial - imported by _functools, functools
missing module named _functools.reduce - imported by _functools, functools
missing module named struct.calcsize - imported by struct, ctypes
missing module named _struct.__doc__ - imported by _struct, struct
missing module named _struct._clearcache - imported by _struct, struct
missing module named _hashlib.pbkdf2_hmac - imported by _hashlib, hashlib
missing module named binascii.hexlify - imported by binascii, random
missing module named binascii.b2a_qp - imported by binascii, quopri
missing module named binascii.a2b_qp - imported by binascii, quopri
missing module named binascii.a2b_uu - imported by binascii, encodings.uu_codec
missing module named binascii.b2a_uu - imported by binascii, encodings.uu_codec
missing module named os.urandom - imported by os, random
missing module named math.sin - imported by math, random
missing module named math.sqrt - imported by math, random
missing module named math.cos - imported by math, random
missing module named math.acos - imported by math, random
missing module named math.ceil - imported by math, random
missing module named math.exp - imported by math, random
missing module named math.log - imported by math, random
missing module named math.e - imported by math, random
missing module named math.pi - imported by math, random
missing module named threading.RLock - imported by threading, _threading_local
missing module named threading.current_thread - imported by threading, _threading_local
missing module named thread._local - imported by thread, threading
missing module named thread.stack_size - imported by thread, threading
missing module named time.time - imported by time, threading
missing module named time.sleep - imported by time, threading
missing module named thread.allocate_lock - imported by thread, _strptime
missing module named datetime.date - imported by datetime, _strptime
missing module named _sre.MAXREPEAT - imported by _sre, sre_constants
missing module named strop.whitespace - imported by strop, string
missing module named strop.maketrans - imported by strop, string
missing module named strop.lowercase - imported by strop, string
missing module named strop.uppercase - imported by strop, string
missing module named re._compile - imported by re, sre
missing module named re.__all__ - imported by re, sre
missing module named itertools.chain - imported by itertools, tokenize, heapq, collections
missing module named errno.EINVAL - imported by errno, StringIO
missing module named cStringIO.StringIO - imported by cStringIO, gettext, pprint, shlex, tempfile, pickle, encodings.uu_codec, quopri, encodings.quopri_codec
missing module named errno.ENOENT - imported by errno, gettext
missing module named itertools.count - imported by itertools, heapq, threading
missing module named itertools.groupby - imported by itertools, usb.legacy
missing module named itertools.ifilterfalse - imported by itertools, sets
missing module named itertools.ifilter - imported by itertools, sets
missing module named itertools.starmap - imported by itertools, collections
missing module named itertools.repeat - imported by itertools, collections
missing module named itertools.imap - imported by itertools, heapq, collections
missing module named itertools.tee - imported by itertools, heapq
missing module named itertools.izip - imported by itertools, heapq
missing module named itertools.islice - imported by itertools, repr, heapq
missing module named collections.deque - imported by collections, shlex, threading
missing module named fcntl - imported by tempfile, subprocess
missing module named _io.DEFAULT_BUFFER_SIZE - imported by _io, io
missing module named _io.BytesIO - imported by _io, io
missing module named _io.open - imported by _io, io
missing module named _io.BufferedWriter - imported by _io, io
missing module named _io.FileIO - imported by _io, io
missing module named _io.BlockingIOError - imported by _io, io
missing module named _io.IncrementalNewlineDecoder - imported by _io, io
missing module named _io.BufferedReader - imported by _io, io
missing module named _io.BufferedRandom - imported by _io, io
missing module named _io.StringIO - imported by _io, io
missing module named _io.BufferedRWPair - imported by _io, io
missing module named _io.TextIOWrapper - imported by _io, io
missing module named _io.UnsupportedOperation - imported by _io, io
missing module named _weakref.ref - imported by _weakref, _weakrefset, weakref
missing module named _weakref.ReferenceType - imported by _weakref, weakref
missing module named _weakref.proxy - imported by _weakref, weakref
missing module named _weakref.getweakrefs - imported by _weakref, weakref
missing module named _weakref.getweakrefcount - imported by _weakref, weakref
missing module named _weakref.ProxyType - imported by _weakref, weakref
missing module named _weakref.CallableProxyType - imported by _weakref, weakref
missing module named nt._isdir - imported by nt, ntpath
missing module named nt._getfullpathname - imported by nt, ntpath
missing module named nt._exit - imported by nt, os
missing module named readline - imported by cmd, pdb
missing module named pwd - imported by posixpath
missing module named copy.deepcopy - imported by copy, weakref, sets
missing module named exceptions.ReferenceError - imported by exceptions, weakref
missing module named operator.attrgetter - imported by operator, inspect
missing module named cPickle.loads - imported by cPickle, collections
missing module named cPickle.dumps - imported by cPickle, collections
missing module named thread.get_ident - imported by thread, collections
missing module named collections.OrderedDict - imported by collections, unittest.util
missing module named collections.namedtuple - imported by collections, inspect, unittest.util, difflib, doctest
missing module named operator.itemgetter - imported by operator, collections, heapq
missing module named operator.eq - imported by operator, collections
missing module named _collections.deque - imported by _collections, collections
missing module named _collections.defaultdict - imported by _collections, collections
missing module named _warnings.warn_explicit - imported by _warnings, warnings
missing module named _warnings.filters - imported by _warnings, warnings
missing module named _warnings.once_registry - imported by _warnings, warnings
missing module named _warnings.default_action - imported by _warnings, warnings
missing module named _warnings.warn - imported by _warnings, warnings
missing module named org.PyStringMap - imported by org, copy
missing module named org - imported by copy
missing module named sys.hexversion - imported by sys, usb.util
missing module named 'usb.backend.libusb01' - imported by C:\Python27\lib\site-packages\pyinstaller-3.1.1-py2.7.egg\PyInstaller\loader\rthooks\pyi_rth_usb.py
missing module named 'usb.backend.libusb10' - imported by C:\Python27\lib\site-packages\pyinstaller-3.1.1-py2.7.egg\PyInstaller\loader\rthooks\pyi_rth_usb.py
missing module named _subprocess.STD_OUTPUT_HANDLE - imported by _subprocess, subprocess
missing module named _subprocess.CREATE_NEW_PROCESS_GROUP - imported by _subprocess, subprocess
missing module named _subprocess.STD_INPUT_HANDLE - imported by _subprocess, subprocess
missing module named _subprocess.STARTF_USESHOWWINDOW - imported by _subprocess, subprocess
missing module named _subprocess.CREATE_NEW_CONSOLE - imported by _subprocess, subprocess
missing module named _subprocess.STD_ERROR_HANDLE - imported by _subprocess, subprocess
missing module named _subprocess.STARTF_USESTDHANDLES - imported by _subprocess, subprocess
missing module named _subprocess.SW_HIDE - imported by _subprocess, subprocess
missing module named 'org.python'.PyStringMap - imported by 'org.python', pickle
missing module named 'org.python' - imported by pickle
missing module named riscosenviron._Environ - imported by riscosenviron, os
missing module named riscosenviron - imported by os
missing module named riscospath - imported by os
missing module named riscos._exit - imported by riscos, os
missing module named riscos - imported by os
missing module named ce._exit - imported by ce, os
missing module named ce - imported by os
missing module named _emx_link.link - imported by _emx_link, os
missing module named _emx_link - imported by os
missing module named os2._exit - imported by os2, os
missing module named os2 - imported by os
missing module named posix._exit - imported by posix, os
missing module named posix - imported by os
missing module named resource - imported by posix
missing module named _ctypes._wstring_at_addr - imported by _ctypes, ctypes
missing module named _ctypes._string_at_addr - imported by _ctypes, ctypes
missing module named _ctypes._cast_addr - imported by _ctypes, ctypes
missing module named _ctypes._memset_addr - imported by _ctypes, ctypes
missing module named _ctypes._memmove_addr - imported by _ctypes, ctypes
missing module named _ctypes.get_last_error - imported by _ctypes, ctypes
missing module named _ctypes.set_last_error - imported by _ctypes, ctypes
missing module named _ctypes._check_HRESULT - imported by _ctypes, ctypes
missing module named _ctypes.set_conversion_mode - imported by _ctypes, ctypes
missing module named _ctypes._pointer_type_cache - imported by _ctypes, ctypes
missing module named _ctypes.POINTER - imported by _ctypes, ctypes
missing module named _ctypes._SimpleCData - imported by _ctypes, ctypes
missing module named _ctypes.get_errno - imported by _ctypes, ctypes
missing module named _ctypes.set_errno - imported by _ctypes, ctypes
missing module named _ctypes.alignment - imported by _ctypes, ctypes
missing module named _ctypes.addressof - imported by _ctypes, ctypes
missing module named _ctypes.resize - imported by _ctypes, ctypes
missing module named _ctypes.byref - imported by _ctypes, ctypes
missing module named _ctypes.sizeof - imported by _ctypes, ctypes
missing module named _ctypes.dlopen - imported by _ctypes, ctypes
missing module named _ctypes.FUNCFLAG_STDCALL - imported by _ctypes, ctypes
missing module named _ctypes.LoadLibrary - imported by _ctypes, ctypes
missing module named _ctypes.FUNCFLAG_USE_ERRNO - imported by _ctypes, ctypes
missing module named _ctypes.FUNCFLAG_USE_LASTERROR - imported by _ctypes, ctypes
missing module named _ctypes.FUNCFLAG_PYTHONAPI - imported by _ctypes, ctypes
missing module named _ctypes.FUNCFLAG_CDECL - imported by _ctypes, ctypes
missing module named _ctypes.FormatError - imported by _ctypes, ctypes
missing module named _ctypes.ArgumentError - imported by _ctypes, ctypes
missing module named _ctypes.RTLD_LOCAL - imported by _ctypes, ctypes
missing module named _ctypes.RTLD_GLOBAL - imported by _ctypes, ctypes
missing module named _ctypes.__version__ - imported by _ctypes, ctypes
missing module named _ctypes.CFuncPtr - imported by _ctypes, ctypes
missing module named _ctypes._Pointer - imported by _ctypes, ctypes
missing module named _ctypes.Structure - imported by _ctypes, ctypes
missing module named _ctypes.Array - imported by _ctypes, ctypes
missing module named _ctypes.Union - imported by _ctypes, ctypes
missing module named unicodedata.ucd_3_2_0 - imported by unicodedata, stringprep, encodings.idna
missing module named codecs.mbcs_encode - imported by codecs, encodings.mbcs
missing module named codecs.mbcs_decode - imported by codecs, encodings.mbcs

I do try to use development version of pyinstaller but seems to be even worse. Here are the outputs:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
NameError: name 'c' is not defined
pyiboot01_bootstrap returned -1

``
C:\xx>pyinstaller -F c:\xx\t.py
100 INFO: PyInstaller: 3.2.dev0+9dc28c0
100 INFO: Python: 2.7.11
100 INFO: Platform: Windows-XP-5.1.2600-SP3
100 INFO: wrote C:\xx\t.spec
100 INFO: UPX is not available.
100 INFO: Extending PYTHONPATH with paths
['c:\xx', 'C:\xx']
100 INFO: checking Analysis
100 INFO: Building Analysis because out00-Analysis.toc is non existent
100 INFO: Initializing module dependency graph...
111 INFO: Initializing module graph hooks...
151 INFO: running Analysis out00-Analysis.toc
171 INFO: Adding Microsoft.VC90.CRT to dependent assemblies of final executable
required by C:\Python27\python.exe
171 INFO: Found C:\WINDOWS\WinSxS\Policies\x86_policy.9.0.Microsoft.VC90.CRT_1fc
8b3b9a1e18e3b_x-ww_b7353f75\9.0.30729.1.policy
171 INFO: Found C:\WINDOWS\WinSxS\Policies\x86_policy.9.0.Microsoft.VC90.CRT_1fc
8b3b9a1e18e3b_x-ww_b7353f75\9.0.30729.4148.policy
180 INFO: Searching for assembly x86_Microsoft.VC90.CRT_1fc8b3b9a1e18e3b_9.0.307
29.4148_x-ww ...
180 INFO: Found manifest C:\WINDOWS\WinSxS\Manifests\x86_Microsoft.VC90.CRT_1fc8
b3b9a1e18e3b_9.0.30729.4148_x-ww_d495ac4e.manifest
180 INFO: Searching for file msvcr90.dll
180 INFO: Found file C:\WINDOWS\WinSxS\x86_Microsoft.VC90.CRT_1fc8b3b9a1e18e3b_9
.0.30729.4148_x-ww_d495ac4e\msvcr90.dll
180 INFO: Searching for file msvcp90.dll
180 INFO: Found file C:\WINDOWS\WinSxS\x86_Microsoft.VC90.CRT_1fc8b3b9a1e18e3b_9
.0.30729.4148_x-ww_d495ac4e\msvcp90.dll
180 INFO: Searching for file msvcm90.dll
180 INFO: Found file C:\WINDOWS\WinSxS\x86_Microsoft.VC90.CRT_1fc8b3b9a1e18e3b_9
.0.30729.4148_x-ww_d495ac4e\msvcm90.dll
180 INFO: Found C:\WINDOWS\WinSxS\Policies\x86_policy.9.0.Microsoft.VC90.CRT_1fc
8b3b9a1e18e3b_x-ww_b7353f75\9.0.30729.1.policy
180 INFO: Found C:\WINDOWS\WinSxS\Policies\x86_policy.9.0.Microsoft.VC90.CRT_1fc
8b3b9a1e18e3b_x-ww_b7353f75\9.0.30729.4148.policy
180 INFO: Adding redirect Microsoft.VC90.CRT version (9, 0, 21022, 8) -> (9, 0,
30729, 4148)
230 INFO: Analyzing c:\xx\t.py
1562 INFO: Looking for import hooks ...
1572 INFO: Processing hook hook-usb.py
1582 INFO: Processing hook hook-encodings.py
2003 INFO: Looking for ctypes DLLs
2023 INFO: Analyzing run-time hooks ...
2023 INFO: Including run-time hook 'pyi_rth_usb.py'
2032 INFO: Looking for dynamic libraries
2082 INFO: Looking for eggs
2082 INFO: Using Python library C:\WINDOWS\system32\python27.dll
2082 INFO: Found binding redirects:
[BindingRedirect(name=u'Microsoft.VC90.CRT', language=None, arch=u'x86', oldVers
ion=(9, 0, 21022, 8), newVersion=(9, 0, 30729, 4148), publicKeyToken=u'1fc8b3b9a
1e18e3b')]
2082 INFO: Warnings written to C:\xx\build\t\warnt.txt
2132 INFO: checking PYZ
2132 INFO: Building PYZ because out00-PYZ.toc is non existent
2132 INFO: Building PYZ (ZlibArchive) C:\xx\build\t\out00-PYZ.pyz
2533 INFO: checking PKG
2533 INFO: Building PKG because out00-PKG.toc is non existent
2533 INFO: Building PKG (CArchive) out00-PKG.pkg
2553 INFO: Redirecting Microsoft.VC90.CRT version (9, 0, 21022, 8) -> (9, 0, 307
29, 4148)
3725 INFO: Bootloader C:\Python27\lib\site-packages\pyinstaller-3.2.dev0+9dc28c0
-py2.7.egg\PyInstaller\bootloader\Windows-32bit\run.exe
3725 INFO: checking EXE
3725 INFO: Building EXE because out00-EXE.toc is non existent
3725 INFO: Building EXE from out00-EXE.toc
3725 INFO: Appending archive to EXE C:\xx\dist\t.exe


missing module named usb.core.USBError - imported by usb.core, usb.backend.libusb1, usb.backend.libusb0, usb.backend.openusb
missing module named _functools.partial - imported by _functools, functools
missing module named _functools.reduce - imported by _functools, functools
missing module named struct.calcsize - imported by struct, ctypes
missing module named _struct.doc - imported by _struct, struct
missing module named _struct._clearcache - imported by _struct, struct
missing module named _hashlib.pbkdf2_hmac - imported by _hashlib, hashlib
missing module named binascii.hexlify - imported by binascii, random
missing module named binascii.b2a_qp - imported by binascii, quopri
missing module named binascii.a2b_qp - imported by binascii, quopri
missing module named binascii.a2b_uu - imported by binascii, encodings.uu_codec
missing module named binascii.b2a_uu - imported by binascii, encodings.uu_codec
missing module named os.urandom - imported by os, random
missing module named math.sin - imported by math, random
missing module named math.sqrt - imported by math, random
missing module named math.cos - imported by math, random
missing module named math.acos - imported by math, random
missing module named math.ceil - imported by math, random
missing module named math.exp - imported by math, random
missing module named math.log - imported by math, random
missing module named math.e - imported by math, random
missing module named math.pi - imported by math, random
missing module named threading.RLock - imported by threading, _threading_local
missing module named threading.current_thread - imported by threading, _threading_local
missing module named thread._local - imported by thread, threading
missing module named thread.stack_size - imported by thread, threading
missing module named time.time - imported by time, threading
missing module named time.sleep - imported by time, threading
missing module named thread.allocate_lock - imported by thread, _strptime
missing module named datetime.date - imported by datetime, _strptime
missing module named _sre.MAXREPEAT - imported by _sre, sre_constants
missing module named strop.whitespace - imported by strop, string
missing module named strop.maketrans - imported by strop, string
missing module named strop.lowercase - imported by strop, string
missing module named strop.uppercase - imported by strop, string
missing module named re._compile - imported by re, sre
missing module named re.all - imported by re, sre
missing module named itertools.chain - imported by itertools, tokenize, heapq, collections
missing module named errno.EINVAL - imported by errno, StringIO
missing module named cStringIO.StringIO - imported by cStringIO, gettext, pprint, shlex, tempfile, pickle, encodings.uu_codec, quopri, encodings.quopri_codec
missing module named errno.ENOENT - imported by errno, gettext
missing module named itertools.count - imported by itertools, heapq, threading
missing module named itertools.groupby - imported by itertools, usb.legacy
missing module named itertools.ifilterfalse - imported by itertools, sets
missing module named itertools.ifilter - imported by itertools, sets
missing module named itertools.starmap - imported by itertools, collections
missing module named itertools.repeat - imported by itertools, collections
missing module named itertools.imap - imported by itertools, heapq, collections
missing module named itertools.tee - imported by itertools, heapq
missing module named itertools.izip - imported by itertools, heapq
missing module named itertools.islice - imported by itertools, repr, heapq
missing module named collections.deque - imported by collections, shlex, threading
missing module named fcntl - imported by tempfile, subprocess
missing module named _io.DEFAULT_BUFFER_SIZE - imported by _io, io
missing module named _io.BytesIO - imported by _io, io
missing module named _io.open - imported by _io, io
missing module named _io.BufferedWriter - imported by _io, io
missing module named _io.FileIO - imported by _io, io
missing module named _io.BlockingIOError - imported by _io, io
missing module named _io.IncrementalNewlineDecoder - imported by _io, io
missing module named _io.BufferedReader - imported by _io, io
missing module named _io.BufferedRandom - imported by _io, io
missing module named _io.StringIO - imported by _io, io
missing module named _io.BufferedRWPair - imported by _io, io
missing module named _io.TextIOWrapper - imported by _io, io
missing module named _io.UnsupportedOperation - imported by _io, io
missing module named _weakref.ref - imported by _weakref, _weakrefset, weakref
missing module named _weakref.ReferenceType - imported by _weakref, weakref
missing module named _weakref.proxy - imported by _weakref, weakref
missing module named _weakref.getweakrefs - imported by _weakref, weakref
missing module named _weakref.getweakrefcount - imported by _weakref, weakref
missing module named _weakref.ProxyType - imported by _weakref, weakref
missing module named _weakref.CallableProxyType - imported by _weakref, weakref
missing module named nt._isdir - imported by nt, ntpath
missing module named nt._getfullpathname - imported by nt, ntpath
missing module named nt._exit - imported by nt, os
missing module named readline - imported by cmd, pdb
missing module named pwd - imported by posixpath
missing module named copy.deepcopy - imported by copy, weakref, sets
missing module named exceptions.ReferenceError - imported by exceptions, weakref
missing module named operator.attrgetter - imported by operator, inspect
missing module named cPickle.loads - imported by cPickle, collections
missing module named cPickle.dumps - imported by cPickle, collections
missing module named thread.get_ident - imported by thread, collections
missing module named collections.OrderedDict - imported by collections, unittest.util
missing module named collections.namedtuple - imported by collections, inspect, unittest.util, difflib, doctest
missing module named operator.itemgetter - imported by operator, collections, heapq
missing module named operator.eq - imported by operator, collections
missing module named _collections.deque - imported by _collections, collections
missing module named _collections.defaultdict - imported by _collections, collections
missing module named _warnings.warn_explicit - imported by _warnings, warnings
missing module named _warnings.filters - imported by _warnings, warnings
missing module named _warnings.once_registry - imported by _warnings, warnings
missing module named _warnings.default_action - imported by _warnings, warnings
missing module named _warnings.warn - imported by _warnings, warnings
missing module named org.PyStringMap - imported by org, copy
missing module named org - imported by copy
missing module named sys.hexversion - imported by sys, usb.util
missing module named 'usb.backend.libusb01' - imported by C:\Python27\lib\site-packages\pyinstaller-3.2.dev0+9dc28c0-py2.7.egg\PyInstaller\loader\rthooks\pyi_rth_usb.py
missing module named 'usb.backend.libusb10' - imported by C:\Python27\lib\site-packages\pyinstaller-3.2.dev0+9dc28c0-py2.7.egg\PyInstaller\loader\rthooks\pyi_rth_usb.py
missing module named _subprocess.STD_OUTPUT_HANDLE - imported by _subprocess, subprocess
missing module named _subprocess.CREATE_NEW_PROCESS_GROUP - imported by _subprocess, subprocess
missing module named _subprocess.STD_INPUT_HANDLE - imported by _subprocess, subprocess
missing module named _subprocess.STARTF_USESHOWWINDOW - imported by _subprocess, subprocess
missing module named _subprocess.CREATE_NEW_CONSOLE - imported by _subprocess, subprocess
missing module named _subprocess.STD_ERROR_HANDLE - imported by _subprocess, subprocess
missing module named _subprocess.STARTF_USESTDHANDLES - imported by _subprocess, subprocess
missing module named _subprocess.SW_HIDE - imported by _subprocess, subprocess
missing module named 'org.python'.PyStringMap - imported by 'org.python', pickle
missing module named 'org.python' - imported by pickle
missing module named riscosenviron._Environ - imported by riscosenviron, os
missing module named riscosenviron - imported by os
missing module named riscospath - imported by os
missing module named riscos._exit - imported by riscos, os
missing module named riscos - imported by os
missing module named ce._exit - imported by ce, os
missing module named ce - imported by os
missing module named _emx_link.link - imported by _emx_link, os
missing module named _emx_link - imported by os
missing module named os2._exit - imported by os2, os
missing module named os2 - imported by os
missing module named posix._exit - imported by posix, os
missing module named posix - imported by os
missing module named resource - imported by posix
missing module named _ctypes._wstring_at_addr - imported by _ctypes, ctypes
missing module named _ctypes._string_at_addr - imported by _ctypes, ctypes
missing module named _ctypes._cast_addr - imported by _ctypes, ctypes
missing module named _ctypes._memset_addr - imported by _ctypes, ctypes
missing module named _ctypes._memmove_addr - imported by _ctypes, ctypes
missing module named _ctypes.get_last_error - imported by _ctypes, ctypes
missing module named _ctypes.set_last_error - imported by _ctypes, ctypes
missing module named _ctypes._check_HRESULT - imported by _ctypes, ctypes
missing module named _ctypes.set_conversion_mode - imported by _ctypes, ctypes
missing module named _ctypes._pointer_type_cache - imported by _ctypes, ctypes
missing module named _ctypes.POINTER - imported by _ctypes, ctypes
missing module named _ctypes._SimpleCData - imported by _ctypes, ctypes
missing module named _ctypes.get_errno - imported by _ctypes, ctypes
missing module named _ctypes.set_errno - imported by _ctypes, ctypes
missing module named _ctypes.alignment - imported by _ctypes, ctypes
missing module named _ctypes.addressof - imported by _ctypes, ctypes
missing module named _ctypes.resize - imported by _ctypes, ctypes
missing module named _ctypes.byref - imported by _ctypes, ctypes
missing module named _ctypes.sizeof - imported by _ctypes, ctypes
missing module named _ctypes.dlopen - imported by _ctypes, ctypes
missing module named _ctypes.FUNCFLAG_STDCALL - imported by _ctypes, ctypes
missing module named _ctypes.LoadLibrary - imported by _ctypes, ctypes
missing module named _ctypes.FUNCFLAG_USE_ERRNO - imported by _ctypes, ctypes
missing module named _ctypes.FUNCFLAG_USE_LASTERROR - imported by _ctypes, ctypes
missing module named _ctypes.FUNCFLAG_PYTHONAPI - imported by _ctypes, ctypes
missing module named _ctypes.FUNCFLAG_CDECL - imported by _ctypes, ctypes
missing module named _ctypes.FormatError - imported by _ctypes, ctypes
missing module named _ctypes.ArgumentError - imported by _ctypes, ctypes
missing module named _ctypes.RTLD_LOCAL - imported by _ctypes, ctypes
missing module named _ctypes.RTLD_GLOBAL - imported by _ctypes, ctypes
missing module named _ctypes.version - imported by _ctypes, ctypes
missing module named _ctypes.CFuncPtr - imported by _ctypes, ctypes
missing module named _ctypes._Pointer - imported by _ctypes, ctypes
missing module named _ctypes.Structure - imported by _ctypes, ctypes
missing module named _ctypes.Array - imported by _ctypes, ctypes
missing module named _ctypes.Union - imported by _ctypes, ctypes
missing module named unicodedata.ucd_3_2_0 - imported by unicodedata, stringprep, encodings.idna
missing module named codecs.mbcs_encode - imported by codecs, encodings.mbcs
missing module named codecs.mbcs_decode - imported by codecs, encodings.mbcs


so what to do next?

Thanks.

@htgoebel
Copy link
Member

@htgoebel htgoebel added kind:support area:hooks Caused by or effecting some hook labels Mar 17, 2016
@eslavko
Copy link
Author

eslavko commented Mar 17, 2016

This is not helpful. I do try to solve problem reading this already.

@htgoebel
Copy link
Member

The error message clearly says usb.core.NoBackendError: No backend available. So the backend is missing. And thus the instructions of my link above are the way to go. You need to find out, which backend is required and why it is i missing.

@eslavko
Copy link
Author

eslavko commented Mar 17, 2016

Something is wrong here.
if I run program with "python myprog.py" it works as should.
If in same system execute:
pyinstaller myprog.py
myprog.exe
then I got missing backend error.
And I don't have a clue how to solve that.

@tallforasmurf
Copy link
Contributor

When you bundle with -F option, you get a one-file app. One hopes that everything the app needs to run is in that one file. Python interpreter, all imported modules, everything. So it does not matter where you run it, if something called a "backend" was not bundled into the one file, it will be "missing".

The question is, what is this "backend" thing that is not being picked up? The question is a little easier to answer if you bundle with the -D option instead. Then you can inspect inside dist\myprog\myprog to see all the things PyInstaller collected.

What is this module usb, it does not seem to be a standard module and I do not see it at pypi.python.org. So I cannot tell what it means by "NoBackendError".

@eslavko
Copy link
Author

eslavko commented Mar 18, 2016

Hello...
I do try with -D option too with same result.
module "usb" is used to communicate with usb devices. https://walac.github.io/pyusb/ or https://sourceforge.net/projects/pyusb/
It's available in pip too.
As I understand the pyusb (module usb) is just a wrapper to libusb0.dll or libusb-1.0.dll. And these dll's needs to be installed separated. And with my understanding that's is backend.
The trouble is that when I start python myprog.py all things works great. But if I build with pyinstaller the backend is reported missing but it is in system! the dll is in dist folder (-D option) too.
Something strange is there.
these files are collected in dist folder.
(should be something like _usb.pyd here too?)

 _ctypes.pyd
_hashlib.pyd
_socket.pyd
_ssl.pyd
bz2.pyd
libusb-1.0.dll
Microsoft.VC90.CRT.manifest
msvcm90.dll
msvcp90.dll
msvcr90.dll
python27.dll
select.pyd
t.exe
t.exe.manifest
unicodedata.pyd

@tallforasmurf
Copy link
Contributor

Sorry, I did not understand the lib was called pyusb. Now I see it at pypi.
I will not be able to solve this but here is some info for anyone else.
One, if you want to see pyusb loading the backend, the code is here
Two, PyInstaller already has a hook for usb and it is much more complex than the usual hook.
(C), there is also a run-time hook which is also fairly complex.
IV, looking at the output in your original post I see

missing module named usb.core.USBError - imported by usb.core, usb.backend.libusb1, usb.backend.libusb0, usb.backend.openusb

and also,

missing module named 'usb.backend.libusb01' - imported by C:\Python27\lib\site-packages\pyinstaller-3.1.1-py2.7.egg\PyInstaller\loader\rthooks\pyi_rth_usb.py
missing module named 'usb.backend.libusb10' - imported by C:\Python27\lib\site-packages\pyinstaller-3.1.1-py2.7.egg\PyInstaller\loader\rthooks\pyi_rth_usb.py

So, yes, there is perhaps some problem with the hook.

@eslavko
Copy link
Author

eslavko commented Mar 19, 2016

the pyusb support libusb01, libusb10, libusbx, libusb-win, openUsb.... and only one need to be present. so I assume that missing libusb10 and libusb1 is not important in my case but missing libusb01 it is as I rely on this one. And I assume that hook is the trouble...

@eslavko
Copy link
Author

eslavko commented Mar 19, 2016

I try do do some debug. in hook-usb.py I just print result and library is found. So that part seems to work.
but pyi_rth_usb.py I can't understand how they work.
For start I modify beginning to se if backend is loaded. I just put some prints there.

try:
    print "!!!! Trying libusb10"    
    import usb.backend.libusb10 as libusb10
except:
    print "!!!! Failed"

try:
    print "!!!! Trying libusb1"    
    import usb.backend.libusb1 as libusb10
except:
    print "!!!! Failed"
try:
    print "!!!! Trying libusb01"    
    import usb.backend.libusb01 as libusb01
except:
    print "!!!! Failed"
try:
    print "!!!! Trying libusb0"    
    import usb.backend.libusb0 as libusb01 
except:
    print "!!!! Failed"
try:
    print "!!!! Trying openusb"    
    import usb.backend.openusb as openusb
except:
    print "!!!! Failed"


and result is

!!!! Trying libusb10
!!!! Failed
!!!! Trying libusb1
!!!! Trying libusb01
!!!! Failed
!!!! Trying libusb0
!!!! Trying openusb

so librrary libusb1, libusb0 and openusb are found!
So I go next steep. to print candidate list

def get_load_func(type, candidates):
    print "!!!!!!!!CandidateList ",candidates

and got

!!!!!!!!CandidateList  ('usb-1.0', 'libusb-1.0', 'usb')
!!!!!!!!CandidateList  ('usb-0.1', 'usb', 'libusb0', 'libusb')
!!!!!!!!CandidateList  ('openusb',)

so this seems to work too.
but next thing was:

def _load_library():
    exec_path = sys._MEIPASS
    l = None
    for candidate in candidates:
        print "!!!!!! candidate=",candidate

And there I don't get any output. so that loop (for) is not executed at all!
So there is def inside def and I don't understand the parameter passing.
the def get_load_func(type, candidates): got candidates as I can print them.
but def _load_library(): inside def get_load_func(type, candidates) has no parameters.
I expect to be candidates passed to _load_library() too but it doesn't as print there return ''

Any idea?

@stephenrauch
Copy link
Contributor

@eslavko

Did you determine which library is being loaded/used when the application is not frozen?

@eslavko
Copy link
Author

eslavko commented Apr 9, 2016

Hello...
I don't know why but sometime the libusb0 and other time libusb1. I solved that with installing python on target system so pyinstaller is not needed. But this is still the bug in pyinstaller.

@eslavko
Copy link
Author

eslavko commented Apr 9, 2016

...maybe library loaded is device dependant as I do communicate with more physical devices.

@chrisv2
Copy link

chrisv2 commented Jul 4, 2016

I'm having the same problem right now (using PyInstaller 3.2 on Windows 10), so I try to give some more input:

The NoBackendError from the original report is in fact caused by pyusb not being able to find a libusb*.dll - manually copying the DLL to the dist/project folder fixes that, and the application will work as expected. But of course we cannot build a single .EXE that way, which is what I'd like to do.

Looking at hook-usb.py, it seems that the hook intends to add the DLL to binaries, but fails to actually do so, because the DLL in question is installed to C:\Windows\System32, and WinExcludeList excludes everything below C:\Windows. The exclusion happens after the correct path is already found, in _resolveCtypesImports() (hook-usb.py Line 45), which uses WinExcludeList through include_library() from dylib.py.

Unfortunately I'm not familiar enough with PyInstaller's concepts to actually solve that problem. I tried to modify hook-usb.py so that the DLL is not excluded, but then it gets copied to into a subfolder "libusb0.dll", which does not work either (it must be in the output dir directly, otherwise pyusb won't find it). The same happens if I try to add it manually in the .spec file through binaries.

How can we add some files directly to the output folder root, without subdirectory, like PyInstaller 2.1 does it?

@chrisv2
Copy link

chrisv2 commented Jul 5, 2016

Update: The following seems to work (in the .spec file):

binaries = [
   ('C:\\Windows\\System32\\libusb0.dll', '.'),
]

a = Analysis(['myscript.py'],
    ...
    binaries=binaries,
    datas=[],
    hiddenimports=['usb'],
    ...

@stephenrauch
Copy link
Contributor

stephenrauch commented Jul 6, 2016

@chrisv2

I think I found the problem in the hook, as you noted it was the directory. I fixed that and added another detection method which uses the pyusb finder directly. I have a branch with the changed hook 23901eb. If you could try the hook, that would be great.

The test framework is currently not running the test for usb, and I am trying to get that going next.

@kotai2003
Copy link

Update: The following seems to work (in the .spec file):

binaries = [
   ('C:\\Windows\\System32\\libusb0.dll', '.'),
]

a = Analysis(['myscript.py'],
    ...
    binaries=binaries,
    datas=[],
    hiddenimports=['usb'],
    ...

Thanks very much. I could solve the problem with your solution.

@sawyerhammond
Copy link

sawyerhammond commented Jun 21, 2022

Update: The following seems to work (in the .spec file):

binaries = [
   ('C:\\Windows\\System32\\libusb0.dll', '.'),
]

a = Analysis(['myscript.py'],
    ...
    binaries=binaries,
    datas=[],
    hiddenimports=['usb'],
    ...

How are you modifying the .spec file? I am using the command line interface for this so it looks like this:
pyinstaller --console --onefile main.py
It then generates the .spec, how can I modify it and then use it to fix this problem?

EDIT:
I figured it out, I didn't realize that you can use pyinstaller with the .spec file, so my command line command looked like this:
pyinstaller main.spec

Everything works now. Will leave this here if anyone is confused like I was.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area:hooks Caused by or effecting some hook kind:support
Projects
None yet
Development

No branches or pull requests

7 participants