[Tutor] pip install in a virtualenv *without* internet?

Albert-Jan Roskam sjeik_appie at hotmail.com
Wed Aug 19 14:24:44 CEST 2015

Sorry, now with Reply All

From: sjeik_appie at hotmail.com
To: mcfletch at vrplumber.com
Subject: RE: [Tutor] pip install in a virtualenv *without* internet?
Date: Wed, 19 Aug 2015 11:25:49 +0000

> Date: Tue, 18 Aug 2015 22:32:28 -0400
> From: mcfletch at vrplumber.com
> To: tutor at python.org
> Subject: Re: [Tutor] pip install in a virtualenv *without* internet?
> On 15-08-18 04:10 PM, Albert-Jan Roskam wrote:
> > Hi,
> >   
> >   
> > I use Python(x y) (Python 2.7) on Win7. I need a higher version of openpyxl, because pandas.Dataframe.to_excel yields an error. So pandas and its own dependencies (e.g. numpy) could remain in the python(x y) site-packages, I just need a higher version of openpyxl without disturbing the x,y installation (I do not even have rights to install stuff there!)
> >   
> > So I would like to pip install a openpyxl AND its specific dependencies in a virtualenv.
> > The problem is that I can't use pip to download the packages from Pypi because I do not have a regular internet connection. Is there a generic way to install a package and its (pre-downloaded) dependencies, a way that requires little or no modifications to the original package?
> > Using pip 'editable' might help: http://stackoverflow.com/questions/15031694/installing-python-packages-from-local-file-system-folder-with-pip. I am hoping requirements.txt might somehow be used to install the dependencies from a local location --but how?
> To install without going out to the internet, you can use these arguments:
>      pip install --no-index --find-links=/path/to/download/directory 
> <packages>
> that *won't* work for git/svn/bzr linked (editable) packages, but should 
> work for pre-downloaded "released" packages. If you need the editable 
> packages, you'll need to pull the git/whatever repositories and modify 
> your requirements file to point to the local git repo. But you likely 
> could just do a "python setup.py develop" for them if you've got the 
> source downloaded anyway.
> I often use this with a separate "download dependencies" stage that 
> populates the packages directory so that our build server doesn't hit 
> PyPi every time we do a rebuild of our virtualenvs (which we do for 
> every testing build).

Hi Mike,
Thank you so much! This looks very useful indeed. In fact, it is strange that pip does not cache packages by default (or does it?),
similar to apt-get. I have often been amazed by the number of downloads of some packages. Even with very popular packages, many thousands of downloads a day is probably mostly the result of build servers that re-download from Pypi with each and every push/commit. I always pin the exact version in requirements.txt, ie. I use pkg=1.0.1, not pkg>=1.0.1, so I really only use one version.
Best wishes,


More information about the Tutor mailing list