Virtualenv and Pip hang forever

I am running a django project with virtualenv, which worked completely fine until today. I went to run source my-env/bin/activate and it seemed to activate (he gave me the usual command prompt), but when I tried python manage.py runserver , he said that he could not find django. I ran a python script and tried to import django, and of course he said there is no module named django. So I uninstalled this virtualenv and created a new one, and did pip install -r requirements.txt . Then I noticed that the pip hung forever, and by type ^C it would give a long track, which I presented below. As soon as this happened, I tried removing virtualenv again and starting just now, when I typed virtualenv new-env , it would hang on "Installing setuptools, pip, wheel ...", and also gave a long trace when ^C logged in. I looked through the online forums and tried everything to fix it, and nothing works. 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 
+7
source share
4 answers

This is probably not very useful, but I experienced the same symptoms and found using the verbose option to be useful:

 mkvirtualenv new-env -v 

The output indicated a problem with the proxy server that I had, preventing the use of setuptools, which I solved by setting my proxy server 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/ 
+7
source

I had a lot of problems with this, and none of what I tried in various discussions of StackOverflow helped. I am absolutely sure that this is not a network problem, and in fact I was hoping that upgrading from Ubuntu 16 to 18 would magically fix this ... but it is not. So I decided that I had to fix it.

I was starting to suspect that this was somehow related to my user directory because it worked when I tried this as the root user. Moreover, I copied my entire home directory to a temporary drive, and then returned to the main hard drive after the upgrade (because I wanted a new version of Ubuntu 18 with a “minimal” option). So I began to suspect that something in my home folder was guilty.

Running virtualenv with -vv only showed that it was stopping: Collecting setuptools .

Given that many recommend checking your internet connection, I thought this could be due to the cache. So I tried ~/.cache directory ~/.cache with:

 rm -rf ~/.cache/* 

Immediately the virtualenv command, which hung in another terminal window, continued and ended within a few seconds.

I don’t know if the bold clearing of the cache is considered this way with a lot of running applications, but it helped anyway.

Refresh

@ t354 only offers to remove ~/.cache/pip with:

 rm -rf ~/.cache/pip 

I have not tried it myself, but if it works the same way, then it is probably safer than deleting everything inside ~/.cache

+2
source

Dude, I solved this problem after a long period of pain.
Reinstall the following pip \ setuptools \ wheel packages with a couple of options.

 python -m pip install <package_name> --upgrade --force-reinstall --no-binary <package_name> 

The problem was probably due to backward compatibility of the version of one of the packages above.

0
source

user1000000

Thanks for the contribution, your recommendation helped me solve my predicament - pip hangs when trying to create a virtual environment

0
source

All Articles