Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can pip use existing packages rather than downloading again?

I'm working on a new project that needs a new virtualenv. When I do pip install -r requirements.txt, it downloads the packages all over again even though those packages already exist on the previous project's virtualenv.

Is there any way to tell pip to get the packages from the other virtualenv instead?

like image 685
Ron Avatar asked Mar 16 '11 18:03

Ron


People also ask

What is the difference between pip install and pip download?

Overview. pip download does the same resolution and downloading as pip install , but instead of installing the dependencies, it collects the downloaded distributions into the directory provided (defaulting to the current directory).

Can you pip install multiple packages at once?

To pip install more than one Python package, the packages can be listed in line with the same pip install command as long as they are separated with spaces. Here we are installing both scikit-learn and the statsmodel package in one line of code. You can also upgrade multiple packages in one line of code.

Can pip open packages?

txt file contains. You can run pip list to display the packages you just installed, with their version numbers: Windows.

Does pip download download dependencies?

The pip download command can be used to download packages and their dependencies to the current directory (by default), or else to a specified location without installing them.


1 Answers

It's not the answer to your question but I guess it's what you want, i.e. avoiding the download: you can specify the environment variable PIP_DOWNLOAD_CACHE=/path/to/directory/where/downloaded/packages/will/be/stored Packages will be downloaded into this directory and if they are to be installed again, taken from this directory.

Got it from: http://tartley.com/?p=1133 and works fine for me

There is also the option --download-cache to the pip install command - I guess it does the same thing, but the environment variable is handier.

like image 101
Sebastian Blask Avatar answered Oct 28 '22 11:10

Sebastian Blask