How to use Python python to load and store zipped files for a package?

If I want to use the pip command to download the package (and its dependencies), but save all the downloaded zip files (say django-socialregistration.tar.gz) - is there a way to do this?

I tried various command line options, but it always seems to unzip and delete the zip file - or it gets the zip file, but only for the source package, not for dependencies.

+86
python pip
04 Sep 2018-11-11T00:
source share
5 answers

The --download-cache should do what you want:

 pip install --download-cache="/pth/to/downloaded/files" package 

However, when I tested this, the main package downloaded, saved and installed normally, but the dependencies were saved with the full URL as the name - a little annoying, but all the tar.gz files were there.

The --download option downloads the main package and its dependencies and does not install any of them. ( Note that prior to version 1.1, the --download option --download not load dependencies.)

 pip install package --download="/pth/to/downloaded/files" 

--download documentation --download to --download for quick and local installation .

+108
Sep 04 2018-11-11T00:
source share
β€” -

I always do this to download packages:

pip install --download /path/to/download/to_packagename

OR

pip install --download=/path/to/packages/downloaded -r requirements.txt

And when I want to install all those libraries that I just downloaded, I do this:

pip install --no-index --find-links="/path/to/downloaded/dependencies" packagename

OR

pip install --no-index --find-links="/path/to/downloaded/packages" -r requirements.txt




Update

In addition, so that all packages are installed on one system, you can export them all to requirement.txt , which will be used to include them in another system, we do the following:

pip freeze > requirement.txt

Then requirement.txt can be used as indicated above for download, or to do this to install them from requirement.txt :

pip install -r requirement.txt

REFERENCE: picket installer

+51
Sep 24 '13 at 18:23
source share

pip install --download deprecated. Starting with version 8.0.0 you should use the pip download command:

  pip download <package-name> 
+44
Jul 03 '16 at 9:33
source share

In version 7.1.2, pip loads the package wheel (if available) with the following:

 pip install package -d /path/to/downloaded/file 

Loads the source distribution:

 pip install package -d /path/to/downloaded/file --no-binary :all: 

They also download dependencies if pip knows about them (for example, if pip show package lists them).




Update

As noted by Anton Hodak , the pip download command is preferable from version 8. In the above examples, this means that /path/to/downloaded/file must be provided with the -d option, so replacing install with download works.

+7
Dec 11 '15 at 10:51
source share

Use pip download <package1 package2 package n> to download all packages, including dependencies

Use pip install --no-index --find-links. <package1 package2 package n> pip install --no-index --find-links. <package1 package2 package n> pip install --no-index --find-links. <package1 package2 package n> pip install --no-index --find-links. <package1 package2 package n> to install all packages, including dependencies. It gets all the files from CWD . He won't say anything

+4
Feb 22 '18 at 12:29
source share



All Articles