Hello. I’m running a python app on a Pi3. When I push the code using local mode, it runs, connects to an MQTT Broker, and publishes messages as I expect. But, when I disable local mode, and push it to the application with “git push resin master”, I get an error about “paho.mqtt.client” isn’t found.
Based on https://stackoverflow.com/questions/41480256/import-error-paho-mqtt-client-not-found, I’m guessing this is a python version problem. SSHing into the device, I see python 2.7, 3.4, and I think a 3rd version, on the device. How do I clean this up?
Here’s my dockerfile. Notice that I use a debian image for the base, not a python image, because I want to be able to apt-get the “sense-hat” package. Maybe there’s a better way to handle this.
I’d appreciate any insight. Thanks.
# base-image for python
# We use a debian image, so we can add sense-hat libraries
# See resin-io-playground/sense-tunnel git repository for an example.
# see more about dockerfile templates here:http://docs.resin.io/pages/deployment/docker-templates
FROM resin/raspberry-pi3-debian:jessie
# use apt-get if you need to install dependencies,
# for instance if you need ALSA sound utils, just uncomment the lines below.
RUN apt-get update && apt-get install -yq \
python python-pip sense-hat raspberrypi-bootloader && \
apt-get clean && rm -rf /var/lib/apt/lists/*
# Install python modules
RUN pip install python-dateutil
RUN pip install paho-mqtt python-etcd
RUN pip install pyserial
# Set our working directory
WORKDIR /usr/src/app
# This will copy all files in our root to the working directory in the container
COPY . .
# switch on systemd init system in container
ENV INITSYSTEM on
# main.py will run when container starts up on the device
CMD ./startDemo