Package: virtualenv
Version: 1.11.6+ds-1
Severity: normal

I have run into a strange scenario with virtualenv, which I can reliably
reproduce in both jessie and an up-to-date unstable chroot.

I was trying to create a Python 2.7 virtualenv from within the source
tree for cedar-backup2.  Every time I ran it, the virtualenv process
hung at "Installing setuptools, pip...".

I eventually discovered that this only happened when I was within the
source tree.  If went to some other directory but installed to the same
place, virtualenv completed as expected.  

This made me suspicious that there was something in my source tree 
causing the problem, so I started removing things until virtualenv
worked properly.  What I ended up with is a very minimal test case:

   wintermute:/home/pronovic/tmp/package/code> echo $PYTHONPATH

   wintermute:/home/pronovic/tmp/package/code> which virtualenv
   /usr/bin/virtualenv

   wintermute:/home/pronovic/tmp/package/code> ls -l             
   total 4
   drwxrwsr-x 2 pronovic pronovic 4096 Jul 28 16:33 util/

   wintermute:/home/pronovic/tmp/package/code> ls -l util/       
   total 8
   -rw-rw-r-- 1 pronovic pronovic 15 Jul 28 16:32 __init__.py
   -rw-rw-r-- 1 pronovic pronovic 33 Jul 28 16:32 whatever.py

   wintermute:/home/pronovic/tmp/package/code> cat util/__init__.py 
   __all__ = [ ]

   wintermute:/home/pronovic/tmp/package/code> cat util/whatever.py 
   import sys
   sys.stdin.readlines()

   wintermute:/home/pronovic/tmp/package/code> rm -rf .python && virtualenv 
--python=python2.7 .python # hangs
   Running virtualenv with interpreter /usr/bin/python2.7
   New python executable in .python/bin/python2.7
   Not overwriting existing python script .python/bin/python (you must use 
.python/bin/python2.7)
   Installing setuptools, pip...

   wintermute:/home/pronovic/tmp/package/code> cd ..

   wintermute:/home/pronovic/tmp/package> rm -rf code/.python && virtualenv 
--python=python2.7 code/.python # works
   Running virtualenv with interpreter /usr/bin/python2.7
   New python executable in code/.python/bin/python2.7
   Not overwriting existing python script code/.python/bin/python (you must use 
code/.python/bin/python2.7)
   Installing setuptools, pip...done.

   wintermute:/home/pronovic/tmp/package> cd code

   wintermute:/home/pronovic/tmp/package/code> cat util/whatever.py  # note 
readlines() commented out
   import sys
   #sys.stdin.readlines()

   wintermute:/home/pronovic/tmp/package/code> rm -rf .python && virtualenv 
--python=python2.7 .python # works
   Running virtualenv with interpreter /usr/bin/python2.7
   New python executable in .python/bin/python2.7
   Also creating executable in .python/bin/python
   Installing setuptools, pip...done.

It actually kind of of makes sense that readlines() is involved, because
if I CTRL-C virtualenv when it's stuck, I get this stack trace:

   Installing setuptools, pip...^Cdone.
   Traceback (most recent call last):
     File "/usr/bin/virtualenv", line 9, in <module>
   Traceback (most recent call last):
     File "/usr/lib/python3/dist-packages/virtualenv.py", line 2378, in
   <module>
       load_entry_point('virtualenv==1.11.6', 'console_scripts',
   'virtualenv')()
     File "/usr/lib/python3/dist-packages/virtualenv.py", line 790, in main
       main()
     File "/usr/lib/python3/dist-packages/virtualenv.py", line 830, in main
       raise SystemExit(popen.wait())
     File "/usr/lib/python3.4/subprocess.py", line 1566, in wait
       symlink=options.symlink)
     File "/usr/lib/python3/dist-packages/virtualenv.py", line 1032, in
   create_environment
       install_wheel(to_install, py_executable, search_dirs)
     File "/usr/lib/python3/dist-packages/virtualenv.py", line 975, in
   install_wheel
       'PIP_NO_INDEX': '1'
     File "/usr/lib/python3/dist-packages/virtualenv.py", line 889, in
   call_subprocess
       line = stdout.readline()
   KeyboardInterrupt
       (pid, sts) = self._try_wait(0)
     File "/usr/lib/python3.4/subprocess.py", line 1514, in _try_wait
       (pid, sts) = _eintr_retry_call(os.waitpid, self.pid, wait_flags)
     File "/usr/lib/python3.4/subprocess.py", line 491, in
   _eintr_retry_call
       return func(*args)
   KeyboardInterrupt

The behavior seems to be tied to a Python package named "util".  If I
remove util/__init__.py or rename the package to something else, that
also solves the problem.  

It does not seem to matter what the name of the source file is
(whatever.py is just an example), and it doesn't seem to matter which
version of Python I am trying to create a virtualenv for.  I've
reproduced the same behavior with 2.7 and 3.4.

Let me know if there's anything else I can help with,

Thanks,

KEN

-- System Information:
Debian Release: 8.1
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: i386 (i686)

Kernel: Linux 3.16.0-4-686-pae (SMP w/1 CPU core)
Locale: LANG=en, LC_CTYPE=en_US (charmap=ISO-8859-1) (ignored: LC_ALL set to 
en_US)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages virtualenv depends on:
ii  python3             3.4.2-2
ii  python3-virtualenv  1.11.6+ds-1

virtualenv recommends no packages.

virtualenv suggests no packages.

-- no debconf information

-- 
Kenneth J. Pronovici <prono...@debian.org>

Attachment: signature.asc
Description: Digital signature

Reply via email to