Installing opencv-python on raspberry pi 3, Raspbian Stretch - opencv

As above, trying to install opencv-python.
Normally this would be a simple pip install opencv-python, but it doesn't seem to work. Instead, opencv install to the miniconda directory
/home/pi/miniconda3/lib/python3.5/site-packages
instead of global
/usr/lib/python3.7
Trying to add opencv-python in Thorny through the application fails. In the python program...
import sys
sys.path.append('/home/pi/miniconda3/lib/python3.5/site-packages')
import cv2
results in a
No module named 'cv2.cv2'
I've tried adding it to path also (export PYTHONPATH=/home/pi/miniconda3/lib/python3.5/site-packages:$PYTHONPATH) with no luck.

Because pip is linked to your default Python and I think this default is your miniconda. A better approach is to call the Python version directly with pip. Additionally #Dave W. Smit mentioned that you should better install opencv-python-contrib to use the full OpenCV package (but donĀ“t use both packages!).
$ python-3.7 -m pip install opencv-python-contrib
Or you can use the pip version (if pip is at least version 0.8)
$ pip-3.7 install opencv-python-contrib
Or with pip version 1.5+
$ pip3.7 install opencv-python-contrib

Related

Couldn't install opencv-python with python version Python 3.6.5 :: Anaconda, Inc

I have darknet and opencv4.2.0 with Ubuntu 18.04
however I couldn't import CV2 while using python (darknet works well)
when i use sudo pip3 install opencv-python
terminal shows
Installing through navigator doesn't work either

Module seaborn has no attribute lineplot

I don't know why it's showing this although I installed all packages. I uninstalled and reinstalled python and also did 'pip install seaborn' but it's showing the same problem as mentioned below
Module seaborn has no attribute lineplot
Install seaborn version 0.9.0
For conda
conda install -c anaconda seaborn=0.9.0
For pip
pip install seaborn==0.9.0

How to install OpenCV 3.4.5 in Ubuntu 14.04?

I am trying to install OpenCV 3.4.5 in Ubuntu 14.04 LTS and I need this OS for my project. I have not found any proper way to do so. I tried this: https://docs.opencv.org/3.4.5/d2/de6/tutorial_py_setup_in_ubuntu.html but cannot install the dependencies as mentioned.
Any suggestions or guide would be much appreciated.
Assuming you have Python installed, try install opencv-python which is an unofficial pre-built OpenCV package.
pip install numpy
pip install opencv-python==3.4.5
To ensure successful installation, open IDLE to check version number:
import cv2
print(cv2.__version__)

"Could not find a version that satisfies the requirement opencv-python"

I am struggling with Jetson TX2 board (aarch64).
I need to install python wrapper for OpenCV.
I can do:
$ sudo apt-get install python-opencv
But I cannot do:
$ sudo pip install opencv-python
Is this because there is no proper wheel file in http://www.lfd.uci.edu/~gohlke/pythonlibs/#opencv?
Is there a way to install opencv-python through pip?
We were getting the same error.For us, it solved by upgrading pip version (also discussed in FAQ of OpenCV GitHub). Earlier we had pip-7.1.0, post upgrading it to "pip-9.0.2", it successfully installed.
pip install --upgrade pip
pip install opencv-python
pip doesn't use http://www.lfd.uci.edu/~gohlke/pythonlibs/, it downloads packages from PyPI.
The problem is that you have an unusual architecture; pip cannot find a package for it and there is no source code package.
Unfortunately I think you're on your own. You have to download source code from https://github.com/skvark/opencv-python, install compiler and necessary libraries and compile OpenCV yourself.
Use this and it will work:
pip install --upgrade pip
pip install opencv-python
Another problem can be that the python version you are using is not yet supported by opencv-python.
E.g. as of right now there is no opencv-python for python 3.8. You would need to downgrade your python to 3.7.5 for now.
It happened with me on Windows, pip was not able to install opencv-python==3.4.0.12.
Later found out that it was due to the Python version, Python 3.7 has some issue with not getting linked to https://github.com/skvark/opencv-python.
Downgraded to Python 3.6 and it worked with:
pip3 install opencv-python
I faced the same issue but the mistake which I was making was pip install python-opencv where I should have used pip install opencv-python. Hope this helps to anyone. It took me few hours to find.
As there is no proper wheel file in http://www.lfd.uci.edu/~gohlke/pythonlibs/#opencv?
Try this:(Worked in Anaconda Prompt or Pycharm)
pip install opencv-contrib-python
pip install opencv-python
A way to do this is to install Anaconda on your computer.
Then you should be able to do:
pip install opencv-python
or
conda install opencv
I had the same error. The first time I used the 32-bit version of python but my computer is 64-bit. I then reinstalled the 64-bit version and succeeded.
Install it by using this command:
pip install opencv-contrib-python
I faced same issue while using Python 3.9.0.
Upgrading python to latest version (currently 3.9.1) and reinstalling opencv-python solved this issue.
I got this error and I solved it by simply waiting.
I had similar problem:
ERROR: Could not find a version that satisfies the requirement opencv-contrib-python (from versions: none)
Command pip update was not resolving my issue.
After lunch-time I tried again and it installed correctly the package.
Maybe the server was down.
I update the version of python, and then the issue was addressed. Please refer to this video: https://www.youtube.com/watch?v=BQnpRbbEZB4

Problems installing scikit-image in ubuntu 14.04

When I try to install scikit-image with pip2 there is show error. I have tried to find this problem solution.
Command python setup.py egg_info failed with error code 1 in /tmp/pip_build_root/scikit-image
Storing debug log for failure in /home/nshakib/.pip/pip.log
My guess is that you might have missing dependencies. I don't think Ubuntu 14.04 comes out of the box with any of the SciPy stack.
To answer your question try,
sudo apt-get install python-matplotlib python-numpy python-pil python-scipy
Then
sudo apt-get install build-essential cython
Finally
sudo apt-get install python-skimage
If that still doesn't work, you could try using the Anaconda Distribution for Python 2.7 from Continuum Analytics.
It comes with many of the major packages built-in and has a great package manager that manages dependencies.
https://docs.continuum.io/anaconda/install#anaconda-install
The conda package would be installed with conda install scikit-image

Resources