Search code examples
pythondockerubuntuimporterrortqdm

Running python code in docker : "ImportError: No module named tqdm"


I have seen many posts about ImportError with python but no solution has worked so far.

I have a short code test.py using tqdm package to show progress bar in terminal. This script runs well in ubuntu terminal but raises a ""ImportError: No module named tqdm"" when run inside a docker container. (the container allows me using openface algorithm running another python code that works just fine as long as tqdm is not included)

This is the Dockerfile from which docker container is build :

FROM bamos/openface

RUN pip install tqdm

RUN apt-get update

on Linux Ubuntu

Thanks for the help !

EDIT : Problem solved with the following dockerfile

FROM bamos/openface

RUN ln -s /root/openface/models/ /models

RUN apt-get update && apt install python-pip

RUN pip install -U pip && pip install tqdm

Thanks all !


Solution

  • Try to specify the python version you want to use.
    For example, python3.7 -m pip install tqdm.
    Note that, you should have python and python-pip installed in that image.