kas kas - 23 days ago 7
Python Question

virtualenv hangs before writing to bin

Virtualenv consistently hangs right after successfully installs pip, setuptools, and wheel. Executing

virtualenv venv -v
in my home directory, or in any other directory on the VM, outputs:

Creating /home/stephen.kasica/venv/lib/python2.7
Symlinking Python bootstrap modules
Symlinking /home/stephen.kasica/venv/lib/python2.7/config
Symlinking /home/stephen.kasica/venv/lib/python2.7/lib-dynload
Symlinking /home/stephen.kasica/venv/lib64/python2.7/os.py
Ignoring built-in bootstrap module: posix
Symlinking /home/stephen.kasica/venv/lib64/python2.7/posixpath.py
Cannot import bootstrap module: nt
Symlinking /home/stephen.kasica/venv/lib64/python2.7/ntpath.py
Symlinking /home/stephen.kasica/venv/lib64/python2.7/genericpath.py
Symlinking /home/stephen.kasica/venv/lib64/python2.7/fnmatch.py
Symlinking /home/stephen.kasica/venv/lib64/python2.7/locale.py
Symlinking /home/stephen.kasica/venv/lib64/python2.7/encodings
Symlinking /home/stephen.kasica/venv/lib64/python2.7/codecs.py
Symlinking /home/stephen.kasica/venv/lib64/python2.7/stat.py
Symlinking /home/stephen.kasica/venv/lib64/python2.7/UserDict.py
Symlinking /home/stephen.kasica/venv/lib64/python2.7/copy_reg.py
Symlinking /home/stephen.kasica/venv/lib64/python2.7/types.py
Symlinking /home/stephen.kasica/venv/lib64/python2.7/re.py
Symlinking /home/stephen.kasica/venv/lib64/python2.7/sre.py
Symlinking /home/stephen.kasica/venv/lib64/python2.7/sre_parse.py
Symlinking /home/stephen.kasica/venv/lib64/python2.7/sre_constants.py
Symlinking /home/stephen.kasica/venv/lib64/python2.7/sre_compile.py
Symlinking /home/stephen.kasica/venv/lib64/python2.7/warnings.py
Symlinking /home/stephen.kasica/venv/lib64/python2.7/linecache.py
Symlinking /home/stephen.kasica/venv/lib64/python2.7/_abcoll.py
Symlinking /home/stephen.kasica/venv/lib64/python2.7/abc.py
Symlinking /home/stephen.kasica/venv/lib64/python2.7/_weakrefset.py
Creating /home/stephen.kasica/venv/lib/python2.7/site-packages
Writing /home/stephen.kasica/venv/lib64/python2.7/site.py
Writing /home/stephen.kasica/venv/lib64/python2.7/orig-prefix.txt
Writing /home/stephen.kasica/venv/lib64/python2.7/no-global-site-packages.txt
Creating parent directories for /home/stephen.kasica/venv/include
Symlinking /home/stephen.kasica/venv/include/python2.7
Creating /home/stephen.kasica/venv/bin
New python executable in /home/stephen.kasica/venv/bin/python
Changed mode of /home/stephen.kasica/venv/bin/python to 0755
Testing executable with /home/stephen.kasica/venv/bin/python -c "import sys;out=sys.stdout;getattr(out, "buffer", out).write(sys.prefix.encode("utf-8"))"
Got sys.prefix result: u'/home/stephen.kasica/venv'
Creating /home/stephen.kasica/venv/lib64/python2.7/distutils
Writing /home/stephen.kasica/venv/lib64/python2.7/distutils/__init__.py
Writing /home/stephen.kasica/venv/lib64/python2.7/distutils/distutils.cfg
Installing setuptools, pip, wheel...
Collecting setuptools
Using cached setuptools-25.2.0-py2.py3-none-any.whl
Collecting pip
Collecting wheel
Installing collected packages: setuptools, pip, wheel
Successfully installed pip-8.1.2 setuptools-25.2.0 wheel-0.29.0
...Installing setuptools, pip, wheel...done.


It hangs here, and never outputs the following lines.

Writing venv/bin/activate
Writing venv/bin/activate.fish
Writing venv/bin/activate_this.py
Writing venv/bin/activate.csh


When I Ctrl+C out, it spits out this Traceback, but I'm not sure if it's related to the Ctrl+C or this issue.

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 711, in main
symlink=options.symlink)
File "/usr/lib/python2.7/site-packages/virtualenv.py", line 944, in create_environment
download=download,
File "/usr/lib/python2.7/site-packages/virtualenv.py", line 900, in install_wheel
call_subprocess(cmd, show_stdout=False, extra_env=env, stdin=SCRIPT)
File "/usr/lib/python2.7/site-packages/virtualenv.py", line 767, in call_subprocess
line = stdout.readline()
KeyboardInterrupt


I'm running virtualenv version 15.0.3, I upgraded from 15.0.1 after reading this similar issue. Python is version 2.7.5. The whole thing is running on Red Hat Enterprise Linux Workstation release 7.2 (Maipo)

kas kas
Answer

It seems like clearing pip's cache solves this problem. I really wish someone knew why though.