Roomba980-Python icon indicating copy to clipboard operation
Roomba980-Python copied to clipboard

CV or numpy module not found, falling back to PIL

Open smartnakh opened this issue 6 years ago • 9 comments

Hi

always getting CV or numpy module not found, falling back to PIL

CV or numpy seem to be well installed

smartnakh avatar Aug 05 '18 11:08 smartnakh

That would indicate CV is not installed. What platform are you on? how did you install CV? and what version of CV do you think is installed? how do you know it is installed correctly?

NickWaterton avatar Aug 07 '18 12:08 NickWaterton

Thank for you answer

My Environment


pi@smhpi:~ $ uname 
		Linux
		pi@smhpi:~ $ cat /etc/os-release
		PRETTY_NAME="Raspbian GNU/Linux 9 (stretch)"
		NAME="Raspbian GNU/Linux"
		VERSION_ID="9"
		VERSION="9 (stretch)"
		ID=raspbian
		ID_LIKE=debian
		HOME_URL="http://www.raspbian.org/"
		SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
		BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"

```		
OpenCV seems to be well installed 

pi@smhpi:~ $ pkg-config opencv --cflags -I/usr/include/opencv


i have installed manually all the prerequisites

pi@smhpi:~ $ sudo apt-get install python-numpy Reading package lists... Done Building dependency tree
Reading state information... Done python-numpy is already the newest version (1:1.12.1-3). 0 upgraded, 0 newly installed, 0 to remove and 67 not upgraded.

pi@smhpi:~ $ sudo pip install paho-mqtt Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple Requirement already satisfied: paho-mqtt in /usr/local/lib/python2.7/dist-packages (1.3.1) pi@smhpi:~ $ sudo pip install paho-mqtt==1.2.3 Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple Collecting paho-mqtt==1.2.3 Installing collected packages: paho-mqtt Found existing installation: paho-mqtt 1.3.1 Uninstalling paho-mqtt-1.3.1: Successfully uninstalled paho-mqtt-1.3.1 Successfully installed paho-mqtt-1.2.3

pi@smhpi:~ $ sudo pip install pillow Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple Requirement already satisfied: pillow in /usr/local/lib/python2.7/dist-packages (5.2.0)

pi@smhpi:~ $ sudo pip install six Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple Requirement already satisfied: six in /usr/lib/python2.7/dist-packages (1.10.0)

pi@smhpi:~ $ sudo pip3 install six Requirement already satisfied: six in /usr/lib/python3/dist-packages

Even a clone from git Which brings the dependancies

pi@smhpi:/etc/openhab2/scripts/Roomba980-Python $ git clone https://github.com/NickWaterton/Roomba980-Python.git Cloning into 'Roomba980-Python'... remote: Counting objects: 344, done. remote: Total 344 (delta 0), reused 0 (delta 0), pack-reused 344 Receiving objects: 100% (344/344), 425.91 KiB | 393.00 KiB/s, done. Resolving deltas: 100% (182/182), done.




pi@smhpi:/etc/openhab2/scripts/Roomba980-Python/Roomba980-Python/roomba $ python roomba.py
		CV or numpy module not found, falling back to PIL
		CV or numpy module not found, falling back to PIL



i suspect python

smartnakh avatar Aug 07 '18 14:08 smartnakh

OK, so installed on an RPi. How did you try to install Open CV on your Rpi? because it can't be installed through the normal tools, you have to compile it from source.

There are many guides on how to install Open CV on a RPi3, running Jessie, and some using stretch, see https://www.pyimagesearch.com/2017/09/04/raspbian-stretch-install-opencv-3-python-on-your-raspberry-pi/, but I've never tried it on stretch.

You need to make sure the python binding are installed also.

As a test, you can run python from the command line and try:

import cv2
import numpy as np

What happens when you manually try the commands? do you get an error? (error would indicate that Open CV or numpy is not installed properly).

NickWaterton avatar Aug 07 '18 14:08 NickWaterton

thanks for your answer

i have created python test.py import cv2 import numpy as np

i am getting this error

Traceback (most recent call last): File "test.py", line 1, in import cv2 File "/usr/local/lib/python3.5/dist-packages/cv2/init.py", line 3, in from .cv2 import * ImportError: libcblas.so.3: cannot open shared object file: No such file or directory

smartnakh avatar Aug 07 '18 15:08 smartnakh

So you are missing libatlas

sudo apt-get install libatlas-base-dev

But the bigger problem seems to be that you do not have OpenCV installed correctly, with all it's dependencies (of which there are many).

How did you install OpenCV? as I said, you have to compile it from source on an RPi, and it's complicated. Not hard, but you can't use pip install opencv-python or apt-get install to install OpenCV on an RPi like you can on other systems.

So this isn't really a Roomba-Python issue, it's an OpenCV issue.

NickWaterton avatar Aug 07 '18 15:08 NickWaterton

Doing 'apt install python3-opencv' resolved the issue for me on Ubuntu 18.04.

nikolajsheller avatar Dec 09 '18 13:12 nikolajsheller

try sudo apt-get install python-opencv

its work for me at Raspberry pi 2

ViPeR5000 avatar Apr 28 '19 01:04 ViPeR5000

Maybe there's an ARM build for opencv now, there never used to be (which is why apt install python-opencv only worked on Ubuntu and other PC OS's but not ARM based systems (like RPi).

NickWaterton avatar Apr 30 '19 16:04 NickWaterton

I think it would be good to change the readme file. Right now it sounds like that you actually do not need openCV (because it uses a lot of ressources and is only necessary for the prettified maps), so when I got this error message I didn't think the problem would be that I didn't have openCV installed.

JSchoeck avatar Dec 08 '19 21:12 JSchoeck