question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

pip connection issue in virtual enviroment

See original GitHub issue
  • pip version: 10.0.1
  • Python version: 3.7
  • OS: windows 10

I’m in an enterprise setup, but I’m not behind a proxy. I’m using git bash.

Description I can’t install modules with pip when I’m inside a virtual enviroment. I can install modules with pip, when I’m not inside a virtual enviroment.

The error I’m getting is: “Failed to establish a new connection: [Errno 11003] getaddrinfo failed’)': /simple/modulename”

Example of installing/updating pip with trusted hosts enabled outside the virtual enviroment

$ python -m pip install --trusted-host pypi.python.org --trusted-host files.pythonhosted.org --trusted-host pypi.org --upgrade pip
Requirement already up-to-date: pip in c:\users\penyme\appdata\local\programs\python\python37\lib\site-packages (10.0.1)

Example of the same operation within a virtual enviroment:

$ source env/Scripts/activate
x@x MINGW64 /p/Workspace/_poc/DjangoTango/DjangoTango
(env)
$ python -m pip install --trusted-host pypi.python.org --trusted-host files.pythonhosted.org --trusted-host pypi.org --upgrade pip
Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x000002ABE4C84978>: Failed to establish a new connection: [Errno 11003] getaddrinfo failed')': /simple/pip/
Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x000002ABE4ABE128>: Failed to establish a new connection: [Errno 11003] getaddrinfo failed')': /simple/pip/
Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x000002ABE4C4B2E8>: Failed to establish a new connection: [Errno 11003] getaddrinfo failed')': /simple/pip/
Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x000002ABE4C76AC8>: Failed to establish a new connection: [Errno 11003] getaddrinfo failed')': /simple/pip/
Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x000002ABE4C76B70>: Failed to establish a new connection: [Errno 11003] getaddrinfo failed')': /simple/pip/
Requirement already up-to-date: pip in p:\workspace\_poc\djangotango\djangotango\env\lib\site-packages (10.0.1)

Pip is up-to-date, but when I try to install Djnago it looks like this:

$ pip install "django<1.12"
Collecting django<1.12
  Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x000001B8DB4D22B0>: Failed to establish a new connection: [Errno 11003] getaddrinfo failed')': /simple/django/
  Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x000001B8DB4C7F60>: Failed to establish a new connection: [Errno 11003] getaddrinfo failed')': /simple/django/
  Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x000001B8DB4C7EB8>: Failed to establish a new connection: [Errno 11003] getaddrinfo failed')': /simple/django/
  Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x000001B8DB4C7E48>: Failed to establish a new connection: [Errno 11003] getaddrinfo failed')': /simple/django/
  Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x000001B8DB4C7D68>: Failed to establish a new connection: [Errno 11003] getaddrinfo failed')': /simple/django/
  Could not find a version that satisfies the requirement django<1.12 (from versions: )
No matching distribution found for django<1.12

if I try the same command on my base enviroment it looks like:

$ pip install "django<1.12"
Collecting django<1.12
  Downloading https://files.pythonhosted.org/packages/bf/e0/e659df5b5b82299fffd8b3df2910c99351b9308b8f45f5702cc4cdf946e9/Django-1.11.14-py2.py3-none-any.whl (7.0MB)
Collecting pytz (from django<1.12)
  Downloading https://files.pythonhosted.org/packages/30/4e/27c34b62430286c6d59177a0842ed90dc789ce5d1ed740887653b898779a/pytz-2018.5-py2.py3-none-any.whl (510kB)
Installing collected packages: pytz, django
Successfully installed django-1.11.14 pytz-2018.5

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

4reactions
ghostcommented, Jul 6, 2018

@pradyunsg it’s not fixed exactly, but the issue is with how venvs are created on network drives and not what I originally described.

I avoid the issue by not using the network drive to create my venvs.

0reactions
hedrickbtcommented, Aug 22, 2019

I received the same error when I ran from a network drive (H:) vs a local (C:) drive. Python 3.6

H:\data\python\opstree>opstree_env\Scripts\activate.bat

(opstree_env) H:\data\python\opstree>pip install -r redis-load-test\Scripts\requirments.txt Collecting locust (from -r redis-load-test\Scripts\requirments.txt (line 1)) WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘NewConnectionError(’<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x000002270EB52128>: Failed to establish a new connection: [Errno 11003] getaddrinfo failed’,)‘: /simple/locust/ WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘NewConnectionError(’<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x000002270EB52588>: Failed to establish a new connection: [Errno 11003] getaddrinfo failed’,)‘: /simple/locust/ WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘NewConnectionError(’<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x000002270EB52390>: Failed to establish a new connection: [Errno 11003] getaddrinfo failed’,)‘: /simple/locust/ WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘NewConnectionError(’<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x000002270EB52710>: Failed to establish a new connection: [Errno 11003] getaddrinfo failed’,)‘: /simple/locust/ WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘NewConnectionError(’<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x000002270EB5A160>: Failed to establish a new connection: [Errno 11003] getaddrinfo failed’,)': /simple/locust/

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to pip install packages when I am in a virtualenv
Moving the repo to the C: drive solved my issue and I was able to use pip to install my venv requirements. txt....
Read more >
Installing packages using pip and virtual environments
This guide discusses how to install packages using pip and a virtual environment manager: either venv for Python 3 or virtualenv for Python...
Read more >
Problem with pip package installation in virtualenv environment
Using sudo with pip installs the package globally/system-wide. This pretty much defeats the purpose of your virtual environment which is to ...
Read more >
Creating Python Virtual Environment with Pip
Python Virtual Environment. By default, Python installs modules or packages system wide which can become an issue if he program(s) in use or ......
Read more >
Problems Installing PIP and Virtualenv when setting up a ...
Just be aware that if you pip install some_module while in a Python virtual environment, the module will likely be installed into e.g....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found