Could not find a version that satisfies the requirement cv2 (from versions: ) No matching distribution found for cv2 – How to fix?

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

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.

Why does the “Could not find a version that satisfies the requirement cv2 (from versions: ) No matching distribution found for cv2” error occur?

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:\opencv\bin.
  • Step 4: Reset your computer
  • Step 5: Run the command echo %Path% in your Command Prompt. If there is the Path to C:\opencv\bin, 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:

Leave a Reply

Your email address will not be published. Required fields are marked *