Pip install opencv python error

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERROR: Failed building wheel for opencv-python #18359

ERROR: Failed building wheel for opencv-python #18359

Comments

hi i am running on python3.7 and pip 20.2.3 on ubuntu 18.04, arm64.
when i am trying to install opencv using pip3 install opencv-python
i am getting following error.

Читайте также:  Php json decode to class

ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 /home/smartagri/.local/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py build_wheel /tmp/tmpfga9p4k1
cwd: /tmp/pip-install-fmfauafs/opencv-python
Complete output (9 lines):
File «/tmp/pip-build-env-jorjrbsz/overlay/lib/python3.7/site-packages/skbuild/setuptools_wrap.py», line 560, in setup
cmkr = cmaker.CMaker(cmake_executable)
File «/tmp/pip-build-env-jorjrbsz/overlay/lib/python3.7/site-packages/skbuild/cmaker.py», line 95, in __init__
self.cmake_version = get_cmake_version(self.cmake_executable)
File «/tmp/pip-build-env-jorjrbsz/overlay/lib/python3.7/site-packages/skbuild/cmaker.py», line 82, in get_cmake_version
Problem with the CMake installation, aborting build. CMake executable is %s» % cmake_executable) Traceback (most recent call last):

Problem with the CMake installation, aborting build. CMake executable is cmake

ERROR: Failed building wheel for opencv-python
Failed to build opencv-python
ERROR: Could not build wheels for opencv-python which use PEP 517 and cannot be installed directly

i checked my setup tool wheels using pip3 install —upgrade pip setuptools wheel
but it is already up-to-date

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

Источник

Pip install opencv python error

Last updated: Feb 20, 2023
Reading time · 5 min

banner

# Could not find version that satisfies requirement cv2 OpenCV

The error «Could not find a version that satisfies the requirement cv2 OpenCV» occurs for multiple reasons:

  • Pip installing the wrong package. The name of the package is opencv-python .
  • Installing opencv-python using a Python version that is not supported by the package.
  • Having an outdated version of pip or using pip for Python 2 instead of pip3 .

could not find version that satisfies requirement cv2 opencv

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

Try running the pip install opencv-python package as that is the name of the package that exports cv2 and other OpenCV packages.

# Install the opencv-python package

Open your terminal in your project’s root directory and install the opencv-python module.

Copied!
# 👇️ in a virtual environment or using Python 2 pip install opencv-python # 👇️ for python 3 (could also be pip3.10 depending on your version) pip3 install opencv-python # 👇️ if you get permissions error sudo pip3 install opencv-python # 👇️ if you don't have pip in your PATH environment variable python -m pip install opencv-python # 👇️ for python 3 (could also be pip3.10 depending on your version) python3 -m pip install opencv-python # 👇️ for Anaconda conda install -c conda-forge opencv

If you still aren’t able to install the opencv-python package, try upgrading pip .

# Upgrade your version of pip

Here are the commands for upgrading pip on all operating systems.

Which command works depends on your operating system and your version of Python.

Copied!
# 👇️ if you have pip already installed pip install --upgrade pip # 👇️ if your pip is aliased as pip3 (Python 3) pip3 install --upgrade pip # 👇️ if you don't have pip in your PATH environment variable python -m pip install --upgrade pip # 👇️ if you don't have pip in your PATH environment variable python3 -m pip install --upgrade pip # 👇️ if you have easy_install easy_install --upgrade pip # 👇️ if you get a permissions error sudo easy_install --upgrade pip # 👇️ if you get a permissions error when upgrading pip pip install --upgrade pip --user # 👇️ upgrade pip scoped to the current user (if you get permissions error) python -m pip install --user --upgrade pip python3 -m pip install --user --upgrade pip # 👇️ Installing directly from get-pip.py (MacOS and Linux) curl https://bootstrap.pypa.io/get-pip.py | python # 👇️ if you get permissions issues curl https://bootstrap.pypa.io/get-pip.py | sudo python # 👇️ alternative for Ubuntu/Debian sudo apt-get update && apt-get upgrade python-pip # 👇️ alternative for Red Hat / CentOS / Fedora sudo yum install epel-release sudo yum install python-pip sudo yum update python-pip

If you weren’t able to update pip , check out the following article with instructions on how to install and upgrade pip .

Try running the pip install opencv-python command now that pip is upgraded.

Copied!
pip install opencv-python pip3 install opencv-python python -m pip install opencv-python python3 -m pip install opencv-python

# Having a Python version that is not supported by opencv-python

Another common cause of the error is having a Python version that is not supported by opencv-python .

The opencv-python package supports Python versions 3.6+.

You can open the pypi page of opencv-python and view the supported Python versions in the sidebar on the left, under Meta > Requires .

opencv-python supported python versions

You can check your Python version with the python —version command.

Copied!
python --version python3 --version

get python version

If you have an older Python version than 3.6, download the latest version from the official python.org website and run the installer.

Make sure to tick the following options if you get prompted:

  • Install launcher for all users (recommended)
  • Add Python to PATH (this adds Python to your PATH environment variable)

If that didn’t help, try installing the package in a virtual environment scoped to Python 3.

# Try installing the package in a virtual environment

Another thing that might help is to create a virtual environment if you don’t already have one.

Copied!
# 👇️ use correct version of Python when creating VENV python3 -m venv venv # 👇️ activate on Unix or MacOS source venv/bin/activate # 👇️ activate on Windows (cmd.exe) venv\Scripts\activate.bat # 👇️ activate on Windows (PowerShell) venv\Scripts\Activate.ps1 # 👇️ Upgrade pip pip install --upgrade pip # 👇️ install opencv-python in virtual environment pip install opencv-python

Make sure to use the correct activation command depending on your operating system.

Your virtual environment will use the version of Python that was used to create it.

You can also try running the pip install command with the —upgrade option.

Copied!
pip install opencv-python --upgrade pip3 install opencv-python --upgrade python3 -m pip install opencv-python --upgrade

If that didn’t help, try to scope the command to the specific user.

# Install the package with the —user option

The error is often caused due to not having the necessary permissions to install a package for all users on the machine.

To solve the error, install the package scoped to the specific user with the —user option.

Copied!
pip install opencv-python --user pip3 install opencv-python --user python3 -m pip install opencv-python --user

The —user option installs the package in the user’s home directory.

The command basically installs the package scoped to the specific user, not for the entire system. This helps with permission issues.

If you get a permissions error, try running the command with the —user flag or with sudo .

Copied!
sudo pip install opencv-python sudo pip3 install opencv-python sudo python3 -m pip install opencv-python

If that didn’t help, try running the command in verbose mode.

# Try running pip install opencv-python in verbose mode

If none of the suggestions helped, try running the pip install command in verbose mode.

Copied!
pip install opencv-python -vvv pip3 install opencv-python -vvv python -m pip install opencv-python -vvv

The -v option stands for verbose mode and can be used up to 3 times.

When the pip install command is run in verbose mode, the command shows more output and how the error occurred.

If the error persists, follow the instructions in my Could not find a version that satisfies the requirement X article.

# Conclusion

To solve the error «Could not find a version that satisfies the requirement cv2 OpenCV», make sure:

  • To install the correct package by running pip install opencv-python .
  • You don’t have an outdated version of pip .
  • You are using a Python version that is in the range of the supported by opencv-python versions.

I wrote a book in which I share everything I know about how to become a better, more efficient programmer.

Источник

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

installation is stuck at building wheel #391

installation is stuck at building wheel #391

Comments

Expected behaviour

I expected to module to install very fast.

Actual behaviour

Building wheel for opencv-python (PEP 517) takes forever to run.

Steps to reproduce

Issue submission checklist
  • This is not a generic OpenCV usage question (looking for help for coding, other usage questions, homework etc.)
  • I have read the README of this repository and understand that this repository provides only an automated build toolchain for OpenCV Python packages (there is no actual OpenCV code here)
  • The issue is related to the build scripts in this repository, to the pre-built binaries or is a feature request (such as «please enable this additional dependency»)
  • I’m using the latest version of opencv-python

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

hi @TheDudeThatCode ,
i tried installing the older version as you said but i am getting the same error still.
i am running on ubuntu 18.04, arm64.

python3.7 -m pip install opencv-python==4.4.0.42 Defaulting to user installation because normal site-packages is not writeable Collecting opencv-python==4.4.0.42 Using cached opencv-python-4.4.0.42.tar.gz (88.9 MB) Installing build dependencies . done Getting requirements to build wheel . done Preparing wheel metadata . done Requirement already satisfied: numpy>=1.14.5 in ./.local/lib/python3.7/site-packages (from opencv-python==4.4.0.42) (1.19.2) Building wheels for collected packages: opencv-python Building wheel for opencv-python (PEP 517) . error ERROR: Command errored out with exit status 1: command: /usr/bin/python3.7 /home/farbot/.local/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py build_wheel /tmp/tmp2mtq9r3_ cwd: /tmp/pip-install-88qrptpk/opencv-python Complete output (9 lines): File «/tmp/pip-build-env-xque07ot/overlay/lib/python3.7/site-packages/skbuild/setuptools_wrap.py», line 560, in setup cmkr = cmaker.CMaker(cmake_executable) File «/tmp/pip-build-env-xque07ot/overlay/lib/python3.7/site-packages/skbuild/cmaker.py», line 95, in __init__ self.cmake_version = get_cmake_version(self.cmake_executable) File «/tmp/pip-build-env-xque07ot/overlay/lib/python3.7/site-packages/skbuild/cmaker.py», line 82, in get_cmake_version «Problem with the CMake installation, aborting build. CMake executable is %s» % cmake_executable)
Traceback (most recent call last):

Problem with the CMake installation, aborting build. CMake executable is cmake

ERROR: Failed building wheel for opencv-python Failed to build opencv-python ERROR: Could not build wheels for opencv-python which use PEP 517 and cannot be installed directly

You can’t install the packages because the builds were (and still are) in progress. Please pin your dependencies as @TheDudeThatCode wrote above. When builds are finished, you can safely upgrade (the new release contains only bug fixes and drops Python 3.5 support). The releases are usually ready when there are release notes at https://github.com/skvark/opencv-python/releases.

@siddharthcb This project does not support ARM platforms. Therefore your installation will always fail. Source build fails because cmake has issues with ARM platforms also.

Источник

Оцените статью