Skip to content

Do not download all wheels of pip when the release history cannot be acquired #1883

Description

@dgelessus

Issue

Occasionally when I create a virtual environment, virtualenv spawns three background Python processes that continue running even after virtualenv has exited. These background processes consume about 60-80 % CPU each and don't seem to exit on their own. Each process also has another Python subprocess that seems to be restarted every few seconds.

This doesn't happen on every virtualenv run - in particular, after it happens once (and I terminate all of the background Python processes), it doesn't happen again when I re-run virtualenv. But if I wait a while and then run virtualenv again, the problem reappears.

Here is a part of the command lines of these processes. The command lines are incomplete because I copied them from the output of htop and my terminal window wasn't wide enough. Because the issue is difficult to reproduce I haven't been able to get a better copy of the command lines yet.

eworks/Python.framework/Versions/3.8/Resources/Python.app/Contents/MacOS/Python -m pip download --disable-pip-version-check --only-binary=:all: --no-deps --python-version 3.8 -d /
eworks/Python.framework/Versions/3.8/Resources/Python.app/Contents/MacOS/Python -m pip download --disable-pip-version-check --only-binary=:all: --no-deps --python-version 3.8 -d /
eworks/Python.framework/Versions/3.8/Resources/Python.app/Contents/MacOS/Python -m pip download --disable-pip-version-check --only-binary=:all: --no-deps --python-version 3.8 -d /
eworks/Python.framework/Versions/3.8/Resources/Python.app/Contents/MacOS/Python -c from virtualenv.seed.wheels.periodic_update import do_update;do_update('setuptools', '3.8', '/Li
eworks/Python.framework/Versions/3.8/Resources/Python.app/Contents/MacOS/Python -c from virtualenv.seed.wheels.periodic_update import do_update;do_update('wheel', '3.8', '/Library
eworks/Python.framework/Versions/3.8/Resources/Python.app/Contents/MacOS/Python -c from virtualenv.seed.wheels.periodic_update import do_update;do_update('pip', '3.8', '/Library/F

It looks like this has something to do with the new "periodic update" feature, which would explain why the problem only reappears after waiting for a while. Although according to virtualenv --help the periodic update should only happen every 14 days, and I'm having this problem much more frequently than that (it reappears after a day at most).

Environment

OS: macOS 10.14.6
Python: CPython 3.8.3 (macOS installer from Python.org)

`pip list` of the host python where `virtualenv` is installed
$ python3 -m pip list
Package            Version    Location
------------------ ---------- -------------------------------------------------------
appdirs            1.4.4
appnope            0.1.0
attrs              19.3.0
backcall           0.2.0
beautifulsoup4     4.9.1
bleach             3.1.5
certifi            2020.6.20
cffi               1.14.0
chardet            3.0.4
cloudpickle        1.3.0
colorama           0.4.3
colorclass         2.2.0
cryptography       2.9.2
cycler             0.10.0
decorator          4.4.2
defusedxml         0.6.0
distlib            0.3.1
docutils           0.16
easygui            0.98.1
entrypoints        0.3
filelock           3.0.12
future             0.18.2
gym                0.17.2
gym-minigrid       1.0.1
html5lib           1.1
idna               2.10
ipykernel          5.3.0
ipython            7.16.1
ipython-genutils   0.2.0
ipywidgets         7.5.1
jedi               0.17.1
Jinja2             2.11.2
jsonschema         3.2.0
jupyter-client     6.1.5
jupyter-core       4.6.3
keyring            21.2.1
kiwisolver         1.2.0
lxml               4.5.1
MarkupSafe         1.1.1
matplotlib         3.2.2
mistune            0.8.4
msoffcrypto-tool   4.10.2
nbconvert          5.6.1
nbformat           5.0.7
notebook           6.0.3
numpy              1.19.0
olefile            0.46
oletools           0.55.1
packaging          20.4
pandocfilters      1.4.2
parso              0.7.0
pcodedmp           1.2.6
pexpect            4.8.0
pickleshare        0.7.5
Pillow             7.2.0
pip                20.1.1
pkginfo            1.5.0.1
pluggy             0.13.1
prometheus-client  0.8.0
prompt-toolkit     3.0.5
ptyprocess         0.6.0
py                 1.9.0
pycparser          2.20
pyglet             1.5.0
Pygments           2.6.1
pyparsing          2.4.7
pyrsistent         0.16.0
python-dateutil    2.8.1
PyYAML             5.3.1
pyzmq              19.0.1
readme-renderer    26.0
regex              2020.6.8
requests           2.24.0
requests-toolbelt  0.9.1
rfc3986            1.4.0
rsrcfork           1.7.1.dev0 [...]/python-rsrcfork
scipy              1.5.0
Send2Trash         1.5.0
setuptools         47.3.1
six                1.15.0
soupsieve          2.0.1
terminado          0.8.3
testpath           0.4.4
toml               0.10.1
tornado            6.0.4
tox                3.16.1
tqdm               4.47.0
traitlets          4.3.3
twine              3.2.0
typedstream        0.0.1.dev0 [...]/python-typedstream
urllib3            1.25.9
virtualenv         20.0.25
wcwidth            0.2.5
webencodings       0.5.1
wheel              0.34.2
widgetsnbextension 3.5.1
Output of the virtual environment creation
$ python3 -m virtualenv -vvv --with-traceback testenv
138 setup logging to NOTSET [DEBUG report:42]
166 find interpreter for spec PythonSpec(path=/Library/Frameworks/Python.framework/Versions/3.8/bin/python3) [INFO builtin:44]
167 proposed PythonInfo(spec=CPython3.8.3.final.0-64, exe=/Library/Frameworks/Python.framework/Versions/3.8/bin/python3, platform=darwin, version='3.8.3 (v3.8.3:6f8c8320e9, May 13 2020, 16:29:34) \n[Clang 6.0 (clang-600.0.57)]', encoding_fs_io=utf-8-utf-8) [INFO builtin:50]
167 accepted PythonInfo(spec=CPython3.8.3.final.0-64, exe=/Library/Frameworks/Python.framework/Versions/3.8/bin/python3, platform=darwin, version='3.8.3 (v3.8.3:6f8c8320e9, May 13 2020, 16:29:34) \n[Clang 6.0 (clang-600.0.57)]', encoding_fs_io=utf-8-utf-8) [DEBUG builtin:52]
173 filesystem is not case-sensitive [DEBUG info:28]
236 create virtual environment via CPython3Posix(dest=/Users/david/Downloads/work/testenv, clear=False, global=False) [INFO session:52]
237 write /Users/david/Downloads/work/testenv/pyvenv.cfg [DEBUG pyenv_cfg:34]
237 	home = /Library/Frameworks/Python.framework/Versions/3.8 [DEBUG pyenv_cfg:38]
237 	implementation = CPython [DEBUG pyenv_cfg:38]
237 	version_info = 3.8.3.final.0 [DEBUG pyenv_cfg:38]
237 	virtualenv = 20.0.25 [DEBUG pyenv_cfg:38]
237 	include-system-site-packages = false [DEBUG pyenv_cfg:38]
237 	base-prefix = /Library/Frameworks/Python.framework/Versions/3.8 [DEBUG pyenv_cfg:38]
237 	base-exec-prefix = /Library/Frameworks/Python.framework/Versions/3.8 [DEBUG pyenv_cfg:38]
237 	base-executable = /Library/Frameworks/Python.framework/Versions/3.8/bin/python3 [DEBUG pyenv_cfg:38]
239 remove file /Users/david/Downloads/work/testenv/bin/python [DEBUG _sync:38]
239 symlink /Library/Frameworks/Python.framework/Versions/3.8/bin/python3 to /Users/david/Downloads/work/testenv/bin/python [DEBUG _sync:44]
240 create virtualenv import hook file /Users/david/Downloads/work/testenv/lib/python3.8/site-packages/_virtualenv.pth [DEBUG api:94]
241 create /Users/david/Downloads/work/testenv/lib/python3.8/site-packages/_virtualenv.py [DEBUG api:97]
242 ============================== target debug ============================== [DEBUG session:54]
242 debug via /Users/david/Downloads/work/testenv/bin/python /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/virtualenv/create/debug.py [DEBUG creator:209]
242 {
  "sys": {
    "executable": "/Users/david/Downloads/work/testenv/bin/python",
    "_base_executable": "/Users/david/Downloads/work/testenv/bin/python",
    "prefix": "/Users/david/Downloads/work/testenv",
    "base_prefix": "/Library/Frameworks/Python.framework/Versions/3.8",
    "real_prefix": null,
    "exec_prefix": "/Users/david/Downloads/work/testenv",
    "base_exec_prefix": "/Library/Frameworks/Python.framework/Versions/3.8",
    "path": [
      "/Library/Frameworks/Python.framework/Versions/3.8/lib/python38.zip",
      "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8",
      "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/lib-dynload",
      "/Users/david/Downloads/work/testenv/lib/python3.8/site-packages"
    ],
    "meta_path": [
      "<class '_virtualenv._Finder'>",
      "<class '_frozen_importlib.BuiltinImporter'>",
      "<class '_frozen_importlib.FrozenImporter'>",
      "<class '_frozen_importlib_external.PathFinder'>"
    ],
    "fs_encoding": "utf-8",
    "io_encoding": "utf-8"
  },
  "version": "3.8.3 (v3.8.3:6f8c8320e9, May 13 2020, 16:29:34) \n[Clang 6.0 (clang-600.0.57)]",
  "makefile_filename": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/config-3.8-darwin/Makefile",
  "os": "<module 'os' from '/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/os.py'>",
  "site": "<module 'site' from '/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site.py'>",
  "datetime": "<module 'datetime' from '/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/datetime.py'>",
  "math": "<module 'math' from '/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/lib-dynload/math.cpython-38-darwin.so'>",
  "json": "<module 'json' from '/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/json/__init__.py'>"
} [DEBUG session:55]
308 add seed packages via FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/Users/david/Library/Application Support/virtualenv) [INFO session:59]
313 got embed update of distribution setuptools from /Users/david/Library/Application Support/virtualenv/wheel/3.8/embed/1/setuptools.json [DEBUG via_disk_folder:133]
314 got embed update of distribution pip from /Users/david/Library/Application Support/virtualenv/wheel/3.8/embed/1/pip.json [DEBUG via_disk_folder:133]
314 got embed update of distribution wheel from /Users/david/Library/Application Support/virtualenv/wheel/3.8/embed/1/wheel.json [DEBUG via_disk_folder:133]
319 wrote embed update of distribution pip at /Users/david/Library/Application Support/virtualenv/wheel/3.8/embed/1/pip.json [DEBUG via_disk_folder:159]
319 wrote embed update of distribution setuptools at /Users/david/Library/Application Support/virtualenv/wheel/3.8/embed/1/setuptools.json [DEBUG via_disk_folder:159]
319 wrote embed update of distribution wheel at /Users/david/Library/Application Support/virtualenv/wheel/3.8/embed/1/wheel.json [DEBUG via_disk_folder:159]
324 triggered periodic upgrade of pip==20.1.1 (for python 3.8) via background process having PID 57954 [INFO periodic_update:182]
326 triggered periodic upgrade of wheel==0.34.2 (for python 3.8) via background process having PID 57955 [INFO periodic_update:182]
332 got embed update of distribution wheel from /Users/david/Library/Application Support/virtualenv/wheel/3.8/embed/1/wheel.json [DEBUG via_disk_folder:133]
333 triggered periodic upgrade of setuptools==47.3.1 (for python 3.8) via background process having PID 57956 [INFO periodic_update:182]
335 got embed update of distribution setuptools from /Users/david/Library/Application Support/virtualenv/wheel/3.8/embed/1/setuptools.json [DEBUG via_disk_folder:133]
336 got embed update of distribution pip from /Users/david/Library/Application Support/virtualenv/wheel/3.8/embed/1/pip.json [DEBUG via_disk_folder:133]
338 install wheel from wheel /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/virtualenv/seed/wheels/embed/wheel-0.34.2-py2.py3-none-any.whl via CopyPipInstall [DEBUG via_app_data:53]
340 install setuptools from wheel /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/virtualenv/seed/wheels/embed/setuptools-47.3.1-py3-none-any.whl via CopyPipInstall [DEBUG via_app_data:53]
347 Attempting to acquire lock 4451582448 on /Users/david/Library/Application Support/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-47.3.1-py3-none-any.lock [DEBUG filelock:270]
350 Lock 4451582448 acquired on /Users/david/Library/Application Support/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-47.3.1-py3-none-any.lock [INFO filelock:274]
341 Attempting to acquire lock 4451582256 on /Users/david/Library/Application Support/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.34.2-py2.py3-none-any.lock [DEBUG filelock:270]
353 Lock 4451582256 acquired on /Users/david/Library/Application Support/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.34.2-py2.py3-none-any.lock [INFO filelock:274]
350 install pip from wheel /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/virtualenv/seed/wheels/embed/pip-20.1.1-py2.py3-none-any.whl via CopyPipInstall [DEBUG via_app_data:53]
362 Attempting to acquire lock 4451582976 on /Users/david/Library/Application Support/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-20.1.1-py2.py3-none-any.lock [DEBUG filelock:270]
352 Attempting to release lock 4451582448 on /Users/david/Library/Application Support/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-47.3.1-py3-none-any.lock [DEBUG filelock:315]
365 Lock 4451582448 released on /Users/david/Library/Application Support/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-47.3.1-py3-none-any.lock [INFO filelock:318]
355 Attempting to release lock 4451582256 on /Users/david/Library/Application Support/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.34.2-py2.py3-none-any.lock [DEBUG filelock:315]
365 Lock 4451582256 released on /Users/david/Library/Application Support/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.34.2-py2.py3-none-any.lock [INFO filelock:318]
365 Lock 4451582976 acquired on /Users/david/Library/Application Support/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-20.1.1-py2.py3-none-any.lock [INFO filelock:274]
366 Attempting to release lock 4451582976 on /Users/david/Library/Application Support/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-20.1.1-py2.py3-none-any.lock [DEBUG filelock:315]
368 Lock 4451582976 released on /Users/david/Library/Application Support/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-20.1.1-py2.py3-none-any.lock [INFO filelock:318]
377 copy /Users/david/Library/Application Support/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-47.3.1-py3-none-any/easy_install.py to /Users/david/Downloads/work/testenv/lib/python3.8/site-packages/easy_install.py [DEBUG _sync:52]
387 copy /Users/david/Library/Application Support/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.34.2-py2.py3-none-any/wheel-0.34.2.virtualenv to /Users/david/Downloads/work/testenv/lib/python3.8/site-packages/wheel-0.34.2.virtualenv [DEBUG _sync:52]
410 copy /Users/david/Library/Application Support/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-47.3.1-py3-none-any/setuptools-47.3.1.virtualenv to /Users/david/Downloads/work/testenv/lib/python3.8/site-packages/setuptools-47.3.1.virtualenv [DEBUG _sync:52]
437 copy directory /Users/david/Library/Application Support/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.34.2-py2.py3-none-any/wheel to /Users/david/Downloads/work/testenv/lib/python3.8/site-packages/wheel [DEBUG _sync:52]
454 copy directory /Users/david/Library/Application Support/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-47.3.1-py3-none-any/setuptools to /Users/david/Downloads/work/testenv/lib/python3.8/site-packages/setuptools [DEBUG _sync:52]
481 copy directory /Users/david/Library/Application Support/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.34.2-py2.py3-none-any/wheel-0.34.2.dist-info to /Users/david/Downloads/work/testenv/lib/python3.8/site-packages/wheel-0.34.2.dist-info [DEBUG _sync:52]
499 generated console scripts wheel3 wheel wheel-3.8 [DEBUG base:53]
555 copy directory /Users/david/Library/Application Support/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-20.1.1-py2.py3-none-any/pip to /Users/david/Downloads/work/testenv/lib/python3.8/site-packages/pip [DEBUG _sync:52]
601 copy directory /Users/david/Library/Application Support/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-47.3.1-py3-none-any/pkg_resources to /Users/david/Downloads/work/testenv/lib/python3.8/site-packages/pkg_resources [DEBUG _sync:52]
630 copy directory /Users/david/Library/Application Support/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-47.3.1-py3-none-any/setuptools-47.3.1.dist-info to /Users/david/Downloads/work/testenv/lib/python3.8/site-packages/setuptools-47.3.1.dist-info [DEBUG _sync:52]
648 generated console scripts easy_install3 easy_install easy_install-3.8 [DEBUG base:53]
1288 copy /Users/david/Library/Application Support/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-20.1.1-py2.py3-none-any/pip-20.1.1.virtualenv to /Users/david/Downloads/work/testenv/lib/python3.8/site-packages/pip-20.1.1.virtualenv [DEBUG _sync:52]
1291 copy directory /Users/david/Library/Application Support/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-20.1.1-py2.py3-none-any/pip-20.1.1.dist-info to /Users/david/Downloads/work/testenv/lib/python3.8/site-packages/pip-20.1.1.dist-info [DEBUG _sync:52]
1305 generated console scripts pip pip3.8 pip-3.8 pip3 [DEBUG base:53]
1306 add activators for Bash, CShell, Fish, PowerShell, Python, Xonsh [INFO session:64]
1314 write /Users/david/Downloads/work/testenv/pyvenv.cfg [DEBUG pyenv_cfg:34]
1314 	home = /Library/Frameworks/Python.framework/Versions/3.8 [DEBUG pyenv_cfg:38]
1314 	implementation = CPython [DEBUG pyenv_cfg:38]
1314 	version_info = 3.8.3.final.0 [DEBUG pyenv_cfg:38]
1314 	virtualenv = 20.0.25 [DEBUG pyenv_cfg:38]
1314 	include-system-site-packages = false [DEBUG pyenv_cfg:38]
1314 	base-prefix = /Library/Frameworks/Python.framework/Versions/3.8 [DEBUG pyenv_cfg:38]
1315 	base-exec-prefix = /Library/Frameworks/Python.framework/Versions/3.8 [DEBUG pyenv_cfg:38]
1315 	base-executable = /Library/Frameworks/Python.framework/Versions/3.8/bin/python3 [DEBUG pyenv_cfg:38]
1315 created virtual environment CPython3.8.3.final.0-64 in 1179ms
  creator CPython3Posix(dest=/Users/david/Downloads/work/testenv, clear=False, global=False)
  seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/Users/david/Library/Application Support/virtualenv)
    added seed packages: pip==20.1.1, setuptools==47.3.1, wheel==0.34.2
  activators BashActivator,CShellActivator,FishActivator,PowerShellActivator,PythonActivator,XonshActivator [WARNING __main__:18]
-> exit 0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions