Attempting to install CircuitPython To Raspberry Pi 4: Seeking Dockerfile Help

Hello gurus,
I’ve had success getting Node.js working on various projects. Today, I hope to get CircuitPython installed and running for a GPIO project where most of the support/examples are centered around CircuitPython.

After looking at different examples, I’m getting stuck on the build. Any ideas of what I’m missing?:

Device: Raspberry Pi 4
Desired Python version: 3
Pip/pip3 could benefit from an upgrade

Here’s the current work-in-progress:

# Initial reference: https://github.com/balena-io-examples/balena-python-hello-world
FROM balenalib/%%BALENA_MACHINE_NAME%%-python:3-stretch-run

# Set our working directory
WORKDIR /usr/src/app

# Read: https://gallaugher.com/makersnack-installing-circuitpython-on-a-raspberry-pi/
# RUN install_packages python-smbus i2c-tools python3-pip
# TODO: Hmm. With this disabled, now I'm getting too many request errors. Will try again later?
# "toomanyrequests: You have reached your pull rate limit. You may increase the limit by authenticating and upgrading: https://www.docker.com/increase-rate-limit"
# Also, python3-pip may not be required here?

# upgrade pip
# TODO: This fails for now, attempting to run without (may not be required)
# RUN python -m pip install --upgrade pip

# Copy requirements.txt first for better cache on later pushes
COPY requirements.txt requirements.txt

# pip install python deps from requirements.txt on the resin.io build server
RUN pip install -r requirements.txt

# This will copy all files in our root to the working  directory in the container
COPY . ./

# Enable udevd so that plugged dynamic hardware devices show up in our container.
ENV UDEV=1

# main.py will run when container starts up on the device
CMD ["python","-u","src/main.py"]

requirements.txt if needed:

RPI.GPIO
adafruit-blinka

From this I’ve been experiencing two errors. My latest has been a toomanyrequests error. Maybe I’m building too often as I figure this out?

Previously (commented out) I was failing in upgrading pip. Maybe there’s a different command for that in build?

Thanks for taking a look in advance! My familiarity with Python in general is limited, yet I look forward to giving it a shot on a Pi for GPIO purposes.

Hello Christopher

what is the error message that you are getting? how are you getting stuck?

Hello Juan,

Currently as-is above:

“toomanyrequests: You have reached your pull rate limit. You may increase the limit by authenticating and upgrading: Understanding Your Docker Hub Rate Limit | Docker

This kills the build.

Hi there,

Ok then, this is not a problem in your Dockerfile, but it is due to docker hub rate limiting: https://docs.docker.com/docker-hub/download-rate-limit/
It seems like the Balena Docker Hub account has reached some limit (it shouldn’t have). We’re looking into this. As a workaround, if you have a Docker Hub account, you should be able to use your own credentials: https://www.balena.io/docs/learn/deploy/deployment/#private-base-images
If not stay tuned, we are working on it

you can follow the satus of this incident here:

regards,

Juan

1 Like

Thank you! I’ll follow up once this resolved with solution or further questions if that’s cool. Have a great day!

Hey Christopher,
you can try again now, it should be fixed. And if you have more questions about the build, come back to us!
have fun!
Juan

1 Like

Thank you Juan! I’m all set.