Open rrobinett opened 2 months ago
It seems you have the wrong HID python package installed. Unfortunately there are two different implementations both using the same package name hid
. This software expects python3-hid
. Maybe you have python3-hidapi
installed. In that case please try again with python3-hid
.
Thanks for your quick response.
I had tried: pip3 install hid --break-system-packages Then: sudo apt install python3-hidapi python3-hid -y
After your response I removed all three:
pip3 uninstall hid --break-system-packages sudo apt remove python3-hidapi sudo apt remove python3-hid
Then I: sudo apt install python3-hid
But I get the same error:
@.:~/lbgpsdo$ python3 ./lbgpsdo.py status
Traceback (most recent call last):
File "/home/wsprdaemon/lbgpsdo/./lbgpsdo.py", line 1469, in
On Fri, Sep 6, 2024 at 2:13 AM Mario Haustein @.***> wrote:
It seems you have the wrong HID python package installed. Unfortunately there are two different implementations both using the same package name hid. This software expects python3-hid. Maybe you have python3-hidapi installed. In that case please try again with python3-hid.
— Reply to this email directly, view it on GitHub https://github.com/hamarituc/lbgpsdo/issues/7#issuecomment-2333619993, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIFAQZAGU2SEEH5XLH4SDQ3ZVFW4DAVCNFSM6AAAAABNYEXRECVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMZTGYYTSOJZGM . You are receiving this because you authored the thread.Message ID: @.***>
-- Rob Robinett AI6VN @.*** mobile: +1 650 218 8896
I would not recommend to install python packages globally with pip
, but use the Linux distribution package manager in this case. Alternatively you may create a virtual python environment and install python packages with pip
to this environment.
We first need to figure out which python package is loaded. Please open a interactive python shell an execute the following code.
import hid
print(hid.__file__)
This file should belong to the python3-hidapi
package. You may confirm this with dpkg -L python3-hidapi
. The file should contain lines like:
hidapi = None
library_paths = (
'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'
)
If not, the wrong hid
package is loaded.
Hi,
This is what I get:
@.***:~$ python3 Python 3.12.3 (main, Jul 31 2024, 17:43:48) [GCC 13.2.0] on linux Type "help", "copyright", "credits" or "license" for more information.
import hid
print(hid.file) /usr/lib/python3/dist-packages/hid.cpython-312-x86_64-linux-gnu.so
On Mon, Sep 9, 2024 at 3:08 PM Mario Haustein @.***> wrote:
I would not recommend to install python packages globally with pip, but use the Linux distribution package manager in this case. Alternatively you may create a virtual python environment and install python packages with pip to this environment.
We first need to figure out which python package is loaded. Please open a interactive python shell an execute the following code.
import hid print(hid.file)
This file should belong to the python3-hidapi package. You may confirm this with dpkg -L python3-hidapi. The file should contain lines like:
hidapi = None library_paths = ( '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' )
If not, the wrong hid package is loaded.
— Reply to this email directly, view it on GitHub https://github.com/hamarituc/lbgpsdo/issues/7#issuecomment-2339239960, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIFAQZF26I2UGN2LZQVCEMLZVYL7DAVCNFSM6AAAAABNYEXRECVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMZZGIZTSOJWGA . You are receiving this because you authored the thread.Message ID: @.***>
-- Rob Robinett AI6VN @.*** mobile: +1 650 218 8896
And this:
@.:~$ dpkg -L python3-hidapi dpkg-query: package 'python3-hidapi' is not installed Use dpkg --contents (= dpkg-deb --contents) to list archive files contents. @.:~$ dpkg -L python3-hidapi
So I tried to apt install hidapi, but still got the same error:
@.***:~/lbgpsdo$ sudo apt install python3-hidapi Reading package lists... Done Building dependency tree... Done Reading state information... Done The following NEW packages will be installed: python3-hidapi 0 upgraded, 1 newly installed, 0 to remove and 142 not upgraded. Need to get 6,480 B of archives. After this operation, 32.8 kB of additional disk space will be used. Get:1 http://us.archive.ubuntu.com/ubuntu noble/universe amd64 python3-hidapi amd64 0.2.2-1.1build2 [6,480 B] Fetched 6,480 B in 1s (9,688 B/s) Selecting previously unselected package python3-hidapi. (Reading database ... 154049 files and directories currently installed.) Preparing to unpack .../python3-hidapi_0.2.2-1.1build2_amd64.deb ... Unpacking python3-hidapi (0.2.2-1.1build2) ... Setting up python3-hidapi (0.2.2-1.1build2) ... Scanning processes... Scanning processor microcode... Scanning linux images...
Running kernel seems to be up-to-date.
The processor microcode seems to be up-to-date.
No services need to be restarted.
No containers need to be restarted.
No user sessions are running outdated binaries.
No VM guests are running outdated hypervisor (qemu) binaries on this host.
@.:~/lbgpsdo$ python3 ./lbgpsdo.py status
Traceback (most recent call last):
File "/home/wsprdaemon/lbgpsdo/./lbgpsdo.py", line 1469, in
On Mon, Sep 9, 2024 at 3:14 PM Rob Robinett @.***> wrote:
Hi,
This is what I get:
@.***:~$ python3 Python 3.12.3 (main, Jul 31 2024, 17:43:48) [GCC 13.2.0] on linux Type "help", "copyright", "credits" or "license" for more information.
import hid
print(hid.file) /usr/lib/python3/dist-packages/hid.cpython-312-x86_64-linux-gnu.so
On Mon, Sep 9, 2024 at 3:08 PM Mario Haustein @.***> wrote:
I would not recommend to install python packages globally with pip, but use the Linux distribution package manager in this case. Alternatively you may create a virtual python environment and install python packages with pip to this environment.
We first need to figure out which python package is loaded. Please open a interactive python shell an execute the following code.
import hid print(hid.file)
This file should belong to the python3-hidapi package. You may confirm this with dpkg -L python3-hidapi. The file should contain lines like:
hidapi = None library_paths = ( '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' )
If not, the wrong hid package is loaded.
— Reply to this email directly, view it on GitHub https://github.com/hamarituc/lbgpsdo/issues/7#issuecomment-2339239960, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIFAQZF26I2UGN2LZQVCEMLZVYL7DAVCNFSM6AAAAABNYEXRECVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMZZGIZTSOJWGA . You are receiving this because you authored the thread.Message ID: @.***>
-- Rob Robinett AI6VN @.*** mobile: +1 650 218 8896
-- Rob Robinett AI6VN @.*** mobile: +1 650 218 8896
I 'apt removed' both hid and hidapi, verified there was no hid module, then 'apt installed' hid:
@.:~/lbgpsdo$ python3 ./lbgpsdo.py status
Traceback (most recent call last):
File "/home/wsprdaemon/lbgpsdo/./lbgpsdo.py", line 1469, in
On Mon, Sep 9, 2024 at 3:19 PM Rob Robinett @.***> wrote:
And this:
@.:~$ dpkg -L python3-hidapi dpkg-query: package 'python3-hidapi' is not installed Use dpkg --contents (= dpkg-deb --contents) to list archive files contents. @.:~$ dpkg -L python3-hidapi
So I tried to apt install hidapi, but still got the same error:
@.***:~/lbgpsdo$ sudo apt install python3-hidapi Reading package lists... Done Building dependency tree... Done Reading state information... Done The following NEW packages will be installed: python3-hidapi 0 upgraded, 1 newly installed, 0 to remove and 142 not upgraded. Need to get 6,480 B of archives. After this operation, 32.8 kB of additional disk space will be used. Get:1 http://us.archive.ubuntu.com/ubuntu noble/universe amd64 python3-hidapi amd64 0.2.2-1.1build2 [6,480 B] Fetched 6,480 B in 1s (9,688 B/s) Selecting previously unselected package python3-hidapi. (Reading database ... 154049 files and directories currently installed.) Preparing to unpack .../python3-hidapi_0.2.2-1.1build2_amd64.deb ... Unpacking python3-hidapi (0.2.2-1.1build2) ... Setting up python3-hidapi (0.2.2-1.1build2) ... Scanning processes... Scanning processor microcode... Scanning linux images...
Running kernel seems to be up-to-date.
The processor microcode seems to be up-to-date.
No services need to be restarted.
No containers need to be restarted.
No user sessions are running outdated binaries.
No VM guests are running outdated hypervisor (qemu) binaries on this host. @.:~/lbgpsdo$ python3 ./lbgpsdo.py status Traceback (most recent call last): File "/home/wsprdaemon/lbgpsdo/./lbgpsdo.py", line 1469, in
args.func(args) File "/home/wsprdaemon/lbgpsdo/./lbgpsdo.py", line 1019, in command_status for d in GPSDODevice.openall(serial = args.serial, device = args.device): File "/home/wsprdaemon/lbgpsdo/./lbgpsdo.py", line 736, in openall yield cls(dinfo) ^^^^^^^^^^ File "/home/wsprdaemon/lbgpsdo/./lbgpsdo.py", line 766, in init self.device = hid.Device(path = dinfo['path']) ^^^^^^^^^^ AttributeError: module 'hid' has no attribute 'Device'. Did you mean: 'device'? @.:~/lbgpsdo$On Mon, Sep 9, 2024 at 3:14 PM Rob Robinett @.***> wrote:
Hi,
This is what I get:
@.***:~$ python3 Python 3.12.3 (main, Jul 31 2024, 17:43:48) [GCC 13.2.0] on linux Type "help", "copyright", "credits" or "license" for more information.
import hid
print(hid.file) /usr/lib/python3/dist-packages/hid.cpython-312-x86_64-linux-gnu.so
On Mon, Sep 9, 2024 at 3:08 PM Mario Haustein @.***> wrote:
I would not recommend to install python packages globally with pip, but use the Linux distribution package manager in this case. Alternatively you may create a virtual python environment and install python packages with pip to this environment.
We first need to figure out which python package is loaded. Please open a interactive python shell an execute the following code.
import hid print(hid.file)
This file should belong to the python3-hidapi package. You may confirm this with dpkg -L python3-hidapi. The file should contain lines like:
hidapi = None library_paths = ( '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' )
If not, the wrong hid package is loaded.
— Reply to this email directly, view it on GitHub https://github.com/hamarituc/lbgpsdo/issues/7#issuecomment-2339239960, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIFAQZF26I2UGN2LZQVCEMLZVYL7DAVCNFSM6AAAAABNYEXRECVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMZZGIZTSOJWGA . You are receiving this because you authored the thread.Message ID: @.***>
-- Rob Robinett AI6VN @.*** mobile: +1 650 218 8896
-- Rob Robinett AI6VN @.*** mobile: +1 650 218 8896
-- Rob Robinett AI6VN @.*** mobile: +1 650 218 8896
I use virtualenv to create an isolated python+pip-modules environment for the tool:
> ~/src/radio/gpsdo
> $ ll
total 24
drwxrwxr-x 4 ??? ??? 4096 Jul 24 09:29 ./
drwxrwxr-x 5 ??? ??? 4096 Sep 3 10:27 ../
drwxrwxr-x 4 ??? ??? 4096 Jul 24 09:27 .env/
-rw-rw-r-- 1 ??? ??? 40 Jul 1 2023 .gitignore
drwxrwxr-x 4 ??? ??? 4096 Jul 1 2023 lbgpsdo/
-rwxr-xr-x 1 ??? ??? 78 Jul 24 09:28 lb_watch*
(.env) > ~/src/radio/gpsdo
> $ source .env/bin/activate
(.env) > ~/src/radio/gpsdo
> $ pip list
Package Version
------- -------
hid 1.0.6
pip 24.0
(.env) > ~/src/radio/gpsdo
> $ pip freeze
hid==1.0.6
you can pin the hid
module to a specific version.
works fine on Ubuntu 24.04.1:
(.env) > ~/src/radio/gpsdo
> $ lbgpsdo/lbgpsdo.py status
9FBF7EA7E6 /dev/hidraw0: SAT locked PLL locked Loss: 1
I have a watcher script to monitor the status:
> $ cat lb_watch
#!/bin/bash
source .env/bin/activate
watch -d -n2 lbgpsdo/lbgpsdo.py status
Thanks for your help, but I have 20+ sites around the world running Ubuntu 24.04 and setting up special python environments on each of them seems too complex.
On Tue, Sep 10, 2024 at 2:37 AM Graham Lee Bevan @.***> wrote:
I use virtualenv https://virtualenv.pypa.io/en/latest/ to create an isolated python+pip-modules environment for the tool:
~/src/radio/gpsdo $ ll total 24 drwxrwxr-x 4 bev bev 4096 Jul 24 09:29 ./ drwxrwxr-x 5 bev bev 4096 Sep 3 10:27 ../ drwxrwxr-x 4 bev bev 4096 Jul 24 09:27 .env/ -rw-rw-r-- 1 bev bev 40 Jul 1 2023 .gitignore drwxrwxr-x 4 bev bev 4096 Jul 1 2023 lbgpsdo/ -rwxr-xr-x 1 bev bev 78 Jul 24 09:28 lb_watch* (.env) > ~/src/radio/gpsdo $ source .env/bin/activate (.env) > ~/src/radio/gpsdo $ pip list Package Version
hid 1.0.6 pip 24.0 (.env) > ~/src/radio/gpsdo $ pip freeze hid==1.0.6
you can pin the hid module to a specific version.
works fine on Ubuntu 24.04.1:
(.env) > ~/src/radio/gpsdo
$ lbgpsdo/lbgpsdo.py status 9FBF7EA7E6 /dev/hidraw0: SAT locked PLL locked Loss: 1
I have a watcher script to monitor the status:
$ cat lb_watch
!/bin/bash
source .env/bin/activate
watch -d -n2 lbgpsdo/lbgpsdo.py status
— Reply to this email directly, view it on GitHub https://github.com/hamarituc/lbgpsdo/issues/7#issuecomment-2340163634, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIFAQZHJOGXJBLNPIJ5RPCLZV24UTAVCNFSM6AAAAABNYEXRECVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNBQGE3DGNRTGQ . You are receiving this because you authored the thread.Message ID: @.***>
-- Rob Robinett AI6VN @.*** mobile: +1 650 218 8896
I 'apt removed' both hid and hidapi, verified there was no hid module, then 'apt installed' hid: @.:~/lbgpsdo$ python3 ./lbgpsdo.py status Traceback (most recent call last): File "/home/wsprdaemon/lbgpsdo/./lbgpsdo.py", line 1469, in
args.func(args) File "/home/wsprdaemon/lbgpsdo/./lbgpsdo.py", line 1019, in command_status for d in GPSDODevice.openall(serial = args.serial, device = args.device): File "/home/wsprdaemon/lbgpsdo/./lbgpsdo.py", line 736, in openall yield cls(dinfo) ^^^^^^^^^^ File "/home/wsprdaemon/lbgpsdo/./lbgpsdo.py", line 766, in init self.device = hid.Device(path = dinfo['path']) ^^^^^^^^^^ AttributeError: module 'hid' has no attribute 'Device'. Did you mean: 'device'? @.:~/lbgpsdo$ … On Mon, Sep 9, 2024 at 3:19 PM Rob Robinett @.> wrote: And this: @.:~$ dpkg -L python3-hidapi dpkg-query: package 'python3-hidapi' is not installed Use dpkg --contents (= dpkg-deb --contents) to list archive files contents. @.:~$ dpkg -L python3-hidapi So I tried to apt install hidapi, but still got the same error: @.:~/lbgpsdo$ sudo apt install python3-hidapi Reading package lists... Done Building dependency tree... Done Reading state information... Done The following NEW packages will be installed: python3-hidapi 0 upgraded, 1 newly installed, 0 to remove and 142 not upgraded. Need to get 6,480 B of archives. After this operation, 32.8 kB of additional disk space will be used. Get:1 http://us.archive.ubuntu.com/ubuntu noble/universe amd64 python3-hidapi amd64 0.2.2-1.1build2 [6,480 B] Fetched 6,480 B in 1s (9,688 B/s) Selecting previously unselected package python3-hidapi. (Reading database ... 154049 files and directories currently installed.) Preparing to unpack .../python3-hidapi_0.2.2-1.1build2_amd64.deb ... Unpacking python3-hidapi (0.2.2-1.1build2) ... Setting up python3-hidapi (0.2.2-1.1build2) ... Scanning processes... Scanning processor microcode... Scanning linux images... Running kernel seems to be up-to-date. The processor microcode seems to be up-to-date. No services need to be restarted. No containers need to be restarted. No user sessions are running outdated binaries. No VM guests are running outdated hypervisor (qemu) binaries on this host. @.:~/lbgpsdo$ python3 ./lbgpsdo.py status Traceback (most recent call last): File "/home/wsprdaemon/lbgpsdo/./lbgpsdo.py", line 1469, inargs.func(args) File "/home/wsprdaemon/lbgpsdo/./lbgpsdo.py", line 1019, in command_status for d in GPSDODevice.openall(serial = args.serial, device = args.device): File "/home/wsprdaemon/lbgpsdo/./lbgpsdo.py", line 736, in openall yield cls(dinfo) ^^^^^^^^^^ File "/home/wsprdaemon/lbgpsdo/./lbgpsdo.py", line 766, in init self.device = hid.Device(path = dinfo['path']) ^^^^^^^^^^ AttributeError: module 'hid' has no attribute 'Device'. Did you mean: 'device'? @.:~/lbgpsdo$ On Mon, Sep 9, 2024 at 3:14 PM Rob Robinett @.> wrote: > Hi, > > This is what I get: > > @.:~$ python3 > Python 3.12.3 (main, Jul 31 2024, 17:43:48) [GCC 13.2.0] on linux > Type "help", "copyright", "credits" or "license" for more information. > >>> import hid > >>> > >>> print(hid.file) > /usr/lib/python3/dist-packages/hid.cpython-312-x86_64-linux-gnu.so > >>> > > On Mon, Sep 9, 2024 at 3:08 PM Mario Haustein @.> > wrote: > >> I would not recommend to install python packages globally with pip, but >> use the Linux distribution package manager in this case. Alternatively you >> may create a virtual python environment and install python packages with >> pip to this environment. >> >> We first need to figure out which python package is loaded. Please open >> a interactive python shell an execute the following code. >> >> import hid >> print(hid.file) >> >> This file should belong to the python3-hidapi package. You may confirm >> this with dpkg -L python3-hidapi. The file should contain lines like: >> >> hidapi = None >> library_paths = ( >> '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' >> ) >> >> If not, the wrong hid package is loaded. >> >> — >> Reply to this email directly, view it on GitHub >> <#7 (comment)>, >> or unsubscribe >> https://github.com/notifications/unsubscribe-auth/AIFAQZF26I2UGN2LZQVCEMLZVYL7DAVCNFSM6AAAAABNYEXRECVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMZZGIZTSOJWGA >> . >> You are receiving this because you authored the thread.Message ID: >> @.> >> > > > -- > Rob Robinett > AI6VN > @. > mobile: +1 650 218 8896 > -- Rob Robinett AI6VN @. mobile: +1 650 218 8896 -- Rob Robinett AI6VN @.*** mobile: +1 650 218 8896
If you uninstalled both packages in your distro, but are still getting this error message, it seems python loads a package you installed manually via pip
which overrules your distribution packages. At first you have to remove the python packages globally installed via pip
. There is a guideline at https://stackoverflow.com/questions/11248073/how-do-i-remove-all-packages-installed-by-pip, but I didn't try it and cannot provide any warranty for data loss or system damage. Afterwards install python3-hidapi
via your distro.
Using pip
is only advised inside a local python environment. Installing python packages through pip
bypassing your distributions package management will mess up your system sooner or later.
root@KPH-Beelink-2:/home/wsprdaemon/lbgpsdo# python3 lbgpsdo.py list 1dd2:2210 1-3:1.0 G41043 GPS Reference Clock
root@KPH-Beelink-2:/home/wsprdaemon/lbgpsdo# python3 lbgpsdo.py status Traceback (most recent call last): File "/home/wsprdaemon/lbgpsdo/lbgpsdo.py", line 1469, in
args.func(args)
File "/home/wsprdaemon/lbgpsdo/lbgpsdo.py", line 1019, in command_status
for d in GPSDODevice.openall(serial = args.serial, device = args.device):
File "/home/wsprdaemon/lbgpsdo/lbgpsdo.py", line 736, in openall
yield cls(dinfo)
^^^^^^^^^^
File "/home/wsprdaemon/lbgpsdo/lbgpsdo.py", line 766, in init
self.device = hid.Device(path = dinfo['path'])
^^^^^^^^^^
AttributeError: module 'hid' has no attribute 'Device'. Did you mean: 'device'?
root@KPH-Beelink-2:/home/wsprdaemon/lbgpsdo#