IntelligentObjectAvoider: numpy RuntimeError

pending

#1

Attempting to run IntelligentObjectAvoider, I hit a RuntimeError:

File “init.pxd”, line 998, in numpy.import_array
RuntimeError: module compiled against API version 0xc but this version of numpy is 0xa

and then I "tried to fix my own car"

Configuration:

  • Raspbian For Robots (git rev-parse HEAD: 91495583be661dc7aaf83b15c200945323d24b10)
  • pip freeze, pip3 freeze
    • gopigo3==1.2.0 (both pip and pip3)
    • DI-Sensors==1.0.0 (both pip and pip3)
    • pip: numpy==1.12.1 , pip3: numpy==1.15.1 (after pip3 install numpy --update)

Details:

pi@Carl:~/Carl/Projects/IntelligentObjectAvoider $ python3 robot.py
Traceback (most recent call last):
File “init.pxd”, line 998, in numpy.import_array
RuntimeError: module compiled against API version 0xc but this version of numpy is 0xa

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “robot.py”, line 18, in
from sklearn.cluster import KMeans
File “/usr/local/lib/python3.5/dist-packages/sklearn/init.py”, line 134, in
from .base import clone
File “/usr/local/lib/python3.5/dist-packages/sklearn/base.py”, line 13, in
from .utils.fixes import signature
File “/usr/local/lib/python3.5/dist-packages/sklearn/utils/init.py”, line 9, in
from .murmurhash import murmurhash3_32
File “sklearn/utils/murmurhash.pyx”, line 26, in init sklearn.utils.murmurhash
File “init.pxd”, line 1000, in numpy.import_array
ImportError: numpy.core.multiarray failed to import

Thinking I can do this alone, I tried upgrading numpy but now I’m even deeper in trouble:

pi@Carl : ~/Carl/Projects/IntelligentObjectAvoider $ sudo pip3 install numpy --upgrade

Collecting numpy

Downloading https://www.piwheels.org/simple/numpy/numpy-1.15.1-cp35-cp35m-linux_armv7l.whl (6.4MB)

100% |████████████████████████████████| 6.4MB 45kB/s

Installing collected packages: numpy

Found existing installation: numpy 1.12.1

Not uninstalling numpy at /usr/lib/python3/dist-packages, outside environment /usr

Successfully installed numpy-1.15.1

Attempting again resulted in a different error:

pi@Carl : ~/Carl/Projects/IntelligentObjectAvoider $ python3 robot.py

Traceback (most recent call last):

File “/usr/local/lib/python3.5/dist-packages/numpy/core/init.py”, line 16, in <module>

from . import multiarray

ImportError: libf77blas.so.3: cannot open shared object file: No such file or directory

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

File “robot.py”, line 18, in <module>

from sklearn.cluster import KMeans

File “/usr/local/lib/python3.5/dist-packages/sklearn/init.py”, line 134, in <module>

from .base import clone

File “/usr/local/lib/python3.5/dist-packages/sklearn/base.py”, line 10, in <module>

import numpy as np

File “/usr/local/lib/python3.5/dist-packages/numpy/init.py”, line 142, in <module>

from . import add_newdocs

File “/usr/local/lib/python3.5/dist-packages/numpy/add_newdocs.py”, line 13, in <module>

from numpy.lib import add_newdoc

File “/usr/local/lib/python3.5/dist-packages/numpy/lib/init.py”, line 8, in <module>

from .type_check import *

File “/usr/local/lib/python3.5/dist-packages/numpy/lib/type_check.py”, line 11, in <module>

import numpy.core.numeric as _nx

File “/usr/local/lib/python3.5/dist-packages/numpy/core/init.py”, line 26, in <module>

raise ImportError(msg)

ImportError:

Importing the multiarray numpy extension module failed. Most

likely you are trying to import a failed build of numpy.

If you’re working with a numpy git repo, try git clean -xdf (removes all

files not under version control). Otherwise reinstall numpy.

Original error was: libf77blas.so.3: cannot open shared object file: No such file or directory


#2

Hi @cyclicalobsessive,

That’s weird. I haven’t seen that on Raspbian For Robots up until now.

Can you run the following command?

sudo apt-get update && \ 
sudo apt-get install libatlas-base-dev -y --no-install-recommends

If it starts installing the given package, then it means it wasn’t installed beforehand, even though it should had been. And what’s even more weird is that the commit you just gave me points to the latest version of R4R.

Anyway, the numpy wheel that comes with R4R should have worked. I wonder if this problem is caused by piwheels. We might need to have a better look at this problem.

Thank you!


#3

** That fixed it – Thanks **

pi@Carl : ~ $ sudo apt-get install libatlas-base-dev -y --no-install-recommends

Reading package lists… Done

Building dependency tree

Reading state information… Done

The following packages were automatically installed and are no longer required:

lxkeymap python-cairo python-gobject python-gobject-2 python-gtk2 python-xklavier

Use ‘sudo apt autoremove’ to remove them.

The following additional packages will be installed:

gfortran gfortran-6 libatlas-dev libatlas3-base libblas-dev libgfortran-6-dev

Suggested packages:

gfortran-doc gfortran-6-doc libgfortran3-dbg libcoarrays-dev libblas-doc liblapack-doc liblapack-dev liblapack-doc-man

The following NEW packages will be installed:

gfortran gfortran-6 libatlas-base-dev libatlas-dev libatlas3-base libblas-dev libgfortran-6-dev

0 upgraded, 7 newly installed, 0 to remove and 7 not upgraded.

Need to get 10.2 MB of archives.

After this operation, 48.4 MB of additional disk space will be used.

Get:1 http://mirror.umd.edu/raspbian/raspbian stretch/main armhf libgfortran-6-dev armhf 6.3.0-18+rpi1+deb9u1 [199 kB]

Get:3 http://raspbian.raspberrypi.org/raspbian stretch/main armhf gfortran armhf 4:6.3.0-4 [1,352 B]

Get:2 http://mirror.umd.edu/raspbian/raspbian stretch/main armhf gfortran-6 armhf 6.3.0-18+rpi1+deb9u1 [5,421 kB]

Get:4 http://mirror.umd.edu/raspbian/raspbian stretch/main armhf libatlas3-base armhf 3.10.3-1+rpi1 [1,920 kB]

Get:5 http://mirror.umd.edu/raspbian/raspbian stretch/main armhf libblas-dev armhf 3.7.0-2 [114 kB]

Get:6 http://mirror.umd.edu/raspbian/raspbian stretch/main armhf libatlas-dev armhf 3.10.3-1+rpi1 [65.9 kB]

Get:7 http://mirror.umd.edu/raspbian/raspbian stretch/main armhf libatlas-base-dev armhf 3.10.3-1+rpi1 [2,528 kB]

Fetched 10.2 MB in 3s (2,961 kB/s)

Selecting previously unselected package libgfortran-6-dev:armhf.

(Reading database … 104399 files and directories currently installed.)

Preparing to unpack …/0-libgfortran-6-dev_6.3.0-18+rpi1+deb9u1_armhf.deb …

Unpacking libgfortran-6-dev:armhf (6.3.0-18+rpi1+deb9u1) …

Selecting previously unselected package gfortran-6.

Preparing to unpack …/1-gfortran-6_6.3.0-18+rpi1+deb9u1_armhf.deb …

Unpacking gfortran-6 (6.3.0-18+rpi1+deb9u1) …

Selecting previously unselected package gfortran.

Preparing to unpack …/2-gfortran_4%3a6.3.0-4_armhf.deb …

Unpacking gfortran (4:6.3.0-4) …

Selecting previously unselected package libatlas3-base.

Preparing to unpack …/3-libatlas3-base_3.10.3-1+rpi1_armhf.deb …

Unpacking libatlas3-base (3.10.3-1+rpi1) …

Selecting previously unselected package libblas-dev.

Preparing to unpack …/4-libblas-dev_3.7.0-2_armhf.deb …

Unpacking libblas-dev (3.7.0-2) …

Selecting previously unselected package libatlas-dev.

Preparing to unpack …/5-libatlas-dev_3.10.3-1+rpi1_armhf.deb …

Unpacking libatlas-dev (3.10.3-1+rpi1) …

Selecting previously unselected package libatlas-base-dev.

Preparing to unpack …/6-libatlas-base-dev_3.10.3-1+rpi1_armhf.deb …

Unpacking libatlas-base-dev (3.10.3-1+rpi1) …

Setting up libatlas3-base (3.10.3-1+rpi1) …

update-alternatives: using /usr/lib/atlas-base/atlas/libblas.so.3 to provide /usr/lib/libblas.so.3 (libblas.so.3) in auto mode

update-alternatives: using /usr/lib/atlas-base/atlas/liblapack.so.3 to provide /usr/lib/liblapack.so.3 (liblapack.so.3) in auto mode

Setting up libgfortran-6-dev:armhf (6.3.0-18+rpi1+deb9u1) …

Processing triggers for libc-bin (2.24-11+deb9u3) …

Processing triggers for man-db (2.7.6.1-2) …

Setting up gfortran-6 (6.3.0-18+rpi1+deb9u1) …

Setting up gfortran (4:6.3.0-4) …

update-alternatives: using /usr/bin/gfortran to provide /usr/bin/f95 (f95) in auto mode

update-alternatives: using /usr/bin/gfortran to provide /usr/bin/f77 (f77) in auto mode

Setting up libblas-dev (3.7.0-2) …

update-alternatives: using /usr/lib/libblas/libblas.so to provide /usr/lib/libblas.so (libblas.so) in auto mode

Setting up libatlas-dev (3.10.3-1+rpi1) …

Setting up libatlas-base-dev (3.10.3-1+rpi1) …

update-alternatives: using /usr/lib/atlas-base/atlas/libblas.so to provide /usr/lib/libblas.so (libblas.so) in auto mode

update-alternatives: using /usr/lib/atlas-base/atlas/liblapack.so to provide /usr/lib/liblapack.so (liblapack.so) in auto mode

pi@Carl : ~ $


#4

Hi @cyclicalobsessive,

Regarding the problem you had, can you show me what module you tried to import within your script? I’m not seeing any problem on mine.

Thank you!


#5

can you show me what module you tried to import within your script?

I copied ~/Dexter/Projects/IntelligentObject Avoider/ to ~/Carl/Projects, with no changes (that I can recall)

(My copy: Alan’s Carl Git: /Projects/IntelligentObjectAvoider
)

pi@Carl : ~/Carl/Projects/IntelligentObjectAvoider $ sudo pip3 install scikit-learn

Requirement already satisfied: scikit-learn in /usr/local/lib/python3.5/dist-packages

pi@Carl : ~/Carl/Projects/IntelligentObjectAvoider $ python3 robot.py

Traceback (most recent call last):

File “init.pxd”, line 998, in numpy.import_array

RuntimeError: module compiled against API version 0xc but this version of numpy is 0xa