apmorton / pyhidapi

hidapi bindings in ctypes
MIT License
111 stars 42 forks source link

Suddenly got error about missing libraries "Unable to load any of the following libraries" #52

Open andkirby opened 2 years ago

andkirby commented 2 years ago

It was working fine, but for some reason, I started getting this error.

ImportError: Unable to load any of the following libraries:libhidapi-hidraw.so libhidapi-hidraw.so.0 libhidapi-libusb.so libhidapi-libusb.so.0 libhidapi-iohidmanager.so libhidapi-iohidmanager.so.0 libhidapi.dylib hidapi.dll libhidapi-0.dll

It happens on in line with import hid.

Tried to uninstall/install hid package. The same.

Why?

OS: Windows 11 CLI: Git bash Python: 3.9.9 (venv)

neozetare commented 2 years ago

Had the same, don't know how to fix it but found a workaround: load the hidapi DLL before importing the hid library.


import os, ctypes
ctypes.CDLL('/path/to/hidapi.dll'))```