Hi, on several of the beginner examples, I’m seeing a pip error that causes the build to fail: ImportError: cannot import name _remove_dead_weakref
…research online suggests this is because there’s a mismatch between versions of pip, but putting RUN pip install --upgrade pip
results in the same error.
I’m a beginner, so my apologies if there’s something obvious I’m not understanding. Any help or pointers you could provide would be appreciated!
Hey there, can you post which base image you are using? From what I can find this error suggests a conflict in Python installations – are you manually installing Python in your Dockerfile?
Right now I’m trying to implement this on a RasPi Zero W. The base image was resin/%%RESIN_MACHINE_NAME%%-python:2.7 and I also tried removing the version in hopes of getting the latest, ie resin/%%RESIN_MACHINE_NAME%%-python
Earlier in the week, I tried the example here and the example here. In both of those cases, I was trying to add stuff (python’s omxplayer wrapper, Adafruit GPIO, and some others) via the requirements.txt file, but encountered this same error at some point in both cases.
I yak-shaved so much on both of the prior repos that I eventually lost track. So for the wifi-connect-example repo, I’m asking for help before doing a lot of flailing
To answer your question, I’m not installing python in the dockerfile…in fact, just as a sanity check, I reverted back to the unaltered dockerfile in that repo and still encountered the error in the first post. I’m very puzzled as to what I’m doing wrong!
Thanks again for any help / hints you can provide - happy to put a gist or pastebin up if that would help!
Ah, looking more at why the unaltered repo does not work, I see this issue indicating incompatibility with the latest version of wifi-connect.
I’d be happy to take a stab at updating it, but I’ll have to read both codebases more carefully to take stock of what has changed…hints appreciated!
I will work on investigating and fixing this tomorrow. I will post more information here once I have more information on what is causing this. It is definitely not WiFi Connect related, but some issue with the Python configuration in the base image. Should not be hard to track down and fix though.
Thank you!! As I said, I’m a beginner, so I hope I’m not wasting everyone’s time here. If there’s specific debugging or other stuff I can try alongside you, please just let me know, happy to (try to) help…
I tracked this down to the part in the Dockerfile where python-dev is installed. The container base image uses a custom python installation and this one interferes with the provided by debian. Not using the debian python packages is intentional, but I do not know the exact details, so I need to check with the base image maintainers for how to fix the wifi-connect example specifically.
Also please do not worry about those types of troubleshooting questions. We are happy to help! And the problem is quite a valid one anyway, that has to be resolved.
We will post more information here as soon as we have an update.
Comment from our base image maintainer: the way around this is to use a -debian base image and install python with apt-get, rather than using the -python base image.
Thanks for this!
Do you happen to know all the apt-get packages I will have to install in order to have my debian image be just like the python base image?
Pip is a default standard package-manager used to install and manage software packages written in Python. Many packages can be found in the default source for packages and their dependencies, which is called the Python Package Index.
Python pip works with CPython versions 2.7, 3.5, 3.6, 3.7, 3.8, and also PyPy.
To install the latest version of Python 3 with Homebrew, type the following command.