How to Determine where to install hidapi.dll?

Viewed 7263

Context: A Windows 10 attempt to install and test python hid per instructions:

 pip install hid

The test to import the module failed:

Python 3.8.3 (tags/v3.8.3:6f8c832, May 13 2020, 22:37:02) [MSC v.1924 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import hid
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\student\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\hid\__init__.py", line 30, in <module>
    raise ImportError(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

Released hidapi-win.zip includes pre-compiled:

   hidapi.dll
   hidapi.lib

Question: What is the thought process & facts necessary to determine the proper location to install the two files? Assume a recent new install of Windows 10 and Python 3.8

3 Answers

First, you need to Unblock them. Right-clik > Properties > Unblock Place both files in the same folder where python.exe is. The location of python exe can be found in the command line as where python

Paste the .dll and .lib file inside the Windows/System32 folder. After that restart the terminal and the hid module should find the library without a problem

I got the same issue. There was another version of hid installed in my system, after deleting the hid folder issue got solved. Check the version of hid still exits in this below "site-packages" folder. C:\Users\OPERATOR\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages

Related