Skip to content

virtualenv creation may hang or raise oserror due to pip cache invalidation #1104

@ssbarnea

Description

@ssbarnea

It seems that something may happen to pip cache(~/.cache/pip) that could render virtualenv unusable, it will hang for minutes and eventually fail with a meaningless error.

One message that worth mentioning is Cache entry deserialization failed, entry ignored but I was not able to find exactly what it means.

Note that I did kept a copy of the broken ~/.cache/pip so we can perform additional tests on it in order identify which kind of issue we had and how to avoid/detect/repair it.

I already checked and all file permissions are ok, also apparently there are no spaces in any filenames.
A full list of files is available at https://gist.github.com/ssbarnea/5d6515768dadcb86713e06349b4fbcb8

This happened on CI so we really need to find a way to avoid this from recurring.

$ virtualenv -vvv ~/xx
...
Installing setuptools, pip, wheel...
  Running command /home/rhos-ci/xx/bin/python - setuptools pip wheel
  Collecting setuptools
    Using cached setuptools-36.8.0-py2.py3-none-any.whl
  Collecting pip
  Collecting wheel
    Cache entry deserialization failed, entry ignored
^C...Installing setuptools, pip, wheel...done.
Traceback (most recent call last):
  File "/bin/virtualenv", line 11, in <module>
    sys.exit(main())
  File "/usr/lib/python2.7/site-packages/virtualenv.py", line 713, in main
    symlink=options.symlink)
  File "/usr/lib/python2.7/site-packages/virtualenv.py", line 945, in create_environment
    download=download,
  File "/usr/lib/python2.7/site-packages/virtualenv.py", line 901, in install_wheel
    call_subprocess(cmd, show_stdout=False, extra_env=env, stdin=SCRIPT)
  File "/usr/lib/python2.7/site-packages/virtualenv.py", line 769, in call_subprocess
    line = stdout.readline()
KeyboardInterrupt

If I didn't press CTRL-C, it would naturally fail after a big number of minutes, with

Traceback (most recent call last):
  File "/usr/bin/virtualenv", line 11, in <module>
    sys.exit(main())
  File "/usr/lib/python2.7/site-packages/virtualenv.py", line 713, in main
    symlink=options.symlink)
  File "/usr/lib/python2.7/site-packages/virtualenv.py", line 945, in create_environment
    download=download,
  File "/usr/lib/python2.7/site-packages/virtualenv.py", line 901, in install_wheel
    call_subprocess(cmd, show_stdout=False, extra_env=env, stdin=SCRIPT)
  File "/usr/lib/python2.7/site-packages/virtualenv.py", line 797, in call_subprocess
    % (cmd_desc, proc.returncode))
OSError: Command /home/rhos-ci/xx/bin/python - setuptools pip wheel failed with error code -15

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions