Installation failure: 'module' object has no attribute 'USBContext'

79 views
Skip to first unread message

John Payne

unread,
Nov 9, 2020, 6:09:21 AM11/9/20
to pywws
I am setting up pywws on a new Raspberry Pi 4 (Buster). I used to run it on a Pi 2 or 3 but had to decomission it for various reasons last year. I've followed the install/dependency steps using pip install,  and downloading from git (after uninistalling) but when I try 'pywws testweatherstation' I get a failure - I'm sure it's something simple as I had it working for several years:

12:01:48:pywws.logger:pywws version 20.10.0, build 1680 (93d7edf)
Traceback (most recent call last):
  File "/usr/local/bin/pywws-testweatherstation", line 11, in <module>
    load_entry_point('pywws==20.10.0', 'console_scripts', 'pywws-testweatherstation')()
  File "/usr/local/lib/python2.7/dist-packages/pywws-20.10.0-py2.7.egg/pywws/testweatherstation.py", line 117, in main
    ws = pywws.weatherstation.WeatherStation()
  File "/usr/local/lib/python2.7/dist-packages/pywws-20.10.0-py2.7.egg/pywws/weatherstation.py", line 464, in __init__
    self.cusb = CUSBDrive()
  File "/usr/local/lib/python2.7/dist-packages/pywws-20.10.0-py2.7.egg/pywws/weatherstation.py", line 318, in __init__
    self.dev = USBDevice(0x1941, 0x8021)
  File "/usr/local/lib/python2.7/dist-packages/pywws-20.10.0-py2.7.egg/pywws/device_libusb1.py", line 76, in __init__
    self.context = usb1.USBContext()
AttributeError: 'module' object has no attribute 'USBContext'

Any ideas?

Jim Easterbrook

unread,
Nov 9, 2020, 6:46:09 AM11/9/20
to py...@googlegroups.com
On 09/11/2020 11:09, John Payne wrote:
> I am setting up pywws on a new Raspberry Pi 4 (Buster). I used to run it
> on a Pi 2 or 3 but had to decomission it for various reasons last year.
> I've followed the install/dependency steps using pip install,  and
> downloading from git (after uninistalling) but when I try 'pywws
> testweatherstation' I get a failure - I'm sure it's something simple as
> I had it working for several years:

> "/usr/local/lib/python2.7/dist-packages/pywws-20.10.0-py2.7.egg/pywws/device_libusb1.py",
> line 76, in __init__
>     self.context = usb1.USBContext()
> AttributeError: 'module' object has no attribute 'USBContext'
>
> Any ideas?

Most likely an incompatible version of python-libusb1. What version is
installed on your Pi?
--
Jim Easterbrook <http://www.jim-easterbrook.me.uk/>

John Payne

unread,
Nov 9, 2020, 7:07:31 AM11/9/20
to pywws
It seems it wasn't installed anyway.... I just installed 'Setting up python-libusb1 (1.7-1)' but still get the same error

Jim Easterbrook

unread,
Nov 9, 2020, 7:40:36 AM11/9/20
to py...@googlegroups.com
On 09/11/2020 12:07, John Payne wrote:
> It seems it wasn't installed anyway.... I just installed 'Setting up
> python-libusb1 (1.7-1)' but still get the same error
Are you using the same version of Python for pywws as you installed
libusb1 for? You really shouldn't be using Python 2 these days.

John Payne

unread,
Nov 9, 2020, 8:01:47 AM11/9/20
to pywws
Ah,that's probably it. I have Python 2 & 3 and just copy/pasted the install commands so got 2 I guess. I'll try again.
Thanks

John Payne

unread,
Nov 9, 2020, 9:04:15 AM11/9/20
to pywws
All working now, quickly solved, thanks
Reply all
Reply to author
Forward
0 new messages