No module named _markerlib

raspberrypi3

#1

Hi,
My dockerfile previously worked fine. I haven’t recompiled for a few months. Now it is failing to pip install packages.
I get the following error:
File “/usr/lib/python2.7/dist-packages/pkg_resources.py”, line 2614, in _compute_dependencies
from _markerlib import compile as compile_marker
ImportError: No module named _markerlib

Here is my docker file

FROM resin/%%RESIN_MACHINE_NAME%%-python:latest

ENV INITSYSTEM on

RUN apt-get update && apt-get --assume-yes install python3-gpiozero python-gpiozero sshfs python-dev libzmq3-dev rsync sshpass unzip nmap iptables dhcpd

RUN apt-get --assume-yes install libssl-dev libffi6 libffi-dev

RUN apt-get --assume-yes install pure-ftpd

RUN apt-get update && apt-get install -yq --no-install-recommends \
    openssh-server && \
    apt-get clean && rm -rf /var/lib/apt/lists/*

RUN mkdir /var/run/sshd \
    && echo 'root:resin' | chpasswd \
    && sed -i 's/PermitRootLogin without-password/PermitRootLogin yes/' /etc/ssh/sshd_config \
    && sed -i 's/UsePAM yes/UsePAM no/' /etc/ssh/sshd_config

WORKDIR /usr/src/app

COPY ./requirements.txt /requirements.txt

RUN pip install -r /requirements.txt

COPY . ./

WORKDIR /usr/src/app/src

CMD ["./start.sh"]

The contents of the requirements.txt file are:

jsonschema
zeroconf
enum34
enum
aenum
netifaces
cpppo
psutil
paramiko
pypubsub
pyzmq

Any ideas?

Thanks,
Andrew


#12

Hi Andrew,

I was able to replicate the issue that you are facing by using a similar Dockerfile.template.
It seems that the setup issue is caused by the python-gpiozero package.
After removing it from the first apt-get install list the build was able to complete without errors.

Would it be possible to use the respective pip package (gpiozero as noted in the docs) and install it by adding it to your requirements.txt file?


#15

hi @zuma, as much as I understand, the -python base images use the Python version that we provide, while installing python-xyz packages with apt-get uses the system’s default Python. Mixing the two will end up in a strange place where dependencies are provided for the multiple pythons available on the device.

So probably either 1) use “-python” base image, and install Python packages e.g. using pip and none with apt-get;

Or 2) use the system Python by using the -debian base image, installing python and any other packages you need with apt-get, upgrade pip to the latest, and install any other packages with pip like that.

Both have their pros and cons (size, available versions, complexity of the resulting Dockerfile, etc…). And would probably need more detailed docs.

In your case would remove the python3-gpiozero, python-gpiozero, and python-dev packages from apt-get, and add gpiozero to requirements.txt.

Let us know if it helps!