I have a Dockerfile which is trying to install a whl
file which is located in my project using pip
. I want to force pip
to include my whl
file in its searches, but it doesn't:
No distributions matching the version for mylibname==mylibversion
I tried using build_ext
with options -L
:
pip install --global-option=build_ext --global-option="-L/directory/containing/whl/file/"
-I
:
pip install --global-option=build_ext --global-option="-I/directory/containing/whl/file/"
and -b
:
pip install --global-option=build_ext --global-option="-b/directory/containing/whl/file/"
But none of them worked.
EDIT 1:
This is my Dockerfile
:
FROM python:2.7.9
MAINTAINER Zeinab Abbasimazar
ADD myprojectdir .
RUN ls -la ${HOME}/myprojectdir/dependency
RUN pip --version
RUN pip install --global-option=build_ext --global-option="-L${HOME}/myprojectdir/dependency" mypackagename-mypackageversion
WORKDIR .
CMD python --version
This is the output of docker build -t myimagename .
:
Sending build context to Docker daemon 4.096 kB
Step 1 : FROM python:2.7.9
---> 646fa5bbf55d
Step 2 : MAINTAINER Zeinab Abbasimazar
---> d08f7cb9e985
Step 2 : ADD myprojectdir .
---> 0e190b21a30b
Step 3 : RUN ls -la ${HOME}/myprojectdir/dependency
total 1740
drwxr-sr-x 2 root staff 4096 Sep 6 11:58 .
drwxr-sr-x 3 root staff 4096 Sep 6 11:58 ..
-rw-r--r-- 1 root staff 454253 Sep 6 11:58 mypackagename-mypackageversion-py2-none-any.whl
---> d069986bd3b6
Step 4 : RUN pip --version
pip 1.5.6 from /usr/lib/python2.7/dist-packages (python 2.7)
---> ddeccc833ea2
Step 5 : RUN pip install --global-option=build_ext --global-option="-L${HOME}/myprojectdir/dependency" mypackagename-mypackageversion
Downloading/unpacking mypackagename-mypackageversion
Could not find a version that satisfies the requirement mypackagename-mypackageversion
Cleaning up...
No distributions matching the version for mypackagename-mypackageversion
Storing debug log for failure in /root/.pip/pip.log
The command '/bin/sh -c pip install --global-option=build_ext --global-option="-L${HOME}/myprojectdir/dependency" mypackagename-mypackageversion' returned a non-zero code: 1
EDIT2:
The pip install /path/to/the/whl/file.whl
completely works; but it's not what I want.
Install all wheels without listing them explicitly:
pip install /path/to/*.whl
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With