Skip to content

pip connection issue in virtual enviroment #5568

Closed

Description

  • 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

Activity

  1. xavfernandez commented on Jul 4, 2018

    @xavfernandez
    Member

    Something seems indeed to be broken inside your virtual environment.
    Does python -c "import socket;print(socket.getaddrinfo('pypi.org', 443))" work inside it ?

  2. pradyunsg commented on Jul 4, 2018

    @pradyunsg
    Member

    @xavfernandez beat me to it. :)

    As an aside, putting pip's output in a code block (by surrounding it with ``` above and below) would make it easier to read. :)

  3. xavfernandez commented on Jul 4, 2018

    @xavfernandez
    Member

    @Sidstling you apparently have an issue with the python used inside your venvs.
    Is it the same as the global one ?

  4. added and removed on Jul 4, 2018
  5. ghost closed this as completedon Jul 6, 2018
  6. pradyunsg commented on Jul 6, 2018

    @pradyunsg
    Member

    @Sidstling is your issue fixed? If so, it'd be helpful for someone else who might be facing this issue if you could mention how you resolved it. :)

  7. hedrickbt commented on Aug 22, 2019

    @hedrickbt

    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/

  8. locked as resolved and limited conversation to collaborators on Oct 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions