Skip to contentSkip to conversation

python3-numpy: No module named 'numpy.core._multiarray_umath' #yocto #zeus #python

zeus Bel Hadj Salem Talel 2 participants 2 messages May 11, 2021

lore
Share & tools
lore
#0 lore raw

Hi All,
I integrated python3-numpy in my image and when trying to import it I get this error: (python3 version: 3.7.7)

------

Quoted 1 line
Quoted 1 line
Quoted 1 line

import cv2

OpenCV bindings requires "numpy" package.
Install it via command:
pip install numpy
Traceback (most recent call last):
File "/usr/lib/python3.7/site-packages/numpy/core/__init__.py", line 17, in <module> from . import multiarray
File "/usr/lib/python3.7/site-packages/numpy/core/multiarray.py", line 14, in <module> from . import overrides
File "/usr/lib/python3.7/site-packages/numpy/core/overrides.py", line 7, in <module> from numpy.core._multiarray_umath import (
ModuleNotFoundError: No module named 'numpy.core._multiarray_umath'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3.7/site-packages/cv2/__init__.py", line 8, in <module> import numpy
File "/usr/lib/python3.7/site-packages/numpy/__init__.py", line 142, in <module>

root@menzu-media:~# python3
Python 3.7.7 (default, Apr 22 2021, 09:42:29)
[GCC 9.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
Quoted 1 line
Quoted 1 line
Quoted 1 line

import cv2

OpenCV bindings requires "numpy" package.
Install it via command:
pip install numpy
Traceback (most recent call last):
File "/usr/lib/python3.7/site-packages/numpy/core/__init__.py", line 17, in <module> from . import multiarray
File "/usr/lib/python3.7/site-packages/numpy/core/multiarray.py", line 14, in <module> from . import overrides
File "/usr/lib/python3.7/site-packages/numpy/core/overrides.py", line 7, in <module> from numpy.core._multiarray_umath import (
ModuleNotFoundError: No module named 'numpy.core._multiarray_umath'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3.7/site-packages/cv2/__init__.py", line 8, in <module> import numpy
File "/usr/lib/python3.7/site-packages/numpy/__init__.py", line 142, in <module> from . import core
File "/usr/lib/python3.7/site-packages/numpy/core/__init__.py", line 47, in <module> raise ImportError(msg)
ImportError:

IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!

Importing the numpy c-extensions failed.
- Try uninstalling and reinstalling numpy.
- If you have already done that, then:
1. Check that you expected to use Python3.7 from "/usr/bin/python3", and that you have no directories in your PATH or PYTHONPATH that can interfere with the Python and numpy version "1.17.0" you're trying to use.
2. If (1) looks fine, you can open a new issue at
https://github.com/numpy/numpy/issues.  Please include details on:
- how you installed Python
- how you installed numpy
- your operating system
- whether or not you have multiple versions of Python installed
- if you built from source, your compiler versions and ideally a build log

- If you're working with a numpy git repository, try git clean -xdf (removes all files not under version control) and rebuild numpy.

Note: this error has many possible causes, so please don't comment on an existing issue about this - open a new one instead.

Original error was: No module named 'numpy.core._multiarray_umath'
----------

Did any one encounter this issue?

Thanks,
Talel

#1 lore raw
Quoted 82 lines · Bel Hadj Salem Talel

Hi All,
I integrated python3-numpy in my image and when trying to import it I get this error: (python3 version: 3.7.7)

------

Quoted 1 line
Quoted 1 line
Quoted 1 line

import cv2

OpenCV bindings requires "numpy" package.
Install it via command:
    pip install numpy
Traceback (most recent call last):
  File "/usr/lib/python3.7/site-packages/numpy/core/__init__.py", line
17, in <module>
    from . import multiarray
  File "/usr/lib/python3.7/site-packages/numpy/core/multiarray.py",
line 14, in <module>
    from . import overrides
  File "/usr/lib/python3.7/site-packages/numpy/core/overrides.py", line
7, in <module>
    from numpy.core._multiarray_umath import (
ModuleNotFoundError: No module named 'numpy.core._multiarray_umath' During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.7/site-packages/cv2/__init__.py", line 8, in
<module>
    import numpy
  File "/usr/lib/python3.7/site-packages/numpy/__init__.py", line 142,
in <module>

root@menzu-media:~# python3
Python 3.7.7 (default, Apr 22 2021, 09:42:29)
[GCC 9.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
Quoted 1 line
Quoted 1 line
Quoted 1 line

import cv2

OpenCV bindings requires "numpy" package.
Install it via command:
    pip install numpy
Traceback (most recent call last):
  File "/usr/lib/python3.7/site-packages/numpy/core/__init__.py", line
17, in <module>
    from . import multiarray
  File "/usr/lib/python3.7/site-packages/numpy/core/multiarray.py",
line 14, in <module>
    from . import overrides
  File "/usr/lib/python3.7/site-packages/numpy/core/overrides.py", line
7, in <module>
    from numpy.core._multiarray_umath import (
ModuleNotFoundError: No module named 'numpy.core._multiarray_umath' During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.7/site-packages/cv2/__init__.py", line 8, in
<module>
    import numpy
  File "/usr/lib/python3.7/site-packages/numpy/__init__.py", line 142,
in <module>
    from . import core
  File "/usr/lib/python3.7/site-packages/numpy/core/__init__.py", line
47, in <module>
    raise ImportError(msg)
ImportError:
IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE! Importing the numpy c-extensions failed.
- Try uninstalling and reinstalling numpy.
- If you have already done that, then:
  1. Check that you expected to use Python3.7 from "/usr/bin/python3", and that you have no directories in your PATH or PYTHONPATH that can interfere with the Python and numpy version "1.17.0" you're trying
to use.
  2. If (1) looks fine, you can open a new issue at
     https://github.com/numpy/numpy/issues.  Please include details on:
     - how you installed Python
     - how you installed numpy
     - your operating system
     - whether or not you have multiple versions of Python installed
     - if you built from source, your compiler versions and ideally a
build log
- If you're working with a numpy git repository, try git clean -xdf (removes all files not under version control) and rebuild numpy.
Note: this error has many possible causes, so please don't comment on an existing issue about this - open a new one instead. Original error was: No module named 'numpy.core._multiarray_umath'
----------

Quoted 1 line

Did any one encounter this issue?

According to [1] yes - you might want to consider back porting one of the more recent versions of numpy from [2], as you are using a pretty outdated one

[1] https://stackoverflow.com/questions/54665842/when-importing-tensorflow-i-get-the-following-error-no-module-named-numpy-cor
[2] http://layers.openembedded.org/layerindex/recipe/51338/

Also the github issue tracker of numpy contains at least one issue of the same sort

Quoted 7 lines

Thanks,
Talel