'Cannot install Python Package with docker-compose
I am running a Django project with docker. Now I want to install a Python package inside the Docker container and run the following command:
docker-compose django run pip install django-extra-views
Now when I do docker-compose up, I get an error ImportError: No module named 'extra_views'. docker-compose django run pip freeze doesn't show the above package either.
Am I missing something?
Solution 1:[1]
It looks like you ran the pip install in a one-off container. That means your package isn't going to be installed in subsequent containers created with docker-compose up or docker-compose run. You need to install your dependencies in the image, usually by adding the pip install command to your Dockerfile. That way, all containers created from that image will have the dependencies available.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | ford |
