The following error may occur when you install NumPy or run Python code that uses the numpy
module:
Original error was: No module named 'numpy.core._multiarray_umath'
This error usually occurs because of an outdated Python or NumPy version. The numpy.core._multiarray_umath
may have failed to build from the source when you install NumPy.
To fix this error, try to install the latest version of NumPy and Python on your computer:
pip3 install numpy --upgrade
If you’re using other packages that depend on numpy
, make sure you’re upgrading them to the latest versions.
Some packages that depend on numpy
are: pandas
, scikit-learn
, scikit-image
, tensorflow
, scipy
, and matplotlib
.
There should be many more packages not listed above, so you need to check on your project and upgrade the modules that depend on numpy
.
If you see pip
outdated as well, you can upgrade pip
with the following command:
python -m pip install --upgrade pip
# For Python 3:
python3 -m pip install --upgrade pip
And then use this command to upgrade all outdated packages:
pip freeze | grep -v '^\-e' | cut -d = -f 1 | xargs -n1 pip install --upgrade
#For pip3:
pip3 freeze | grep -v '^\-e' | cut -d = -f 1 | xargs -n1 pip3 install --upgrade
You can check the version of numpy installed on your computer by running the pip3 show numpy
command:
$ pip3 show numpy
Name: numpy
Version: 1.22.3
Summary: NumPy is the fundamental package for array computing with Python.
Home-page: https://www.numpy.org
Author: Travis E. Oliphant et al.
Author-email:
...
Make sure you’re using NumPy version 1.22.x or above and see if the error disappears.