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
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
Hello I have started using pybind11 on windows 10 and I am not using Visual Studio.
I have followed the tutorial I have watched on YT but he was using Linux and after I created my cpp file, I cloned the pybind11 in my current directory and after that I created a build folder.
As what the guy said in the YT, I created a CMakeLists.txt in my folder with something inside:
cmake_minimum_required(VERSION 3.9)
project(pb11Ex)
add_subdirectory(pybind11)
pybind11_add_module(fun, ex_moc.pp)
Then cd to my build directory and run
cmake .. -G "Unix Makefiles"
Cause if I don't add it, it wont gonna generate the makefile
Then after the cmake venerated a makefile, I used
make
command giving me the file:
fun.cp39-win_amd64.pyd
Then when I tried to import it from the python interpreter, I got this:
C:\Users\Nel\Desktop\python_projects\pyb11Ex\build>python
Python 3.9.5 (tags/v3.9.5:0a7dcbd, May 3 2021, 17:27:52) [MSC v.1928 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import fun
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: DLL load failed while importing fun: The specified module could not be found
What does it mean by the DLL stuffs and how would I solve it?
Update:
I just followed the pybind docs
I'm using Python3 bindings for virtualbox (pyvbox). It works with the initial python3 version of my system which is 3.7. Now, I would like to use the very same bindings with python3.8. I have installed all needed python3.8 packages, but i get this error:
$ python3
Python 3.8.0 (default, Oct 28 2019, 16:14:01)
[GCC 9.2.1 20191008] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import virtualbox
>>> _vbox = virtualbox.VirtualBox()
m=VBoxPython3_8 x=No module named 'VBoxPython3_8'
m=VBoxPython3 x=No module named 'VBoxPython3'
m=VBoxPython x=/usr/lib/virtualbox/VBoxPython.so: undefined symbol: _Py_ZeroStruct
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home//.local/lib/python3.8/site-packages/virtualbox/library_ext/vbox.py", line 22, in __init__
manager = virtualbox.Manager()
File "/home//.local/lib/python3.8/site-packages/virtualbox/__init__.py", line 145, in __init__
self.manager = vboxapi.VirtualBoxManager(mtype, mparams)
File "/usr/local/lib/python3.8/dist-packages/vboxapi/__init__.py", line 989, in __init__
self.platform = PlatformXPCOM(dPlatformParams)
File "/usr/local/lib/python3.8/dist-packages/vboxapi/__init__.py", line 750, in __init__
import xpcom.vboxxpcom
File "/usr/lib/virtualbox/sdk/bindings/xpcom/python/xpcom/vboxxpcom.py", line 78, in <module>
raise Exception('Cannot find VBoxPython module (tried: %s)' % (', '.join(_asVBoxPythons),))
Exception: Cannot find VBoxPython module (tried: VBoxPython3_8, VBoxPython3, VBoxPython)
I have found that these modules have to be in /usr/lib/virtualbox, which currently contains only these files:
$ ls /usr/lib/virtualbox/ | grep VBoxPython
VBoxPython2_7.so
VBoxPython3_7m.so
VBoxPython.so
These .so files are installed via the virtualbox package. However, I cannot manage to have neither VBoxPython3.so nor VBoxPython3.8.so by reinstalling. I have looked at the virtualbox code and it seems that the c macro PY_VERSION_HEX indicates 3.7 instead of 3.8, which would be caused by the wrong Python.h header being included.
How can I force virtualbox package to include /usr/include/python3.8/Python.h instead of /usr/include/python3.7/Python.h ?
Uninstalling python3.7 is not an option.
The pyvbox package docs (redirected from pyvbox) imply that the .so files aren't installed by it. But, they do note that the Python package is dependent on the VirtualBox SDK. Which, in turn, recommend installing the SDK to the system Python manually. That latest seems irky, especially when done outside a package manager but maybe they know better.
Digging around, I found the .so files are owned by the OS package virtualbox. In other words, virtualbox must be installed with Python3.8 support.
# Who owns/provides this file (use your dist equivalent or duckduckgo)
$ yay -Fy /usr/lib/virtualbox/VBoxPython3_8.so
...
usr/lib/virtualbox/VBoxPython3_8.so is owned by community/virtualbox 6.1.6-1
I suggest you reinstall the virtualbox package for your distribution. Installing the latest version will provide the latest .so library files Virtualbox supports.
Let's test the theory
# Install Virtualbox and the Virtualbox SDK
yay -S virtualbox virtualbox-sdk python-virtualbox
# Assert we aren't getting an error
$ python -c "import virtualbox; _vbox = virtualbox.VirtualBox(); print('Success!')"
Success!
Otherwise, if the package doesn't include 3.8 support, you'll have to compile it yourself while making sure LD_LIBRARY_PATH points to your Python 3.8 dev libraries. But, I strongly recommend against this. It is infinitely better to work along with your package manager and benefit from upstream work.
Good luck!
The command line application shoogle (https://github.com/tokland/shoogle) which exposes google api services at a terminal command line requires python3 but the ubuntu 16 default python is 2.7.
I have tried alias and calling the shoogle app from subprocess in a python3 shell but (of course) the os still provides the default. I have been reluctant to make system wide changes to .bashrc or PYTHONPATH e.g. as so many other resource expect 2.7. But I am currently using this on a virtual machine so if it does break I can recover. That seems the only option but impractical in a production environment.
I've found very little shoogle help online (the author suggests SO etc. for support) so if any one has any experience with shoogle or suggestions to get the requiured python version I'd be happy to hear.
Running shoogle from a python3 interpreter finds the 2.7 files:
3.5.2 (default, Nov 23 2017, 16:37:01)
[GCC 5.4.0 20160609]
Python Type "help", "copyright", "credits" or "license" for more information.
from subprocess import call
call (['shoogle', 'show'])
Traceback (most recent call last):
File "/usr/local/bin/shoogle", line 11, in <module>
import shoogle
File "/usr/local/lib/python2.7/dist-packages/shoogle/__init__.py", line 5,
in <module> from .shoogle import *
File "/usr/local/lib/python2.7/dist-packages/shoogle/shoogle.py", line 14, in <module>
from . import commands
File "/usr/local/lib/python2.7/dist-packages/shoogle/commands/__init__.py", line 2, in <module>
from . import execute
Using #Surest Texans suggestions I uninstalled the shoogle app and used pip3 install to reinstall. Now the application works as expected when called from the command line.
I have Python 3.5.1 for Windows (official python.org installer) installed and it seems to be missing tkinter. For example:
C:\Users\kostya>python
Python 3.5.1 (v3.5.1:37a07cee5969, Dec 6 2015, 01:38:48) [MSC v.1900 32 bit (In
tel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from tkinter import *
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named 'tkinter'
Does anyone have an idea about were I can download the package?
The installer has an option "[X] install tkinter, IDLE, turtle". It should be on by default, but you might have clicked it off. If you run the installer again, you should see an option to repair. That should get you an option to see if the box is checked. Must sure it is and 'repair'.
If using Windows, open settings and got to Apps and features:
Select Modify.
The click Modify (again) and then check the [x] Tcl/Tk box.
I am having a problem with "import "serial".
I am running Python 3.3.2 on Windows (XP) and have installed pyserial 2.5 from the Windows installer pyserial-2.5.win32.exe. The traceback below shows what happens.
C:\hal\Python>python
Python 3.3.2 (v3.3.2:d047928ae3f6, May 16 2013, 00:03:43) [MSC v.1600 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import serial
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "c:\python33\lib\site-packages\serial\__init__.py", line 19, in <module>
from serialwin32 import *
ImportError: No module named 'serialwin32'
>>>
The python interpreter finds and runs c:\python33\lib\site-packages\serial\ __init__.py, which checks the os name, finds that it is "nt" and executes "from serialwin32 import *". That fails.
The file serialwin32.py is in the \serial directory with __init__.py.
I tried this with Python 3.1.1 and 3.2.3 and got the same results.
I read that pyserial 2.5 is not dependent on pywin32 but I have it installed anyway; win32, build 18, for Python 3.3.
Has anyone seen this problem or know what I may be doing wrong?
Thanks