Skip to content
Advertisement

Docker compose missing python package

To preface I’m fairly new to Docker, Airflow & Stackoverflow.

I’ve got an instance of Airflow running in Docker on an Ubuntu (20.04.3) VM.

I’m trying to get Openpyxl installed on build in order to use it as the engine for pd.read_excel.

Here’s the Dockerfile with the install command:

JavaScript

The requirements.txt file looks like this:

JavaScript

And the docker-compose.yaml file looks like this:

JavaScript

After I’ve run docker build and docker up and shell into the running worker container, running pip list shows that all of the packages in the requirements file have been installed successfully except for Openpyxl. The requirements.txt file that is copied to the container on build even includes Openpyxl in it. I’m able to manually pip install openpyxl at this point by executing pip install openpyxl in the shell.

  • I’ve tried adding a manual install to the Dockerfile (RUN pip install openpyxl) both before and after the RUN pip install --no-cache-dir -r requirements.txt command.
  • I’ve tried running docker-compose build --no-cache.
  • I’ve tried running docker system prune -a and rebuilding the containers from scratch.

It seems like this should be a fairly simple thing to do since I had no problems getting the other packages in the requirements.txt file installed correctly – thinking it might be something to do with the Openpyxl package itself?

Any advice would be much appreciated.

Advertisement

Answer

If I understand your question right, the following line in your docker-compose.yml can also help:

JavaScript

BTW, the docs here explain the ways to add additional requirements: Building the image

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement