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

Mike C. Fletcher mcfletch at vrplumber.com
Wed Aug 19 04:32:28 CEST 2015


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).

HTH,
Mike

-- 
________________________________________________
   Mike C. Fletcher
   Designer, VR Plumber, Coder
   http://www.vrplumber.com
   http://blog.vrplumber.com



More information about the Tutor mailing list