I was trying to install OpenCV4 in a docker on jetson nano. It has jetpack 4.4 s os. The docker was successfully created and Tensorflow is running but while installing OpenCV using pip it is showing CMake error.
root#5abf405fb92d:~# pip3 install opencv-python
Collecting opencv-python
Downloading opencv-python-4.4.0.42.tar.gz (88.9 MB)
|████████████████████████████████| 88.9 MB 2.5 kB/s
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing wheel metadata ... done
Requirement already satisfied: numpy>=1.13.3 in /usr/local/lib/python3.6/dist-packages (from opencv-python) (1.18.4)
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 /usr/local/lib/python3.6/dist-packages/pip/_vendor/pep517/_in_process.py build_wheel /tmp/tmpqpzwrofy
cwd: /tmp/pip-install-93nxibky/opencv-python
Complete output (9 lines):
File "/tmp/pip-build-env-o_hualnr/overlay/lib/python3.6/site-packages/skbuild/setuptools_wrap.py", line 560, in setup
cmkr = cmaker.CMaker(cmake_executable)
File "/tmp/pip-build-env-o_hualnr/overlay/lib/python3.6/site-packages/skbuild/cmaker.py", line 95, in __init__
self.cmake_version = get_cmake_version(self.cmake_executable)
File "/tmp/pip-build-env-o_hualnr/overlay/lib/python3.6/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 had the same problem and i did this,
pip install --upgrade pip setuptools wheel
then install opencv again,
pip install opencv-python
this worked for me
If after
pip install --upgrade pip setuptools wheel
you still have the same error,
You can try to specify the older version of OpenCV to install.
Ex.
pip3 install opencv-python==3.4.13.47
Yes .. Finally found a work around.
Follow this https://github.com/mdegans/nano_build_opencv and build from source and finally gets installed.
PS: It may take a bit long for building, for me it took 10 Hrs :P.
Happy Image-Processing..
I had a similar problem and what solved it for me was not to use python:3-alpine but python:3.8-slim. E.g.:
FROM python:3.8-slim
WORKDIR /usr/src/app
RUN apt update
RUN apt -y install build-essential libwrap0-dev libssl-dev libc-ares-dev uuid-dev xsltproc
RUN apt-get update -qq \
&& apt-get install --no-install-recommends --yes \
build-essential \
gcc \
python3-dev \
mosquitto \
mosquitto-clients
RUN pip3 install --upgrade pip setuptools wheel
RUN python3 -m pip install --no-cache-dir \
numpy scipy matplotlib scikit-build opencv-contrib-python-headless \
influxdb paho-mqtt configparser Pillow \
qrcode
worked finally for me.
please check your python specifications:
- opencv -> python[
version='
>=2.7,<2.8.0a0
>=3.5,<3.6.0a0
>=3.6,<3.7.0a0
>=3.7,<3.8.0a0']
I handled it by reinstalling python3 from scratch in my MacBook:
brew reinstall python#3.9
I also reinstalled numpy and matplotlib packages experimentally.
pip3 install numpy
pip3 install matplotlib
pip3 install opencv-contrib-python
The versions:
macOS Mojave 10.14.5
Python 3.9.7
OpenCV 4.5.3
OpenCV's version is 4.5.3 by this way:
import cv2
print(cv2.__version__)
But by "pip list", it shows "opencv-contrib-python 3.4.9.31".
if you are trying to install opencv in your raspberrypi 3B, Use following steps:
sudo raspi-config
advanced -- expand filesystem
reboot your pi
Open your raspi terminal and do following stuff:
use command: sudo apt-get update
use command: sudo apt-get upgrade
check your python version and upgarde it to latest one
install pip and upgrade pip
use command: mkdir project
use command: cd project
create virtual environment
activate virtual environment
install dependencies ,can get dependencies from https://singleboardbytes.com/647/install-opencv-raspberry-pi-4.htm
if error in installing libdhf5-dev
use command: sudo apt-get install python3-h5py and reinstall libdhf5-dev
use command: pip install scikit-build
use command: pip install cython
before installing opencv ,make sure you are in virtual environment or
activate environment
use command: pip install --no-cache-dir opencv-contrib-python==4.5.3.56
Remember to use mentioned version...
Thank You...
I came across similiar situation
I had error
Failed to build opencv-python ERROR: Could not build wheels for
opencv-python which use PEP 517 and cannot be installed directly
WARNING: You are using pip version 19.2.3, however version 22.0.4 is
available. You should consider upgrading via the 'python -m pip
install --upgrade pip' command.
I ran in command prompt with admin privileges following
python -m pip install --upgrade pip
Now "pip install opencv-python" works
I'm trying to install psycopg2 but
pip install psycopg2 brings to error: command 'gcc' failed with exit status 1
Command line tools are installed
MacOS 10.15
This is likely because you don't have the PostgreSQL devel library installed. You have a few options:
(1) Install the binary with pip install psycopg2-binary
(2) Install PostgreSQL with HomeBrew: brew install postgresql, then pip install psycopg2.
You can probably just install the binary.
after updating the pip package error went away
To Update python3 pip package
wget https://bootstrap.pypa.io/get-pip.py
/usr/bin/python3 get-pip.py
I run python 3.6 and try to install the pyDNS package from pip. When I run pip install pyDNS or pip3 install pyDNS I get the error:
Command "python setup.py egg_info" failed with error code 1 in C:\Users\USER\App Data\Local\Temp\pip-install-7r09f2ua\pyDNS\
I've been trying to install the setuptools upgrade with the command pip install --upgrade setuptools but it didn't change anything.
pyDNS is Python2-only. Try py3dns or dnspython:
pip install py3dns
pip install dnspython
I am trying to install python flatlib, but i am getting an error:
Running setup.py bdist_wheel for pyswisseph ... error.
Failed building wheel for pyswisseph
Collecting pyswissep
Could not find a version that satisfies the requirement pyswissep (from versions: )
No matching distribution found for pyswissep
I have installed the latest Visual Studio C++ Build Tools.
I have run:
pip install -U setuptools
pip install - wheel
pip install update
easy_install -U pip
python -m pip install --upgrade pip
I'm using Python 3.7 and Pip 18.0
The usual ideas i can find don't have any effect!
Can anyone help?
Cheers, Will
I am using Linux, Debian based, and trying to install rpy2 with pip3.
When type:
sudo pip3 install rpy2
I get
user#huayra:~$ sudo pip3 install rpy2
Collecting rpy2
Using cached rpy2-2.9.2.tar.gz
Complete output from command python setup.py egg_info:
Error: Tried to guess R's HOME but no command 'R' in the PATH.
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-r6axcg8n/rpy2/
I have pip3 installed, the version is:
pip 9.0.1 from /usr/local/lib/python3.4/dist-packages (python 3.4)
EDIT
After some updates I re-run the command sudo pip3 install rpy2 and get:
Error: R >= 3.3 required (and the R we found is '3.1.1').
R version 3.1.1 (2014-07-10) -- "Sock it to Me"
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-3n_yfk5i/rpy2/
Any help please?
That package has been part of the distribution for many years -- I'm the maintainer.
So just do
sudo apt-get install python-rpy2 (Python 2 on e.g. Debian stable)
sudo apt-get install python3-rpy2 (Python 3, available everywhere)
and it will bring all required dependencies in as usual.