Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

virtualenv hung up on installing setuptools

Tags:

never had this issue until just recently, but when trying to create a new virtual environment (windows 7, python 2.7.13, virtualenv==15.1.0) it just hangs on "Installing setuptools, pip, wheel..." and doing a crtl^c gives you this:

PS C:\Users\John\Envs> virtualenv.exe rmapvenv
New python executable in C:\Users\John\Envs\test\Scripts\python.exe
Installing setuptools, pip, wheel...done.
Traceback (most recent call last):
  File "c:\python27\lib\runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "c:\python27\lib\runpy.py", line 72, in _run_code
    exec code in run_globals
  File "C:\Python27\Scripts\virtualenv.exe\__main__.py", line 9, in <module>
  File "c:\python27\lib\site-packages\virtualenv.py", line 713, in main
    symlink=options.symlink)
  File "c:\python27\lib\site-packages\virtualenv.py", line 945, in create_environment
    download=download,
  File "c:\python27\lib\site-packages\virtualenv.py", line 901, in install_wheel
    call_subprocess(cmd, show_stdout=False, extra_env=env, stdin=SCRIPT)
  File "c:\python27\lib\site-packages\virtualenv.py", line 769, in call_subprocess
    line = stdout.readline()
KeyboardInterrupt

adding some print statements in virtualenv.py gives me this:

Running command C:\Users\John\Envs\test\Scripts\python.exe - setuptools pip wheel

Collecting setuptools

  Using cached setuptools-35.0.1-py2.py3-none-any.whl

Collecting pip

Collecting wheel

it seems to be hung up on wheel

like image 909
John Avatar asked Apr 24 '17 23:04

John


People also ask

Is Setuptools installed by default with Python?

Even in a vanilla version of Python 3.7. 6 (installed via pyenv ), the packages installed by default are both pip and setuptools .

Does pip use Setuptools?

pip is a higher-level interface on top of setuptools or Distribute. It uses them to perform many of its functions but avoids some of their more controversial features, like zipped eggs.

How do I set up Setuptools for Python on Windows?

Step 1: Download the latest source package of Setuptools for Python3 from here. Step 2: Extract the downloaded package using the given command. Step 3: Go to the setuptools-60.2. 0 folder and enter the following command to install the package.


2 Answers

Use the -v switch to get Verbose output.

For me, it was a network connection. Specifically, the server I was trying to use virtualenv on was firewalled from the Internet and I needed to get out thru a proxy. Except, that virtualenv doesn't seem to honor the proxy settings in the environment and it has no commandline switch.

So use pip to pre-cache/pre-download the 3 needed packages:

sudo pip download setuptools pip wheel --proxy http://<yourproxyhere>

Then you can run virtualenv and it will use the cached packages that you just downloaded.

like image 99
Pretzel Avatar answered Sep 21 '22 19:09

Pretzel


I was using pipenv to install a venv :

$ pipenv install
Creating a virtualenv for this project…
Pipfile: /home/seba/Sources/neogeo/grandlyon/photon-setup/Pipfile
Using /usr/bin/python3 (3.6.7) to create virtualenv…
⠦ Creating virtual environment...

Verbose mode didn't give me more information, --clear was useless but using ps auxf I saw the oython process was waiting for nothing:

 [...] S+   09:59   0:00  |   |       \_ /home/seba/Sources/neogeo/grandlyon/photon-setup/venv/bin/python3 - setuptools pip wheel

It stalled installing setuptools.

Creating a virtualenv as usual confirmed me this:

$ virtualenv -vv --python=python3 venv
[...]
Running command /home/seba/Sources/n...tup/venv/bin/python3 - setuptools pip wheel
Looking in links: /usr/local/lib/python3.6/dist-packages/virtualenv_support
Collecting setuptools
[Waiting forever]

The fix was dropping pip cache:

$ rm -Rf ~/.cache/pip/ ~/.cache/pip-tools/
like image 28
Sebastien DA ROCHA Avatar answered Sep 17 '22 19:09

Sebastien DA ROCHA