How to download the PyPI package to install the protocol later?

I have an application requirements file with attached versions of the package. I need to install PyPI packages on a system without a direct Internet connection. How can I easily download the packages I need now to install folders later without visiting every page of the package?

+7
python pip pypi offline
source share
2 answers

The pip documentation has a good example of a quick and local installation :

 $ pip install --download <DIR> -r requirements.txt $ pip install --no-index --find-links=[file://]<DIR> -r requirements.txt 

This is mainly for speed, but if you take the first step on a computer connected to the Internet, copy the files to another computer, and then run the second step, you will have to set all your requirements without an Internet connection.

+7
source share

To add ford to the answer to get around cross-platform issues, you can do the following:

On a machine with internet access, do:

 $ pip install --download <DIR> -r requirements.txt $ pip install --download <DIR> -r requirements.txt --no-use-wheel 

This will load the available wheels for the packages in case the wheel crosses the platform, but also download the source so that the packages can be built on any platform if the wheel does not work for the target system.

Then, as Ford suggested, after moving from a machine with Internet access to another machine, do:

 $ pip install --no-index --find-links=[file://]<DIR> -r requirements.txt 

I can not guarantee that this will work in every case, but it worked for me when I tried to download the package and its dependencies on a Windows machine with Internet access for installation on a CentOS computer without Internet access. There may be other factors to consider when using different versions of Python on each machine (in my case, I had Python 3.4 for both).

+1
source share

All Articles