#fastapi and blinka
1 messages · Page 1 of 1 (latest)
I did indeed install board.py manually, several times in several different ways to make sure it's installed
blinka is unusual. You don't do import blinka or import adafruit_blinka. Instead it provides multiple top-level modules that are in CircuitPython, like board, digitalio, etc. It is not correct to install board. That is someone else's package, totally unrelated to blinka. It just happens to have the board name
you need to uninstall it
pip uninstall board
right, that's just another problem that would have had to be fixed as well. I am installing fastapi locally to see what is going on
Thank you. I commented board, now I get the same thing with busio
yup, completely expected, the fastapi enviornment doesn't have blinka
So, I would need to keep the 2 programs separate but have them communicate with eachother
hold on while I see what is going on with fastapi run
OK, I did the following (wait for all the input)
- create a new empty venv for testing
python3 -mvenv testing
deactivate my current venv:
deactivate
activate the new venv:
source ~/testing/bin/activate
install blinka and fastapi:
pip install adafruit-blinka
pip install "fastapi[standard]"
Test the installations:
$ python3
Python 3.12.3 (main, Mar 3 2026, 12:15:18) [GCC 13.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import board
>>> import fastapi
>>>
(then ctrl-D to exit python)
made this minimal test program
then did
fastapi run minimal.py
i did not get any import errors
Good to hear. It's currently taking it's sweet time to install Adafruit-Blinka
i am trying this on Ubuntu 24.04, not an RPi. What OS version are you running on the RPi 4?
It's running on Raspbian, the recommended install
I'll try that when it's done installing FastAPI, Blinka is now installed
i have to walk to buy groceries, so I'll be away for a while. I can try it on an RPi 4 when I return if it is not working for you
Thanks a lot, I'll keep you informed.
It works to resolve the noted issues, but now adafruit_pca9685 gives the module not found error. I really need that to control the servo's and motors powering the model and the ship-load of cranes
so what I am seeing is that the previous venv you are using is messed up in some way. The venv I had you just create has only two things installed in it: adafruit-blinka and fastapi. You can now continue to add the rest of the modules you need with pip install, like adafruit -circuitpython-pca9685, etc.
(I had to get ready to go)
Could've thought of that myself. Thanks a lot
I have to check it tomorrow, the batteries are empty
The batteries are fully charged again and the libraries are installed. If I now run the program without FastAPI it works fine but the program with FastAPI runs into the same error, now with the PCA9685
do pip install adafruit-circuitpython-pca9685 in the test venv you created yesterday
Then this happens
which venv are you in, the new test one or the old one?
This is the test, I've used this the entire time
aha, uppercase, should be lower case: from adafruit_pca9685 import PCA9685
I solved that now, still no joy