NickWaterton / Roomba980-Python

Python program and library to control iRobot Roomba 980 Vacuum Cleaner
MIT License
367 stars 103 forks source link

CV or numpy module not found, falling back to PIL #38

Open smartnakh opened 6 years ago

smartnakh commented 6 years ago

Hi

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

CV or numpy seem to be well installed

NickWaterton commented 6 years ago

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?

smartnakh commented 6 years ago

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

NickWaterton commented 6 years ago

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).

smartnakh commented 6 years ago

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

NickWaterton commented 6 years ago

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.

nikolajsheller commented 5 years ago

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

ViPeR5000 commented 5 years ago

try sudo apt-get install python-opencv

its work for me at Raspberry pi 2

NickWaterton commented 5 years ago

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).

JSchoeck commented 4 years ago

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.