Pip install protocol error

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 --n...

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.

Содержание

  1. PIP throwing network is unreachable #5362
  2. Comments
  3. Description:
  4. What I’ve run:
  5. BrianChan.us
  6. Birds of a feather flock together
  7. pip install error – [SSL: TLSV1_ALERT_PROTOCOL_VERSION]
  8. i cannot install or upgrade pip «ssl error» #5448
  9. Comments
  10. SSL Certificate Error Using `pip install`
  11. Issue
  12. Solution

PIP throwing network is unreachable #5362

  • Pip version: 10.0.1
  • Python version: 3.6.4
  • Operating system: CentOS 7

Description:

Unable to install python package after upgrading pip.

What I’ve run:

I was getting the error for the following command.

: Failed to establish a new connection: [Errno 101] Network is unreachable’,)’: /packages/2c/01/37a5867a47d52856b077d0faa561b791cb6e6e3e9410837b6d62f569c1e6/pipenv-11.10.1-py3-none-any.whl Could not install packages due to an EnvironmentError: HTTPSConnectionPool(host=’files.pythonhosted.org’, port=443): Max retries exceeded with url: /packages/2c/01/37a5867a47d52856b077d0faa561b791cb6e6e3e9410837b6d62f569c1e6/pipenv-11.10.1-py3-none-any.whl (Caused by NewConnectionError(‘

: Failed to establish a new connection: [Errno 101] Network is unreachable’,))»>

I verified the connectivity using requests . Everything is fine with the network.

The text was updated successfully, but these errors were encountered:

I am having the same issue since yesterday when ttrying to install nose without any proxy settings.
However, ipython installation works just fine. strange

: Failed to establish a new connection: [Errno 101] Network is unreachable’,)’: /packages/15/d8/dd071918c040f50fa1cf80da16423af51ff8ce4a0f2399b7bf8de45ac3d9/nose-1.3.7-py3-none-any.whl Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘NewConnectionError(‘

: Failed to establish a new connection: [Errno 101] Network is unreachable’,)’: /packages/15/d8/dd071918c040f50fa1cf80da16423af51ff8ce4a0f2399b7bf8de45ac3d9/nose-1.3.7-py3-none-any.whl Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘NewConnectionError(‘

: Failed to establish a new connection: [Errno 101] Network is unreachable’,)’: /packages/15/d8/dd071918c040f50fa1cf80da16423af51ff8ce4a0f2399b7bf8de45ac3d9/nose-1.3.7-py3-none-any.whl Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘NewConnectionError(‘

: Failed to establish a new connection: [Errno 101] Network is unreachable’,)’: /packages/15/d8/dd071918c040f50fa1cf80da16423af51ff8ce4a0f2399b7bf8de45ac3d9/nose-1.3.7-py3-none-any.whl Could not install packages due to an EnvironmentError: HTTPSConnectionPool(host=’files.pythonhosted.org’, port=443): Max retries exceeded with url: /packages/15/d8/dd071918c040f50fa1cf80da16423af51ff8ce4a0f2399b7bf8de45ac3d9/nose-1.3.7-py3-none-any.whl (Caused by NewConnectionError(‘

: Failed to establish a new connection: [Errno 101] Network is unreachable’,)) «>

Packages not getting installed — nose , flask , django , pyramid , scrapy , pytest
Packages I am able to install — requests , ipython , ipdb , bpython , pudb

@avimehenwal: I’m not getting any error here (on Manjaro Linux). For the difference between packages you can install and those you cannot, maybe you’re hitting the cache?

@avimehenwal I tried the same from one of my aws servers, there it works fine. No idea why it is not working in my CentOS VM.

I think this might be because of the client not supporting TLS 1.2?

I started experiencing this issue today in my Ubuntu dev environment. Seems to also happen in Travis CI.

Why is this happening all of a sudden?

@BigChief45 There is an outage being investigated:

@di So is this indeed a pip issue?

@BigChief45 No, this is a networking issue between PyPI’s CDN and the infrastructure you’re using.

@BigChief45 This should be resolved now.

Hi
I i am experincing the same issues:

(venv) C:Usersc0241394PycharmProjectstesting>pip install —trusted-host=pypi.python.org —trusted-host=pypi.org —trusted-host=files.pythonhosted.org —upgrade —proxy=127.0.0.1:3128 robotframework
Collecting robotframework
Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘ProxyError(‘Cannot connect to proxy.’, FileNotFoundError(2, ‘No such file or directory’))’: /packages/95/b1/4faa12e1950b9fbd00060c112fa6f828c4f3998e9b2f
8c570c22db10bc88/robotframework-3.0.4.tar.gz
Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘ProxyError(‘Cannot connect to proxy.’, FileNotFoundError(2, ‘No such file or directory’))’: /packages/95/b1/4faa12e1950b9fbd00060c112fa6f828c4f3998e9b2f
8c570c22db10bc88/robotframework-3.0.4.tar.gz
Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘ProxyError(‘Cannot connect to proxy.’, FileNotFoundError(2, ‘No such file or directory’))’: /packages/95/b1/4faa12e1950b9fbd00060c112fa6f828c4f3998e9b2f
8c570c22db10bc88/robotframework-3.0.4.tar.gz
Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘ProxyError(‘Cannot connect to proxy.’, FileNotFoundError(2, ‘No such file or directory’))’: /packages/95/b1/4faa12e1950b9fbd00060c112fa6f828c4f3998e9b2f
8c570c22db10bc88/robotframework-3.0.4.tar.gz
Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘ProxyError(‘Cannot connect to proxy.’, FileNotFoundError(2, ‘No such file or directory’))’: /packages/95/b1/4faa12e1950b9fbd00060c112fa6f828c4f3998e9b2f
8c570c22db10bc88/robotframework-3.0.4.tar.gz
Could not install packages due to an EnvironmentError: HTTPSConnectionPool(host=’files.pythonhosted.org’, port=443): Max retries exceeded with url: /packages/95/b1/4faa12e1950b9fbd00060c112fa6f828c4f3998e9b2f8c570c22db10bc88/robotframework-3.0.4.tar.gz (Caused
by ProxyError(‘Cannot connect to proxy.’, FileNotFoundError(2, ‘No such file or directory’)))

@johntekdek You are using a proxy ( —proxy=127.0.0.1:3128 ) and the error is:

So it seems like something is wrong with your proxy.

This is not a PIP issue. Most probable cause is the kind of network you’re on. Generally happens when you’re behind proxies.

Seems like a proxy issue. Maybe this would help.

This is the solution for use PIP under proxy in Linux (Debian/RPM). tested on Centos 7

Use proxy option at command line or pass environment variable for automatic use.

Источник

BrianChan.us

Birds of a feather flock together

pip install error – [SSL: TLSV1_ALERT_PROTOCOL_VERSION]

I am on osx. And for my particular project I am stuck with python 2.7. (I think python 3 is fine at the moment.) Apparently pip has been acting up. If you do a pip install and getting something like this:

Check your pip version. pip –version. If you have 9.0.1, that’s the bad version. You will need to get to 9.0.2 or 9.0.3, or maybe version 10, but I will explain later.

If you do pip install –upgrade pip==9.0.3, that will fail with the same ssl error.

Don’t do curl https://bootstrap.pypa.io/get-pip.py | python at this point, because that will give you the pip version 10, which you may keep getting errors like this whenever you use pip.

If you are making a system-wide change to your pip, then here is how. First remove pip, then install it back.

The python -m ensurepip will give you pip 6.1.1, then the get-pip.py call will give you pip 9.0.3. Then you are all set.

If you are making a change to a virtual environment, depending on which python (-p) param you provide, mkvirtualenv always gives me pip 9.0.1 (bad) or pip 10 (bad).

If you end up having pip 10, try pip install pip==9.0.3. If that works then good for you, you can stop here. Otherwise, do the following.

We will need to install another version of python from homebrew.

After the mkvirtualenv call, the pip version is 10. Then you can downgrade to 9.0.3.

That’s all if you have to stick with python 2.7. My other projects using python 3 seem ok.

Источник

i cannot install or upgrade pip «ssl error» #5448

  • Python version:3.6.5 latest
  • Operating system:windows 10 home

The text was updated successfully, but these errors were encountered:

pip install —upgrade pip —trusted-host pypi.org —trusted-host files.pythonhosted.org

It seems like you’re having issues communicating with PyPI. I think you might be able to circumvent these SSL issues if you pass —trusted-host pypi.python.org —trusted-host files.pythonhosted.org —trusted-host pypi.org to pip when using it.

That said, that can open you up to potential security issues.

Hi
New python 3.6.5 install on win10, You need to upgrade to pip 10.0.1 manually for trusted-host to work

But still cert fails:

But now it works with —trusted-host:

I believe this is because somone have upgraded the ssl certs recently:

You also need to pass —trusted-host pypi.python.org on older versions.

Closing as a duplicate of #4459.

@fenchu you saved the day man.. thank you very much for elaborated explanation


i am getting this error plz give the solution

@ajsjagadesh i’m getting the same thing idk

I am getting the same issue, and all replies here seems to assume this error only happens if you already have some PIP version installed.
What do I do if I don’t have PIP installed at all?

I’m still getting the same issue. Not sure this is resolved. The only difference is that I’m trying to install the requests library and not flask.

I am getting the same issue, and all replies here seems to assume this error only happens if you already have some PIP version installed.
What do I do if I don’t have PIP installed at all?

You have to install pip before you can install any libraries. If you don’t have pip you may not have installed python yet, or at least not correctly.
Have you tried checking your python version?
Do the following code in your command line to check. You should get a response with your version:
$ python3 —version
Here’s a link with more info.
https://ehmatthes.github.io/pcc/chapter_01/osx_setup.html

I came across this error while operating in a chroot environment. I solved it by running on the host system:

https://python-forum.io/Thread-Cannot-update-or-install-anything-with-pip-SSL-error
python -m pip install —trusted-host pypi.python.org —trusted-host files.pythonhosted.org —trusted-host pypi.org —upgrade pip

this worked on windows
https://python-forum.io/Thread-Cannot-update-or-install-anything-with-pip-SSL-error
python -m pip install —trusted-host pypi.python.org —trusted-host files.pythonhosted.org —trusted-host pypi.org —upgrade pip

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Источник

SSL Certificate Error Using `pip install`

If you’ve recently been seeing an error message while using pip install stating that ‘There was a problem confirming the ssl certificate’, there is a good possibility that it is related to a recent pypi website change, which seems to have broken pip installations for many people.

Issue

I was getting the following message while installing Flask in a virtual environment:

(env) MacBook-Pro:flask-app jane$ pip install flask
Collecting flask
Could not fetch URL https://pypi.python.org/simple/flask/: There was a problem confirming the ssl certificate: EOF occurred in violation of protocol (_ssl.c:590) — skipping
Could not find a version that satisfies the requirement flask (from versions: )
No matching distribution found for flask

Solution

Some places on the net advised to install the pypi host as trusted, while others recommended different hacks. None of those suggestions worked, so I kept looking until this pypa-dev ticket comment on github hit the spot. The comment suggested to upgrade both pip and virtualenv .

Upgrading pip in the system Python Installation

    Check the pip version before the upgrade (to verify the update later):
    MacBook-Pro:

jane$ pip —version
pip 9.0.1 from /Library/Python/2.7/site-packages (python 2.7)

  • Download get-pip.py.
  • Run the following command to upgrade pip :
    MacBook-Pro:

    jane$ sudo python get-pip.py
    Verify the version of pip :
    MacBook-Pro:

    jane$ pip —version
    pip 9.0.3 from /Library/Python/2.7/site-packages (python 2.7)

    Note: For pip to work in existing virtual environments, you will need to follow same steps as above to upgrade pip . After activating the virtual environment, run Step 3 without the sudo . You can use the same get-pip.py downloaded in Step 2 above.

    I noticed that after upgrading system pip , the newer virtual environments created using virtualenv were still using the old pip version and I was still getting the SSL certificate error message. I had to also upgrade virtualenv to resolve the issue.

      Check the version of virtualenv before the upgrade:
      MacBook-Pro:

    jane$ virtualenv —version
    15.1.0
    Run the following command to upgrade virtualenv :
    MacBook-Pro:

    jane$ sudo pip install —upgrade virtualenv
    Collecting virtualenv
    Downloading virtualenv-15.2.0-py2.py3-none-any.whl (2.6MB)
    100% |████████████████████████████████| 2.6MB 385kB/s
    Installing collected packages: virtualenv
    Found existing installation: virtualenv 15.1.0
    Uninstalling virtualenv-15.1.0:
    Successfully uninstalled virtualenv-15.1.0
    Successfully installed virtualenv-15.2.0

    Note: Updating virtualenv ensures that the virtual environments that you create in future will install the latest pip version as well (otherwise you would need to upgrade pip version individually in every future virtual environment you create).

    Thereafter, I was able to successfully install flask (and perform other pip install operations) in a virtual environment.

    Источник

  • I am on osx. And for my particular project I am stuck with python 2.7. (I think python 3 is fine at the moment.) Apparently pip has been acting up. If you do a pip install and getting something like this:

    Collecting alembic==0.9.5 (from -r requirements.txt (line 1))
      Could not fetch URL https://pypi.python.org/simple/alembic/: There was a problem confirming the ssl certificate: [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:590) - skipping
      Could not find a version that satisfies the requirement alembic==0.9.5 (from -r requirements.txt (line 1)) (from versions: )
    No matching distribution found for alembic==0.9.5 (from -r requirements.txt (line 1))
    

    Check your pip version. pip –version. If you have 9.0.1, that’s the bad version. You will need to get to 9.0.2 or 9.0.3, or maybe version 10, but I will explain later.

    If you do pip install –upgrade pip==9.0.3, that will fail with the same ssl error.

    Don’t do curl https://bootstrap.pypa.io/get-pip.py | python at this point, because that will give you the pip version 10, which you may keep getting errors like this whenever you use pip.

    from pip._internal import main
    ImportError: No module named _internal
    

    If you are making a system-wide change to your pip, then here is how. First remove pip, then install it back.

    sudo pip uninstall pip
    python -m ensurepip
    curl https://bootstrap.pypa.io/2.6/get-pip.py | python
    

    The python -m ensurepip will give you pip 6.1.1, then the get-pip.py call will give you pip 9.0.3. Then you are all set.

    If you are making a change to a virtual environment, depending on which python (-p) param you provide, mkvirtualenv always gives me pip 9.0.1 (bad) or pip 10 (bad).

    If you end up having pip 10, try pip install pip==9.0.3. If that works then good for you, you can stop here. Otherwise, do the following.

    We will need to install another version of python from homebrew.

    brew install python2
    mkvirtualenv -p /usr/local/Cellar/python@2/2.7.14_3/bin/python2.7 your_env_name
    pip --version
    pip install pip==9.0.3
    

    After the mkvirtualenv call, the pip version is 10. Then you can downgrade to 9.0.3.

    That’s all if you have to stick with python 2.7. My other projects using python 3 seem ok.

    Environment

    • Red Hat Enterprise Linux (RHEL) 7.x
    • Red Hat Enterprise Linux (RHEL) 6.x
    • Red Hat Software Collections (RHSCL)

    Issue

    • Facing connectivity issues while installing packages using pip
    • Receiving following errors while trying to install packages using pip
    # pip install Beautifulsoup4
    Collecting Beautifulsoup4
      Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connection broken by 'ProtocolError('Connection aborted.', OSError(97, 'Address family not supported by protocol'))': /simple/beautifulsoup4/
      Retrying (Retry(total=3, connect=None, read=None, redirect=None)) after connection broken by 'ProtocolError('Connection aborted.', OSError(97, 'Address family not supported by protocol'))': /simple/beautifulsoup4/
      Could not find a version that satisfies the requirement Beautifulsoup4 (from versions: )
    No matching distribution found for Beautifulsoup4.
    

    Resolution

    This error message will be received when there is a proxy configured and no proxy parameters have been set in your environment. As pip uses HTTP and any application that uses HTTP to transfer and fetch data will have to export the proxy parameters.

    Export the proxy environment variable to install packages using pip:

    # export http_proxy="http://PROXY_SERVER:PORT"      (for HTTP)
    

    or

    # export https_proxy="https://PROXY_SERVER:PORT"      (for HTTPS)   
    

    If a proxy server uses authentication, set the proxy variables as follows:

    # export http_proxy="http://USER:PASSWORD@PROXY_SERVER:PORT"      (for HTTP)
    

    or

    # export https_proxy="https://USER:PASSWORD@PROXY_SERVER:PORT"      (for HTTPS)
    

    Now check if proxy has been set or not:

    # env | grep proxy
    

    Now, install the software using pip:

    # scl enable rh-python35 bash
    
    # pip install Beautifulsoup4
    


    • Product(s)

    • Red Hat Software Collections
    • Red Hat Enterprise Linux


    • Component

    • python


    • Category

    • Configure


    • Tags

    • python

    This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

    Original: https://lwebapp.com/en/post/pip-install-error-guide

    Question

    When we use Python to develop, we usually use some useful third-party libraries. It is recommended to use pip to install, such as installing pandas

    python -m pip install pandas
    

    Enter fullscreen mode

    Exit fullscreen mode

    Under normal circumstances, there is no problem, but some small partners will encounter installation failures such as pip installation of third-party libraries and errors, pip install stuck and other installation failures.

    For example, the following is the code that pip installs a third-party library to report an error

    Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None))...
    

    Enter fullscreen mode

    Exit fullscreen mode

    I will summarize here the solutions for the failure of Python to install third-party libraries.

    Solution

    Option 1

    The Python environment factor reports an error, check whether Python and pip under your computer are installed normally

    # Print the current Python version
    python --version
    

    Enter fullscreen mode

    Exit fullscreen mode

    If the Python version information is printed out normally after running the above command, it means that it is normal. If an error is reported, it may be that the environment variables are not configured when installing Python under Windows. You can configure the Python environment variables, or directly reinstall Python to the C drive, so that there will be no problem with environment variables.

    # print pip version
    python -m pip --version
    

    Enter fullscreen mode

    Exit fullscreen mode

    If the pip version information is printed out normally after running the above command, it means that it is normal. If an error is reported, you can use this command to install and upgrade

    python -m ensurepip --upgrade
    

    Enter fullscreen mode

    Exit fullscreen mode

    If you can’t run pip yet, you can also install pip manually

    1. Open https://bootstrap.pypa.io/get-pip.py
    2. Right click on the page — save as — save anywhere
    3. Execute python get-pip.py on the command line of the directory where the get-pip.py file is located

    Another advantage of manually installing pip is that you can directly use global pip to install dependent packages, such as

    pip install pandas
    

    Enter fullscreen mode

    Exit fullscreen mode

    Option 2

    Although pip is installed normally, sometimes it will prompt you that the version of pip is too low

    WARNING: You are using pip version 22.0.3; however, version 22.0.4 is available.
    You should consider upgrading via the '/usr/local/bin/python -m pip install --upgrade pip' command.
    

    Enter fullscreen mode

    Exit fullscreen mode

    Run the following command to upgrade pip

    python -m pip install --upgrade pip
    

    Enter fullscreen mode

    Exit fullscreen mode

    Option 3

    The third-party package name or version number is entered incorrectly. For example, I install a package called padas in the command line terminal

    python -m pip install padas
    

    Enter fullscreen mode

    Exit fullscreen mode

    The following error will appear

    ERROR: Could not find a version that satisfies the requirement padas (from versions: none)
    ERROR: No matching distribution found for padas
    

    Enter fullscreen mode

    Exit fullscreen mode

    The error tells me that I typed padas, that the package and its version number cannot be found. At this time, you need to check whether the package name is entered correctly, the correct one should be pandas. (Of course, after the article is published, some developers may have released this package, which is only for demonstration)

    There is also a problem that the version number may not exist. For example, I install a higher version of pandas

    python -m pip install pandas==6.5
    

    Enter fullscreen mode

    Exit fullscreen mode

    The following error will appear

    ERROR: Could not find a version that satisfies the requirement pandas==6.5 (from versions: 0.1, 0.2, 0.3.0, 0.4.0, 0.4.1, 0.4.2, 0.4.3, 0.5.0, 0.6.0 , 0.6.1, 0.7.0, 0.7.1, 0.7.2, 0.7.3, 0.8.0, 0.8.1, 0.9.0, 0.9.1, 0.10.0, 0.10.1, 0.11.0, 0.12 .0, 0.13.0, 0.13.1, 0.14.0, 0.14.1, 0.15.0, 0.15.1, 0.15.2, 0.16.0, 0.16.1, 0.16.2, 0.17.0, 0.17.1 , 0.18.0, 0.18.1, 0.19.0, 0.19.1, 0.19.2, 0.20.0, 0.20.1, 0.20.2, 0.20.3, 0.21.0, 0.21.1, 0.22.0, 0.23 .0, 0.23.1, 0.23.2, 0.23.3, 0.23.4, 0.24.0, 0.24.1, 0.24.2, 0.25.0, 0.25.1, 0.25.2, 0.25.3, 1.0.0 , 1.0.1, 1.0.2, 1.0.3, 1.0.4, 1.0.5, 1.1.0, 1.1.1, 1.1.2, 1.1.3, 1.1.4, 1.1.5, 1.2.0, 1.2 .1, 1.2.2, 1.2.3, 1.2.4, 1.2.5, 1.3.0, 1.3.1, 1.3.2, 1.3.3, 1.3.4, 1.3.5, 1.4.0rc0, 1.4.0 , 1.4.1)
    ERROR: No matching distribution found for pandas==6.5
    

    Enter fullscreen mode

    Exit fullscreen mode

    Obviously, this version number cannot be found, and it tells you all the version numbers that can be installed. We only need to select a version number that we need, or install the latest version by default without specifying a version number.

    Option 4

    The network quality and communication speed are different in different place, and the pip installation of dependencies will also encounter network timeout problems, such as the following errors

    raise ReadTimeoutError(self._pool, None, 'Read timed out.')
    pip._vendor.requests.packages.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='pypi.org', port=443): Read timed out.
    

    Enter fullscreen mode

    Exit fullscreen mode

    It indicates that the network has timed out, and there is a problem connecting to pypi.org. This is the website hosting the python dependencies, and all pip packages are published on it.

    We can set a longer timeout, because the network in most places is not completely unconnectable, but the speed is a bit slow. Here the --default-timeout is set to 200s

    python -m pip --default-timeout=200 install pandas
    

    Enter fullscreen mode

    Exit fullscreen mode

    Set a little more timeout, go have a cup of tea and wait for a while, and it may be downloaded.

    Option 5

    If you haven’t downloaded it after drinking tea, then consider changing the mirror source. For example, we switch to the mirror source of Tsinghua University.

    # --index-url can be abbreviated as -i
    python -m pip install --index-url https://pypi.tuna.tsinghua.edu.cn/simple/ pandas
    

    Enter fullscreen mode

    Exit fullscreen mode

    In addition to the official source and Tsinghua mirror source

    • Tsinghua: https://pypi.tuna.tsinghua.edu.cn/simple/
    • Official: https://pypi.org/

    There are other mirror sources you can try

    • Aliyun: https://mirrors.aliyun.com/pypi/simple/
    • Douban: https://pypi.douban.com/simple/
    • Beijing Foreign Studies University https://mirrors.bfsu.edu.cn/pypi/web/simple/

    Option 6

    In addition to switching mirror sources, pip officially provides a variety of ways to install dependent packages

    1. Download the dependency package in advance, and then install it directly from the local path

    For example, we can download the pandas distribution package file from the pip official website, and then execute the installation command in the directory where the local dependency package is located.

    Install from Source Distribution

    python -m pip install pandas-1.4.1.tar.gz
    

    Enter fullscreen mode

    Exit fullscreen mode

    or install from Built Distributions

    # Buildpacks for Windows platforms only
    python -m pip install pandas-1.4.1-cp310-cp310-win_amd64.whl
    

    Enter fullscreen mode

    Exit fullscreen mode

    List of all pandas distributions: pandas download files

    1. To install from any VCS (version control systems), use the following command format
    python -m pip install -e "vcs+protocol://repo_url/#egg=pkg&subdirectory=pkg_dir"
    

    Enter fullscreen mode

    Exit fullscreen mode

    • vcs: version control system name
    • protocol: protocol
    • repo_url: repository url
    • egg: package name
    • subdirectory: If the package is not in the project root directory, specify the subdirectory name

    For example, install the pandas library directly from github

    python -m pip install git+https://github.com/pandas-dev/pandas.git#egg=pandas
    

    Enter fullscreen mode

    Exit fullscreen mode

    This method will pull the latest code from github for local construction, which takes a long time, and is usually the development version.

    pip supports a lot of version control systems and protocols, see VCS Support

    1. Installation from github also supports manual local installation, clone the github repository of the dependent package directly, and execute it in the project directory
    python setup.py install
    

    Enter fullscreen mode

    Exit fullscreen mode

    In this way, the library built by this project is directly installed. In essence, it is similar to the remote method of using github. It needs to be compiled locally. It is usually used in the local development stage, or if you want to try the latest features of the project.

    However, if you have network problems through pip install, this way of installing through github usually also has certain network problems.

    Option 7

    I have tried several of the above solutions, but none of them can perfectly meet my needs.

    • Although a long timeout is set, sometimes the network is very slow, and no matter how long the timeout is, it is a waste of time.
    • Compared with the official website, the mirror source has a slightly delayed synchronization time. The official pypi.org dependency package is the most stable. The same problem is also common in the npm package management of front-end development. The mirror source sometimes has unpredictable errors, and it is often fixed by switching to the official source (refer to NPM Install Error Guide).
    • If you directly download the source package to build, because many Python libraries are written by foreigners, the website is not in your country, the download speed is very slow when visiting other countries’ websites, downloading from github is just as slow (refer to GitHub Clone Is Very Slow).

    We can consider some more scientific ways to surf the Internet to speed up access to the official website. After the acceleration, directly use pip install to install any third-party library. Basically, it can be completed in a few seconds. There is no need to set a timeout period, no need to switch mirror sources, and no need to worry about the delay of the installation package version. If you want to download the source package from the pip official website or installing Python third-party libraries remotely using github is very fast.

    In addition, there are the following benefits

    • When you access some Python third-party library documents, you can also speed up access, such as pandas official website https://pandas.pydata.org/
    • When you go to github to learn the source code of open source projects, and use git clone to pull github open source projects, the speed is significantly improved
    • The technical documents searched by Google are often more accurate, and the top of the search results are the highly praised answers on stackoverflow, which are very useful
    • Visit some other great tech sites

    Recommend a more scientific way on this Official Website ➜

    If you don’t understand, please refer to my Hard-earned Experience ➜

    Reference

    • pip Install Third-Party Library Error
    • Python official website
    • Python installation dependencies
    • pip Installation
    • NPM Install Reports an Error and Freezes, NPM Installation Guide
    • Python install Github package, offline package and online package

    I am trying to install numpy and matplotlib using pip in Python Environments on Visual Studio. I am able to click install, and it looks like everything is up to date and downloaded. I am using Python 3.4, both pip and setuptools are installed. However, when
    I go to install, I start getting several «retrying» messages that look like they stem from a Protocol Error. Here is the output from attempting to install:

    ----- Installing 'numpy' -----
    Collecting numpy
      Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connection broken by 'ProtocolError('Connection aborted.', ConnectionResetError(10054, 'An existing connection was forcibly closed by the remote host', None, 10054, None))': /simple/numpy/
      Retrying (Retry(total=3, connect=None, read=None, redirect=None)) after connection broken by 'ProtocolError('Connection aborted.', ConnectionResetError(10054, 'An existing connection was forcibly closed by the remote host', None, 10054, None))': /simple/numpy/
      Retrying (Retry(total=2, connect=None, read=None, redirect=None)) after connection broken by 'ProtocolError('Connection aborted.', ConnectionResetError(10054, 'An existing connection was forcibly closed by the remote host', None, 10054, None))': /simple/numpy/
      Retrying (Retry(total=1, connect=None, read=None, redirect=None)) after connection broken by 'ProtocolError('Connection aborted.', ConnectionResetError(10054, 'An existing connection was forcibly closed by the remote host', None, 10054, None))': /simple/numpy/
      Retrying (Retry(total=0, connect=None, read=None, redirect=None)) after connection broken by 'ProtocolError('Connection aborted.', ConnectionResetError(10054, 'An existing connection was forcibly closed by the remote host', None, 10054, None))': /simple/numpy/
      Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connection broken by 'ProtocolError('Connection aborted.', ConnectionResetError(10054, 'An existing connection was forcibly closed by the remote host', None, 10054, None))': /simple/numpy/
      Retrying (Retry(total=3, connect=None, read=None, redirect=None)) after connection broken by 'ProtocolError('Connection aborted.', ConnectionResetError(10054, 'An existing connection was forcibly closed by the remote host', None, 10054, None))': /simple/numpy/
      Retrying (Retry(total=2, connect=None, read=None, redirect=None)) after connection broken by 'ProtocolError('Connection aborted.', ConnectionResetError(10054, 'An existing connection was forcibly closed by the remote host', None, 10054, None))': /simple/numpy/
      Retrying (Retry(total=1, connect=None, read=None, redirect=None)) after connection broken by 'ProtocolError('Connection aborted.', ConnectionResetError(10054, 'An existing connection was forcibly closed by the remote host', None, 10054, None))': /simple/numpy/
      Retrying (Retry(total=0, connect=None, read=None, redirect=None)) after connection broken by 'ProtocolError('Connection aborted.', ConnectionResetError(10054, 'An existing connection was forcibly closed by the remote host', None, 10054, None))': /simple/numpy/
      Could not find a version that satisfies the requirement numpy (from versions: )
    No matching distribution found for numpy
    ----- Failed to install 'numpy' -----

    I have been searching the issue and haven’t been able to find much regarding the problem. One place said it might be caused by my security system, but the solution to install was from 2007, which seemed out of date.

    Thanks!

    Понравилась статья? Поделить с друзьями:
  • Pip install numba ошибка
  • Pinnacle studio неверный адрес электронной почты код ошибки 20002
  • Pip install numba error
  • Pinnacle studio как изменить разрешение
  • Pip install mysqlclient error