Pip: PIP ProtocolError 'Connection aborted' on trying to connect to pypi.python.org even if no-link is specified

Created on 25 Sep 2018  路  11Comments  路  Source: pypa/pip

Environment

  • pip version: 7.1.2
  • Python version: 2.7.6
  • OS: Ubuntu 14.04

Description
On trying to do a install via PIP like below

sudo pip install -U --verbose --force-reinstall --allow-unverified --no-index --find-links=/tmp/chef-cache/patroni patroni[zookeeper]==1.4.4

I am seeing logs like below and it is taking more than an hour for the installation to complete even though I am trying to do the installation from local.

 The directory '/home/ubuntu/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/ubuntu/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Getting page https://pypi.python.org/simple/patroni/
Starting new HTTPS connection (1): pypi.python.org
Incremented Retry for (url='/simple/patroni/'): Retry(total=4, connect=None, read=None, redirect=None)
Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connection broken by 'ProtocolError('Connection aborted.', error(99, 'Cannot assign requested address'))': /simple/patroni/
Starting new HTTPS connection (2): pypi.python.org
Incremented Retry for (url='/simple/patroni/'): Retry(total=3, connect=None, read=None, redirect=None)
Retrying (Retry(total=3, connect=None, read=None, redirect=None)) after connection broken by 'ProtocolError('Connection aborted.', error(99, 'Cannot assign requested address'))': /simple/patroni/
Starting new HTTPS connection (3): pypi.python.org
Incremented Retry for (url='/simple/patroni/'): Retry(total=2, connect=None, read=None, redirect=None)
Retrying (Retry(total=2, connect=None, read=None, redirect=None)) after connection broken by 'ProtocolError('Connection aborted.', error(99, 'Cannot assign requested address'))': /simple/patroni/
Starting new HTTPS connection (4): pypi.python.org
Incremented Retry for (url='/simple/patroni/'): Retry(total=1, connect=None, read=None, redirect=None)
Retrying (Retry(total=1, connect=None, read=None, redirect=None)) after connection broken by 'ProtocolError('Connection aborted.', error(99, 'Cannot assign requested address'))': /simple/patroni/
Starting new HTTPS connection (5): pypi.python.org
Incremented Retry for (url='/simple/patroni/'): Retry(total=0, connect=None, read=None, redirect=None)
Retrying (Retry(total=0, connect=None, read=None, redirect=None)) after connection broken by 'ProtocolError('Connection aborted.', error(99, 'Cannot assign requested address'))': /simple/patroni/
Starting new HTTPS connection (6): pypi.python.org
Could not fetch URL https://pypi.python.org/simple/patroni/: connection error: HTTPSConnectionPool(host='pypi.python.org', port=443): Max retries exceeded with url: /simple/patroni/ (Caused by ProtocolError('Connection aborted.', error(99, 'Cannot assign requested address'))) - skipping
1 location(s) to search for versions of patroni:
* https://pypi.python.org/simple/patroni/
Getting page https://pypi.python.org/simple/patroni/
Starting new HTTPS connection (7): pypi.python.org
Incremented Retry for (url='/simple/patroni/'): Retry(total=4, connect=None, read=None, redirect=None)
Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connection broken by 'ProtocolError('Connection aborted.', error(99, 'Cannot assign requested address'))': /simple/patroni/
Starting new HTTPS connection (8): pypi.python.org

Even though the installation is from local and --no-index is specified PIP is still trying to connect to pypi.python.org. I also tried by specifying --disable-pip-version-check (even though this is implied by --no-index option) but still PIP was trying to connect to pypi.python.org.

This can slow down the installation considerably if in a system without internet firewall is dropping the traffic instead of reject.

I think if --no-index is specified and --find-links is pointing to a local file system then PIP should not try to connect to pypi.python.org.

auto-locked support

Most helpful comment

Hey guys,

I had the same problem on cmd. I switch to windows power shell and it worked ok for new packages.
Still give me the same error for updates

All 11 comments

Anyone any update on this?

That's a really old version, can you reproduce with the latest release?

I have the same issue after upgrading pip

pip --version
pip 18.1 from c:\MyProject\env\lib\site-packages\pip (python 3.5)

requirements.txt

--find-links pkg
Twisted==18.9.0

Running pip from pkg folder

pip install -r ../requirements.txt
Collecting Twisted==18.9.0 (from -r ../requirements.txt (line 3))
    Complete output from command python setup.py egg_info:
    Download error on https://pypi.python.org/simple/incremental/: [WinError 10061] No connection could be made because the target machine actively refused it -- Some packages may not be found!
    Couldn't find index page for 'incremental' (maybe misspelled?)
    Download error on https://pypi.python.org/simple/: [WinError 10061] No connection could be made because the target machine actively refused it -- Some packages may not be found!
    No local packages or working download links found for incremental>=16.10.1
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\Arrowana\AppData\Local\Temp\pip-install-3e2qvzvx\Twisted\setup.py", line 20, in <module>
        setuptools.setup(**_setup["getSetupArgs"]())
      File "C:\Program Files\Python35\lib\distutils\core.py", line 108, in setup
        _setup_distribution = dist = klass(attrs)
      File "c:\MyProject\env\lib\site-packages\setuptools\dist.py", line 315, in __init__
        self.fetch_build_eggs(attrs['setup_requires'])
      File "c:\MyProject\env\lib\site-packages\setuptools\dist.py", line 361, in fetch_build_eggs
        replace_conflicting=True,
      File "c:\MyProject\env\lib\site-packages\pkg_resources\__init__.py", line 850, in resolve
        dist = best[req.key] = env.best_match(req, ws, installer)
      File "c:\MyProject\env\lib\site-packages\pkg_resources\__init__.py", line 1122, in best_match
        return self.obtain(req, installer)
      File "c:\MyProject\env\lib\site-packages\pkg_resources\__init__.py", line 1134, in obtain
        return installer(requirement)
      File "c:\MyProject\env\lib\site-packages\setuptools\dist.py", line 429, in fetch_build_egg
        return cmd.easy_install(req)
      File "c:\MyProject\env\lib\site-packages\setuptools\command\easy_install.py", line 659, in easy_install
        raise DistutilsError(msg)
    distutils.errors.DistutilsError: Could not find suitable distribution for Requirement.parse('incremental>=16.10.1')

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Users\Arrowana\AppData\Local\Temp\pip-install-3e2qvzvx\Twisted\

Content of pkg folder:

Twisted-18.9.0.tar.bz2
incremental-16.10.1.tar.gz
... other Twisted dependencies

--no-index is behaving well for my other dependencies which are .whl

Twisted uses setup_requires to require "incremental". The setup_requires processing is done by setuptools, and doesn't respect pip's command line options. To fix this, you'd need to request that the twisted project stop using setup_requires.

I downloaded a custom Twisted wheel from https://www.lfd.uci.edu/~gohlke/pythonlibs/#twisted

Same Twisted version but now it works and picks up the local incremental

Hi,
I also have the same issue,
I am using
Python 3.7
pip 19.1

when i try to install any package (Module) i get this error
can anyone give me a solution on this?
Capture

image
Same issue here also. I am running pip3 in WSL. sudo apt install works perfectly, but pip3 is not working. Following is my pip and python version
image
pip3 install -upgrade pip3 Also gives the same error.

Specs of the machine on which I am trying are these :
image
Any help would be appreciated. Thank You.

Hey guys,

I had the same problem on cmd. I switch to windows power shell and it worked ok for new packages.
Still give me the same error for updates

@debraj-manna, please let us know if trying with the new version did not work for you.

Hey @mca27 and @AnmolTomer, those look like unrelated connectivity issues (this issue is specifically about using --no-index). If this is still happening to you, please create a new issue so we can help troubleshoot.

Hi @Kotork. If you are still facing issues, please feel free to create a separate issue so we can investigate your situation specifically.

@chrahunt - I am not seeing this with the version 18.1.

Thanks @debraj-manna. I'll proceed to close this. Let us know if you have any other issues.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

GregBorrelly picture GregBorrelly  路  3Comments

yizhang-zen picture yizhang-zen  路  3Comments

imzi picture imzi  路  3Comments

dstufft picture dstufft  路  3Comments

therefromhere picture therefromhere  路  3Comments