Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Virtualenv and Pip hanging forever

I am running a django project with a virtualenv that was working completely fine up until this afternoon. I went to run source my-env/bin/activate and it seemed to activate (it gave me the usual command prompt), but when I tried python manage.py runserver it said it could not locate django. I ran a python script and tried to import django and sure enough it said there was no module named django. So I removed this virtualenv and created a new one and did a pip install -r requirements.txt. It was then I noticed that pip was hanging forever and upon type ^C it would give a long traceback which I provided below. Once this happened I tried once again to delete the virtualenv and start over only now when I typed virtualenv new-env it would hang on "Installing setuptools, pip, wheel..." and also gave a long traceback upon entering ^C. I have looked all over the online forums and tried everything to fix this and nothing seems to be working. If anyone has any ideas on how to fix this I would really appreciate it.

Installing setuptools, pip, wheel...^CTraceback (most recent call last):
  File "/usr/local/bin/virtualenv", line 11, in <module>
done.
    sys.exit(main())
  File "/usr/local/lib/python2.7/site-packages/virtualenv.py", line 669, in main
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/site-packages/virtualenv.py", line 2327, in <module>
    raise SystemExit(popen.wait())
  File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1384, in wait
    main()
  File "/usr/local/lib/python2.7/site-packages/virtualenv.py", line 711, in main
    symlink=options.symlink)
  File "/usr/local/lib/python2.7/site-packages/virtualenv.py", line 944, in create_environment
    download=download,
  File "/usr/local/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/local/lib/python2.7/site-packages/virtualenv.py", line 767, in call_subprocess
    line = stdout.readline()
KeyboardInterrupt
    pid, sts = _eintr_retry_call(os.waitpid, self.pid, 0)
  File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 476, in _eintr_retry_call
    return func(*args)
KeyboardInterrupt
like image 384
Cameron Pattisall Avatar asked Oct 17 '16 19:10

Cameron Pattisall


People also ask

How do I destroy virtualenv?

There is no command for deleting your virtual environment. Simply deactivate it and rid your application of its artifacts by recursively removing it. Note that this is the same regardless of what kind of virtual environment you are using.

How do I enable pip virtual env?

To create a virtual environment, go to your project's directory and run venv. If you are using Python 2, replace venv with virtualenv in the below commands. The second argument is the location to create the virtual environment. Generally, you can just create this in your project and call it env .

Should I always use virtualenv?

Always use a Virtual Environment You are in control of which packages versions are installed and when they are upgraded. You can have as many venvs as you want.


1 Answers

Probably not very helpful, but I experienced the same symptoms and found using the verbose option to be helpful:

mkvirtualenv new-env -v

The output pointed at a proxy issue I had, preventing usage of setuptools, which I resolved by fixing my proxy settings:

Installing setuptools, pip, wheel...
Collecting setuptools
Retrying (Retry(total=4, connect=None, read=None, redirect=None)) 
after connection broken by 'ProxyError('Cannot connect to proxy.', 
timeout('timed out',))': /devpi/setuptools/
like image 142
user10000000 Avatar answered Oct 21 '22 04:10

user10000000