Skip to content

Pipenv PEP 503 Improvement: Pipenv downloads PyTorch for all versions of Python, grabbing 16GB of data instead of just 1.7GB. #4963

Closed
@Arcitec

Description

@Arcitec

I recently posted the correct way to install PyTorch as a PEP 503 repository in Pipenv:

#4961 (comment)

There's just one annoying issue in Pipenv: It downloads PyTorch for every version of CPython.

So let's say my project is based on pipenv install --python=3.9. And I then run the command to install PyTorch (see guide above for details): pipenv install --extra-index-url https://download.pytorch.org/whl/cu113/ "torch==1.10.1+cu113".

Well, Pipenv then downloads all versions of PyTorch into ~/.cache/pipenv: cp36, cp37, cp38, cp39 and probably a few more. And then it finally installs the intended architecture (torch-1.10.1+cu113-cp39).

This means that the download took 16 GB and 30 minutes, instead of 1.7 GB and 4 minutes. Wasting a ton of disk space and time on downloading extra copies of the library for old Python versions that I'll never use.

I confirmed that the extra downloaded data is versions for old Python releases, because I went into the Pipenv cache and looked inside the hashed archives to check their WHEEL metadata. It was stuff like the "Python 3.6" torch version etc.

I'm using pipenv 2022.1.8.

My guess is that Pipenv's current algorithm just searches PEP 503 repos for packages whose name start with torch-* and downloads them ALL and then looks at the embedded "wheel metadata" in all downloaded archives to figure out which one matches the installed Python version.

Can Pipenv be improved to detect the "cp39" filename hints in PEP 503 repos and only download the version that matches the installed Python version?

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions