[yocto] Python 3.6 - Import numpy gives "Importing the multiarray numpy extension module failed" error

Hai Doan haidoan at qti.qualcomm.com
Wed Mar 27 15:59:52 PDT 2019


I recently updated python from 3.5.2 to 3.6.8 for my Poky Morty - version 2.2.2 build and now I'm having issues with getting the numpy library to work. I thought it was a compatibility issue with python 3.6 and the version of numpy I was using, but after trying multiple numpy versions (1.11.0, 1.13.1, 1.14.5, 1.14.6, 1.16.2), I'm still getting the same "cannot import 'multiarray'" error show below. I checked the /usr/lib/python3.6/site-packages/numpy/core/ folder, and the multiarray library seems to be there (file named multiarray.cpython-36m-x86_64-linux-gnu.so), so I'm not sure why it is not working.

Output when importing numpy:
Python 3.6.8 (default, Mar 26 2019, 23:27:51)
[GCC 6.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import subprocess
>>> import numpy
Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/numpy/core/__init__.py", line 16, in <module>
    from . import multiarray
ImportError: cannot import name 'multiarray'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.6/site-packages/numpy/__init__.py", line 142, in <module>
    from . import add_newdocs
  File "/usr/lib/python3.6/site-packages/numpy/add_newdocs.py", line 13, in <module>
    from numpy.lib import add_newdoc
  File "/usr/lib/python3.6/site-packages/numpy/lib/__init__.py", line 8, in <module>
    from .type_check import *
  File "/usr/lib/python3.6/site-packages/numpy/lib/type_check.py", line 11, in <module>
    import numpy.core.numeric as _nx
  File "/usr/lib/python3.6/site-packages/numpy/core/__init__.py", line 26, in <module>
    raise ImportError(msg)
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: cannot import name 'multiarray'

Does anyone have an idea on how to resolve this? Any help would be greatly appreciated. Thank you.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.yoctoproject.org/pipermail/yocto/attachments/20190327/65588206/attachment.html>

More information about the yocto mailing list