6

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.

8
  • Please provide your Dockerfile, your error messages... Commented Sep 6, 2017 at 11:51
  • @user2915097, I edited my question. Please review. Commented Sep 6, 2017 at 12:12
  • Can you try pip install --no-index --find-links=${HOME}/myprojectdir/dependency mypackagename-mypackageversion ? Commented Sep 6, 2017 at 14:49
  • Why not just pip install /pat/to/my.whl? Commented Sep 6, 2017 at 17:09
  • 1
    pip install /path/to/*.whl Commented Sep 10, 2017 at 13:43

1 Answer 1

13

Install all wheels without listing them explicitly:

pip install /path/to/*.whl 
Sign up to request clarification or add additional context in comments.

3 Comments

A caveat that the OP didn't require is the ability to install extras. This solution will not work if you need something like pip install pkg.whl[dev].
@Keto In what way it doesn't work? Extras are just additional packages, if they're included in *.whl they will be installed; installation order is not important.
It's been a while, but I believe I meant if you want to "Install all wheels without listing them explicitly" and at the same time set extras on certain packages. You cannot glob *.whl.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.