I’ve been trying to use Sparkfun Qwiic devices on a RaspPi 400 with the SparkFun Qwiic pHAT Extension plugged in. Followed the online instructions, “pip install sparkfun-qwiic”, which pretends to install, but when within Python 3 I type “import sparkfun_qwiic” it complains about two drivers missing. If I type “import qwiic_alphanumeric” (I have an Alphanumeric display plugged in), the import works. Typing “qwiic_alphanumeric.qwiic_i2c.is_device_connected(0x70)” responds “True”. But there is no information on an API for that device, so I cannot do anything with it. I can’t even find how to use the API’s “get_devices()” function. How are we supposed to use Qwiic with Python at all?
What OS version are you on? If bookworm, see this post Issues with SparkFun Python packages via Bookworm distribution? Check here!
Raspberry Pi400 running bullseye
Tried that bookworm workaround even though I’m still on bullseye. Once in my virtual environment, I entered python, then typed “import sparkfun_qwiic”. Got same two error messages about missing drivers.
After closing python, tried to uninstall sparkfun-qwiic, which failed saying it wasn’t installed.
I only have a small selection of Qwiic devices I need to support in Python, so loading ALL of them by installing sparkfun-qwiic is overkill. We need instructions on how to install ONLY the ones we want, such as the Alphanumeric Display, the 1.3" OLED display, and such. I suspect the missing drivers are for devices I don’t even have. These are the errors I’m seeing.
$ python
Python 3.9.2 (default, Mar 12 2021, 04:06:34)
[GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import qwiic
Invalid driver class name. Unable to locate QwiicAs6212
Invalid driver class name. Unable to locate QwiicKx13X
>>>
You should be able to ignore those errors - will only pop up when importing the module. They likely are not available in your Python version.
Use qwiic.get_devices() to use the method.