Error when trying to import explorerhat

I’ve found a few threads talking about this same issue over the years, but unfortunately none of them seem to have found a solution. When I try to import the explorerhat library I get the following error:

  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3/dist-packages/explorerhat/__init__.py", line 756, in <module>
    touch._add(one=CapTouchInput(4, 1))
  File "/usr/lib/python3/dist-packages/explorerhat/__init__.py", line 595, in __init__
    _cap1208.on(channel=self.channel, event=event, handler=self._handle_state)
  File "/usr/lib/python3/dist-packages/cap1xxx.py", line 386, in on
    self.start_watching()
  File "/usr/lib/python3/dist-packages/cap1xxx.py", line 400, in start_watching
    self.async_poll.start()
  File "/usr/lib/python3/dist-packages/cap1xxx.py", line 208, in start
    if self.isAlive() == False:
AttributeError: 'AsyncWorker' object has no attribute 'isAlive'

So far I’ve done / tried the following:

  • sudo apt-get update
  • Turned on i2C in the configuration settings
  • sudo apt-get install python-smbus python3-smbus python-dev python3-dev i2c-tools
  • curl https://get.pimoroni.com/explorerhat | bash

I2C appears to be working fine, because if I run the following:
sudo i2cdetect -y 1
I get these results:

00:                         -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- 28 -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- 48 -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 

The contents of the I2C folder also seem to be what I’m guessing they should be, as this:
ls /dev/i2c*
Gives me this:
/dev/i2c-1 /dev/i2c-20 /dev/i2c-21

This is my first attempts at working with Pi’s, or really electronics in general, so I’m not sure where to go from here. I’m running the latest version of the default Pi OS (I think it’s bullseye?) on a brand new Pi4, and I’m about to do a fresh OS install just to rule that out.

Update:
I’ve just got the same error on a completely fresh, fully updated copy of the same OS.
When I run the curl script it says everything is installed and enabled, so I’m pretty lost at this point.

I’d give Buster (Legacy option in Pi Imager) a try.

1 Like

That’s got it working, thanks!

Out of interest what made you think Buster would work when Bullseye didn’t?

Gut feeling for the most part. A new OS release will often break things that worked with the previous release. And break installers that count on certain things being there etc.
It may just be that Pimoroni haven’t updated the installer for the changes made in Bullseye.
Other things can factor in also, as Bullseye only has Python 3. So far I’m only using Bullseye on two Pi’s. My Pi 400, and one of my Pi 4B’s. Pretty well my only two Pi’s that access the Internet regularly.

Makes sense, I didn’t realise Bullseye was recent enough that this might be an issue - definitely something I’ll keep in mind going forward.

Thanks again!

I’m thinking Pimoroni might be still playing catch up, going through all their installers looking for glitches caused by Bullseye. Small staff large inventory of products.