Pip Unable To Install Packages Inside Docker Container On Mac
I am following the Docker-getting started guide to using docker with a python application, but when docker gets up to the command: RUN pip install -r requirements.txt I'm getting
Solution 1:
I have found out that this is a pip proxy error and was able to solve the issue by specifying the proxy as a parameter to pip install. So instead of simply having
#Install any needed packages specified in requirements.txt
RUN pip install -r requirements.txt
in my Dockerfile
, i had
#Install any needed packages specified in requirements.txt
RUN pip install -r requirements.txt --proxy http(s)://proxy:8080 --trusted-host pypi.python.org
The --proxy http(s)://proxy:8080
specifies the proxy to be used by pip and --trusted-host pypi.python.org
enables pypi as a trusted host just in case ssl certificate errors are encountered (common in corporate environments).
Solution 2:
The only solution that worked for me was to include in my Dockerfile this line:
RUN pip install <package name> -i <package URL>
instead of having it in my requirements.txt.
When it was in requirements.txt I think Docker wasn't looking at package URL.
Post a Comment for "Pip Unable To Install Packages Inside Docker Container On Mac"