Search code examples
pythonubuntu-16.04pipenvpyenv

What does pipenv do after installing that takes up so much time and downloads huge amounts of data?


After encountering a few nightmares with Python versions, I tried pyenv and pipenv. But when installing pygame and seaborn with pipenv, I noticed the installation happens in a few seconds and the Installation Succeeded message would appear immediately. Then there are some locking messages shown and there's a long waiting time of a few minutes where it shows a loading icon saying Locking.
During this time, there's a huge amount of data being downloaded. Image shown below. What is this data being downloaded? Why is it necessary? Can it be disabled? I'm wary of using pipenv now.

enter image description here


Solution

  • This sounds related to https://github.com/pypa/pipenv/issues/3827:

    pipenv lock downloads every available artifact of installed packages and their dependencies. It does this to calculate their hashes, even when the artifact url includes the hash in a fragment. For some large packages, such as scipy, which have large dependencies and many artifacts per version, this behavior can result in unreasonably long delays for some users (893MB vs. 50MB download).

    A workaround in the form of a patch for the pipenv source code is given in this bug report itself. It takes the hash from the artifact URL if possible instead of always recomputing it, which seems to drastically improve locking time.

    Link to workaround: https://github.com/pypa/pipenv/blob/4c003521052d3b607be5abedf989744a5c172bda/pipenv/patched/piptools/repositories/pypi.py#L60-L71