Ошибка no matching distribution found for

I am trying to install pip in my python 2.6.6, I have Oracle Linux 6

I followed the answers given at this link Link

I downloaded get-pip.py file and ran the following command

sudo python2.6 get-pip.py

However I get the following error

[root@bigdatadev3 Downloads]# sudo python2.6 get-pip.py
DEPRECATION: Python 2.6 is no longer supported by the Python core team, please upgrade your Python. A future version of pip will drop support for Python 2.6
Collecting pip
  Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x3cad210>: Failed to establish a new connection: [Errno 101] Network is unreachable',)': /simple/pip/
  Retrying (Retry(total=3, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x3cadad0>: Failed to establish a new connection: [Errno 101] Network is unreachable',)': /simple/pip/
  Retrying (Retry(total=2, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x3cad6d0>: Failed to establish a new connection: [Errno 101] Network is unreachable',)': /simple/pip/
  Retrying (Retry(total=1, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x3cad790>: Failed to establish a new connection: [Errno 101] Network is unreachable',)': /simple/pip/
  Retrying (Retry(total=0, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x3cad110>: Failed to establish a new connection: [Errno 101] Network is unreachable',)': /simple/pip/
  Could not find a version that satisfies the requirement pip (from versions: )
No matching distribution found for pip

The error shows some network issue, but I have full open internet access here.

How can I install pip?

I also tried yum, yum install python-pip but it gave the following message

[root@bigdatadev3 ~]# yum install python-pip
Loaded plugins: refresh-packagekit, security, ulninfo
Setting up Install Process
No package python-pip available.
Error: Nothing to do

Update 1:

I used the following command,

python get-pip.py --proxy="MY_PROXY"

I get the following error

DEPRECATION: Python 2.6 is no longer supported by the Python core team, please upgrade your Python. A future version of pip will drop support for Python 2.6
    Collecting pip
    Exception:
    Traceback (most recent call last):
      File "/tmp/tmpnz7ISh/pip.zip/pip/basecommand.py", line 215, in main
        status = self.run(options, args)
      File "/tmp/tmpnz7ISh/pip.zip/pip/commands/install.py", line 324, in run
        requirement_set.prepare_files(finder)
      File "/tmp/tmpnz7ISh/pip.zip/pip/req/req_set.py", line 380, in prepare_files
        ignore_dependencies=self.ignore_dependencies))
      File "/tmp/tmpnz7ISh/pip.zip/pip/req/req_set.py", line 554, in _prepare_file
        require_hashes
      File "/tmp/tmpnz7ISh/pip.zip/pip/req/req_install.py", line 278, in populate_link
        self.link = finder.find_requirement(self, upgrade)
      File "/tmp/tmpnz7ISh/pip.zip/pip/index.py", line 465, in find_requirement
        all_candidates = self.find_all_candidates(req.name)
      File "/tmp/tmpnz7ISh/pip.zip/pip/index.py", line 423, in find_all_candidates
        for page in self._get_pages(url_locations, project_name):
      File "/tmp/tmpnz7ISh/pip.zip/pip/index.py", line 568, in _get_pages
        page = self._get_page(location)
      File "/tmp/tmpnz7ISh/pip.zip/pip/index.py", line 683, in _get_page
        return HTMLPage.get_page(link, session=self.session)
      File "/tmp/tmpnz7ISh/pip.zip/pip/index.py", line 792, in get_page
        "Cache-Control": "max-age=600",
      File "/tmp/tmpnz7ISh/pip.zip/pip/_vendor/requests/sessions.py", line 488, in get
        return self.request('GET', url, **kwargs)
      File "/tmp/tmpnz7ISh/pip.zip/pip/download.py", line 386, in request
        return super(PipSession, self).request(method, url, *args, **kwargs)
      File "/tmp/tmpnz7ISh/pip.zip/pip/_vendor/requests/sessions.py", line 475, in request
        resp = self.send(prep, **send_kwargs)
      File "/tmp/tmpnz7ISh/pip.zip/pip/_vendor/requests/sessions.py", line 596, in send
        r = adapter.send(request, **kwargs)
      File "/tmp/tmpnz7ISh/pip.zip/pip/_vendor/cachecontrol/adapter.py", line 47, in send
        resp = super(CacheControlAdapter, self).send(request, **kw)
      File "/tmp/tmpnz7ISh/pip.zip/pip/_vendor/requests/adapters.py", line 390, in send
        conn = self.get_connection(request.url, proxies)
      File "/tmp/tmpnz7ISh/pip.zip/pip/_vendor/requests/adapters.py", line 290, in get_connection
        proxy_manager = self.proxy_manager_for(proxy)
      File "/tmp/tmpnz7ISh/pip.zip/pip/_vendor/requests/adapters.py", line 184, in proxy_manager_for
        **proxy_kwargs
      File "/tmp/tmpnz7ISh/pip.zip/pip/_vendor/requests/adapters.py", line 43, in SOCKSProxyManager
        raise InvalidSchema("Missing dependencies for SOCKS support.")
    InvalidSchema: Missing dependencies for SOCKS support.

Does it mean that a private package which has a dependent package on pypi doesn’t work?
(i.e. pipenv will only see one index url. If a private package depends on a package on pypi, the dependent package cannot be installed because pipenv see only see private index which is not a pypi..)

@masato-yasuda No this seems to work fine, since in the example of torch repositories, the are in a private repository and pull in other dependencies from pypi. Here is a sample Pipfile.lock I generated:

{
    "_meta": {
        "hash": {
            "sha256": "b5ad2e9ab98f4d253629a73ed721b21a23453d4ddc77b2df9fd52d607cc03946"
        },
        "pipfile-spec": 6,
        "requires": {
            "python_version": "3.10"
        },
        "sources": [
            {
                "name": "pypi",
                "url": "https://pypi.org/simple",
                "verify_ssl": true
            },
            {
                "name": "downloadpytorch",
                "url": "https://download.pytorch.org/whl/",
                "verify_ssl": true
            }
        ]
    },
    "default": {
        "certifi": {
            "hashes": [
                "sha256:78884e7c1d4b00ce3cea67b44566851c4343c120abd683433ce934a68ea58872",
                "sha256:d62a0163eb4c2344ac042ab2bdf75399a71a2d8c7d47eac2e2ee91b9d6339569"
            ],
            "version": "==2021.10.8"
        },
        "charset-normalizer": {
            "hashes": [
                "sha256:2857e29ff0d34db842cd7ca3230549d1a697f96ee6d3fb071cfa6c7393832597",
                "sha256:6881edbebdb17b39b4eaaa821b438bf6eddffb4468cf344f09f89def34a8b1df"
            ],
            "markers": "python_version >= '3'",
            "version": "==2.0.12"
        },
        "colorama": {
            "hashes": [
                "sha256:5941b2b48a20143d2267e95b1c2a7603ce057ee39fd88e7329b0c292aa16869b",
                "sha256:9f47eda37229f68eee03b24b9748937c7dc3868f906e8ba69fbcbdd3bc5dc3e2"
            ],
            "markers": "platform_system == 'Windows'",
            "version": "==0.4.4"
        },
        "idna": {
            "hashes": [
                "sha256:84d9dd047ffa80596e0f246e2eab0b391788b0503584e8945f2368256d2735ff",
                "sha256:9d643ff0a55b762d5cdb124b8eaa99c66322e2157b69160bc32796e824360e6d"
            ],
            "markers": "python_version >= '3'",
            "version": "==3.3"
        },
        "numpy": {
            "hashes": [
                "sha256:07a8c89a04997625236c5ecb7afe35a02af3896c8aa01890a849913a2309c676",
                "sha256:08d9b008d0156c70dc392bb3ab3abb6e7a711383c3247b410b39962263576cd4",
                "sha256:201b4d0552831f7250a08d3b38de0d989d6f6e4658b709a02a73c524ccc6ffce",
                "sha256:2c10a93606e0b4b95c9b04b77dc349b398fdfbda382d2a39ba5a822f669a0123",
                "sha256:3ca688e1b9b95d80250bca34b11a05e389b1420d00e87a0d12dc45f131f704a1",
                "sha256:48a3aecd3b997bf452a2dedb11f4e79bc5bfd21a1d4cc760e703c31d57c84b3e",
                "sha256:568dfd16224abddafb1cbcce2ff14f522abe037268514dd7e42c6776a1c3f8e5",
                "sha256:5bfb1bb598e8229c2d5d48db1860bcf4311337864ea3efdbe1171fb0c5da515d",
                "sha256:639b54cdf6aa4f82fe37ebf70401bbb74b8508fddcf4797f9fe59615b8c5813a",
                "sha256:8251ed96f38b47b4295b1ae51631de7ffa8260b5b087808ef09a39a9d66c97ab",
                "sha256:92bfa69cfbdf7dfc3040978ad09a48091143cffb778ec3b03fa170c494118d75",
                "sha256:97098b95aa4e418529099c26558eeb8486e66bd1e53a6b606d684d0c3616b168",
                "sha256:a3bae1a2ed00e90b3ba5f7bd0a7c7999b55d609e0c54ceb2b076a25e345fa9f4",
                "sha256:c34ea7e9d13a70bf2ab64a2532fe149a9aced424cd05a2c4ba662fd989e3e45f",
                "sha256:dbc7601a3b7472d559dc7b933b18b4b66f9aa7452c120e87dfb33d02008c8a18",
                "sha256:e7927a589df200c5e23c57970bafbd0cd322459aa7b1ff73b7c2e84d6e3eae62",
                "sha256:f8c1f39caad2c896bc0018f699882b345b2a63708008be29b1f355ebf6f933fe",
                "sha256:f950f8845b480cffe522913d35567e29dd381b0dc7e4ce6a4a9f9156417d2430",
                "sha256:fade0d4f4d292b6f39951b6836d7a3c7ef5b2347f3c420cd9820a1d90d794802",
                "sha256:fdf3c08bce27132395d3c3ba1503cac12e17282358cb4bddc25cc46b0aca07aa"
            ],
            "markers": "python_version >= '3.8'",
            "version": "==1.22.3"
        },
        "requests": {
            "hashes": [
                "sha256:68d7c56fd5a8999887728ef304a6d12edc7be74f1cfa47714fc8b414525c9a61",
                "sha256:f22fa1e554c9ddfd16e6e41ac79759e17be9e492b3587efa038054674760e72d"
            ],
            "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4, 3.5'",
            "version": "==2.27.1"
        },
        "torch": {
            "hashes": [
                "sha256:6c66502d4e30464abd8ede9b00ef85ac7eaf569bdf53663375a0ed3f49c4f1e5"
            ],
            "version": "==1.11.0+cu115"
        },
        "torchtext": {
            "hashes": [
                "sha256:09a047a90615febb5280bb39f69e89de515212d8d0f75b85e5ad474221f1744a",
                "sha256:174bc6b33d77d9eebbae473f98389183a0c269c68416372ca614b12cfa326969",
                "sha256:1845c480fe47c641816d770efac3a32fb927673d46b00c062a2ec377bc312cdc",
                "sha256:1db04814d0289429bebd776707ea58d251166f56cc8298956101534a20f0a5cd",
                "sha256:21b6b5a00000ad9dfa09d984a1a7b7cdd79c8310c2a780e672cdf95a2bc26c1b",
                "sha256:24b34a1b857aeef8d0c6e7b3ed2d9230d0a36df5bdb9dd5262b018675b739306",
                "sha256:2ea13e79b02d226adb122ecc8f9648c768e0b683e32fd8b3c0c0c22e8661ed6f",
                "sha256:2ecd9a32064ea5caf78c7e4843719ecabe100066b32df8d228a6f2ba6bc5ea8b",
                "sha256:365e5f640e29d2fc924cc274f024ee02e49e680b5a6d10d4d7ccdd1665b73120",
                "sha256:36a8c9d6ddbfb70904f15caade91f8deb28b35c2693347853f1bea7f65f00b40",
                "sha256:391dd25cc426ade637da7297e6d72eaf5efc5fa13a4e25cf2fa5d93119bb176b",
                "sha256:59912472689e5734ccdd134a0352e46bb36cecd3d59b323e097474f4c4e4bf9a",
                "sha256:63d9b6e94af6092c472c77e26cf466599eccc1e3a0facc59c87d7611b5afcda6",
                "sha256:66792b1e6d3929944a8d47ad371c71de07a4023f5692385ba7e50c61e111f2f2",
                "sha256:87530abac557e9702d41edd89c94ccbc4871d43c0f479af97ae3342836e875ec",
                "sha256:8bbf5649e4dc691535920437c09017fcab7cfed7125ed0cfe1e1a3bbe792ab93",
                "sha256:af04961985c419579662e703243fa592d74fc44e2863a44c23214b377cf426d8",
                "sha256:b7fa7557fe5542b58c09abb4bf14e0c6ed6afe653606e318080ba0718d3e1eda",
                "sha256:bce2a8f6f3a82974b950ee526640b3f747e7bade32b92d0747687bfe76af8d81"
            ],
            "index": "downloadpytorch",
            "version": "==0.12.0"
        },
        "tqdm": {
            "hashes": [
                "sha256:4230a49119a416c88cc47d0d2d32d5d90f1a282d5e497d49801950704e49863d",
                "sha256:6461b009d6792008d0000e1b0c7ca50195ec78c0e808a3a6b668a56a3236c3a5"
            ],
            "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'",
            "version": "==4.63.1"
        },
        "typing-extensions": {
            "hashes": [
                "sha256:1a9462dcc3347a79b1f1c0271fbe79e844580bb598bafa1ed208b94da3cdcd42",
                "sha256:21c85e0fe4b9a155d0799430b0ad741cdce7e359660ccbd8b530613e8df88ce2"
            ],
            "markers": "python_version >= '3.6'",
            "version": "==4.1.1"
        },
        "urllib3": {
            "hashes": [
                "sha256:44ece4d53fb1706f667c9bd1c648f5469a2ec925fcf3a776667042d645472c14",
                "sha256:aabaf16477806a5e1dd19aa41f8c2b7950dd3c746362d7e3223dbe6de6ac448e"
            ],
            "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4' and python_version < '4'",
            "version": "==1.26.9"
        }
    },
    "develop": {}
}

“No matching distribution found for ipykernel” is an error message that can occur when attempting to install the ipykernel package in Python. We encounter this error message when the package cannot be found in the specified repository. It can also occur when the package version is not compatible with the current version of Python. This issue can occur in both Jupyter Notebook and command line interfaces. It can be a frustrating obstacle for those looking to use the ipykernel package for their projects.

What is ipykernel package?

The ipykernel package is a Jupyter kernel for the Python programming language. It allows users to run Python code in Jupyter Notebook. The package is used to create and manage Python kernels in Jupyter Notebook. It is also a necessary component for running Python code in this environment.

Causes and solutions for the error “No matching distribution found for ipykernel”

1. Mismatch in the version of python and ipykernel

One common cause of the “No matching distribution found for ipykernel” error is a mismatch between the version of Python being used and the version of the ipykernel package that is being installed. For example, if the current version of Python is 3.8, and the ipykernel package being installed is only compatible with Python 3.6, this error will occur.

Solution

To resolve this issue, users can either install a version of the ipykernel package that is compatible with their current version of Python or update their version of Python to match the compatibility of the ipykernel package.

2. Outdated version of pip

Another cause of the “No matching distribution found for ipykernel” error is an outdated version of pip, the package installer for Python. Pip is the tool to install packages in Python, and if it is not up-to-date, it may not be able to find the correct version of the ipykernel package.

Solution

To resolve this issue, users can update pip by running the following command in their command line interface:

pip install --upgrade pip

3. Installing ipykernel in a virtual environment

Additionally, some users may encounter this error message if they are trying to install the ipykernel package in a virtual environment. Virtual environments are isolated Python environments that allow users to install packages and dependencies without affecting the global Python installation.

Solution

When installing packages in a virtual environment, it is necessary to specify the environment using the -m flag like so

python -m ipykernel install --user

4. When Python environment not on the system PATH

Another situation that might cause this error is when the python environment is not in the system path. This can happen when a different version of python is on the system that is not present in the system path.

Solution

To resolve this issue, users can add the path to the python environment in the system path or run the command prompt as an administrator and try installing the package again.

5. Installing ipykernel behind corporate firewall

Sometimes, users may also see this error message when they are trying to install the ipykernel package behind a corporate firewall. In this case, the firewall may be blocking access to the package repository, and the installation will fail.

Solution

To resolve this issue, users can try installing the package using a proxy server or contact their IT department for assistance.

[Solved] typeerror: unsupported format string passed to list.__format__

6. Ipykernel not available in the desired repository

Another common cause of the “no matching distribution found for ipykernel” error is that the package is not available on the specified repository. By default, pip installs packages from the Python Package Index (PyPI), but some packages may not be available on this repository.

Solution

In this case, you may need to specify a different repository to install the package from. For example, if you are trying to install the ipykernel package using pip and encounter the error message “no matching distribution found for ipykernel”, you can try specifying the Anaconda repository using the following command:

pip install --index-url=https://pypi.anaconda.org/ipykernel/simple ipykernel

7. Lack of permissions

Additionally, sometimes the error occurs due to lack of permissions. If you are trying to install the package in a system-wide location or a virtual environment that you do not have permission to write to, you will encounter the “no matching distribution found for ipykernel” error.

Solution

o resolve this issue, you will need to install the package in a location that you have permission to write to, such as your user’s home directory. You can do this by using the –user flag when installing the package with pip. For example:

pip install --user ipykernel

8. Ipykernel not compatible with Jupyter

Another common cause of the “no matching distribution found for ipykernel” error is that the package is not compatible with the version of Jupyter that is currently in use. Jupyter and ipykernel are two separate projects and have different release schedules. The version of Jupyter you have installed may not be compatible with the version of ipykernel you are installing.

Solution

To resolve this issue, you will need to make sure that you have the correct version of Jupyter installed for the version of ipykernel that you are trying to use.

Error no matching distribution found for jupyterlab

“Struggling with the “error no matching distribution found for jupyterlab”? You’re not alone! This error message occurs when trying to install JupyterLab using pip and means that the package you’re trying to install is not available in the Python Package Index (PyPI).

But don’t let this error hold you back. Here’s how you can solve it:

  1. Check your pip version: Make sure you have the latest version of pip installed by running pip --version. If you don’t, update it by running pip install --upgrade pip.
  2. Try installing a specific version of JupyterLab: You can try installing a specific version of JupyterLab by using the == operator, like so: pip install jupyterlab==3.0.0.
  3. Install JupyterLab using conda: If the above steps don’t work, try installing JupyterLab using conda by running conda install jupyterlab.

These steps should help you solve the “error no matching distribution found for jupyterlab” and get JupyterLab installed and running in no time!

FAQs

Can I still use Jupyter Notebook even after getting this error?

Yes, you can still use Jupyter even if you receive the “no matching distribution found for ipykernel” error.

How to install ipykernel in Anaconda?

Use conda install -c anaconda ipykernel to install Ipykernal in anaconda.

Conclusions

In conclusion, the “no matching distribution found for ipykernel” error can occur due to a variety of issues. By understanding the causes of this error and using the appropriate solutions, developers can quickly and easily resolve this issue and get back.

Trending Python Articles

  • [Solved] typeerror: unsupported format string passed to list.__format__

    [Solved] typeerror: unsupported format string passed to list.__format__

    May 31, 2023

  • Solving ‘Remote End Closed Connection’ in Python!

    Solving ‘Remote End Closed Connection’ in Python!

    by Namrata GulatiMay 31, 2023

  • [Fixed] io.unsupportedoperation: not Writable in Python

    [Fixed] io.unsupportedoperation: not Writable in Python

    by Namrata GulatiMay 31, 2023

  • [Fixing] Invalid ISOformat Strings in Python!

    [Fixing] Invalid ISOformat Strings in Python!

    by Namrata GulatiMay 31, 2023

If you are getting trouble with the “Could not find a version that satisfies the requirement cv2 (from versions: ) No matching distribution found for cv2” error, do not worry. Today, our article will give a few solutions and detailed explanations to handle the problem. Keep on reading to get your answer.

First, you should be clear that OpenCV (Open Source Computer Vision Library) is an open-source machine learning software library, mainly computer vision. Cv2 is the module import name which represents the ‘opencv-python’ package. 

This error occurs because you have some misunderstandings when installing the package. You must have installed the ‘opencv-python’ package instead of installing cv2. This is an example about the error:

pip install cv2

Result:

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

Keep going on. Now, we provide you with a few ways to install ‘opencv-python’ package.

Solutions to solve this problem

Install OpenCV by using pip

Pip is a package manager used to control other packages in python. 

First, make sure that your system has installed pip. If not, please visit here. In this tutorial, we only focus on installing the ‘opencv-python’ package. 

Install the package by pip in Windows Operating System or Terminal with Linux Operating System or macOS, run the following command:

For the main module package:

pip install opencv-python

For full package:

pip install opencv-contrib-python

Install the package for server or no GUI library system:

For the main module package:

pip install opencv-python-headless

For full package:

pip install opencv-contrib-python-headless

Install OpenCV from GitHub 

In Windows Operating System

Follow these steps

  • Step 1: Download the latest.
  • Step 2: Unzip to C:opencv.
  • Step 3: Add the Path in Environment Variables setting to C:opencvbin.
  • Step 4: Reset your computer
  • Step 5: Run the command echo %Path% in your Command Prompt. If there is the Path to C:opencvbin, you installed it successfully.

In Linux Operating System

Step 1: Install essential packages

sudo apt update && sudo apt install -y cmake g++ wget unzip

Step 2: Download and unzip sources

wget -O opencv.zip https://github.com/opencv/opencv/archive/4.x.zip
unzip opencv.zip

Step 3: Create a directory to build the sources

mkdir -p build && cd build

Step 4: Make configuration

cmake ../opencv-4.x

Step 5: Build modules

cmake --build 

Source: opencv.org

Summary

Our article has explained the cause of the “Could not find a version that satisfies the requirement cv2 (from versions: ) No matching distribution found for cv2” error. We also give you instructions to install OpenCV as a user and developer. Hope you our tutorial helps you to fix the problem completely. Thanks for reading!

Maybe you are interested:

  • IsADirectoryError: [Errno 21] Is a directory in Python
  • ‘pyinstaller’ is not recognized as an internal or external command operable program or batch file

My name is Robert Collier. I graduated in IT at HUST university. My interest is learning programming languages; my strengths are Python, C, C++, and Machine Learning/Deep Learning/NLP. I will share all the knowledge I have through my articles. Hope you like them.

Name of the university: HUST
Major: IT
Programming Languages: Python, C, C++, Machine Learning/Deep Learning/NLP

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

  • Ошибка no match for operator
  • Ошибка no main manifest attribute
  • Ошибка no iwd files found in main
  • Ошибка no hardware found
  • Ошибка no getpropnames function for undefined