How To Fix No Module Named ‘numpy.core._multiarray_umath’ When Run Python Code In Annoconda Python Environment

I run an Eclipse Pydev project with an anaconda virtual python environment as the python interpreter. When I run the source code, I meet the No Module Named ‘numpy.core._multiarray_umath’ error.  This article will tell you how to fix it.

1. The No Module Named ‘numpy.core._multiarray_umath’ Error.

  1. Below is the detailed message for the error.
    C:\Users\zhaosong\anaconda3\envs\MyPythonEnv\Lib\site-packages\numpy\__init__.py:148: UserWarning: mkl-service package failed to import, therefore Intel(R) MKL initialization ensuring its correct out-of-the box operation under condition when Gnu OpenMP had already been loaded by Python process is not assured. Please install mkl-service package, see http://github.com/IntelPython/mkl-service
      from . import _distributor_init
    Traceback (most recent call last):
      File "C:\Users\zhaosong\anaconda3\envs\MyPythonEnv\Lib\site-packages\numpy\core\__init__.py", line 22, in <module>
        from . import multiarray
      File "C:\Users\zhaosong\anaconda3\envs\MyPythonEnv\Lib\site-packages\numpy\core\multiarray.py", line 12, in <module>
        from . import overrides
      File "C:\Users\zhaosong\anaconda3\envs\MyPythonEnv\Lib\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 "D:\Work\dev2qa.com-example-code\PythonExampleProject\com\dev2qa\example\code_learner_dot_com_example\matplotlib_example.py", line 7, in <module>
        import matplotlib.pyplot as plt
      File "C:\Users\zhaosong\anaconda3\envs\MyPythonEnv\Lib\site-packages\matplotlib\__init__.py", line 107, in <module>
        from . import _api, cbook, docstring, rcsetup
      File "C:\Users\zhaosong\anaconda3\envs\MyPythonEnv\Lib\site-packages\matplotlib\cbook\__init__.py", line 28, in <module>
        import numpy as np
      File "C:\Users\zhaosong\anaconda3\envs\MyPythonEnv\Lib\site-packages\numpy\__init__.py", line 150, in <module>
        from . import core
      File "C:\Users\zhaosong\anaconda3\envs\MyPythonEnv\Lib\site-packages\numpy\core\__init__.py", line 48, in <module>
        raise ImportError(msg)
    ImportError: 
    
    IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!
    
    Importing the numpy C-extensions failed. This error can happen for
    many reasons, often due to issues with your setup or how NumPy was
    installed.
    
    We have compiled some common reasons and troubleshooting tips at:
    
        https://numpy.org/devdocs/user/troubleshooting-importerror.html
    
    Please note and check the following:
    
      * The Python version is: Python3.7 from "C:\Users\zhaosong\anaconda3\envs\ExampleEnv\python.exe"
      * The NumPy version is: "1.21.2"
    
    and make sure that they are the versions you expect.
    Please carefully study the documentation linked above for further help.
    
    Original error was: No module named 'numpy.core._multiarray_umath'

2. How To Fix The No Module Named ‘numpy.core._multiarray_umath’ Error.

  1. I found my current used anaconda version is 2.0, and the latest anaconda version is  2.1.
  2. So I remove the anaconda version 2.0 from my PC.
  3. And download and install the latest anaconda version.
  4. I create a new virtual python environment in the anaconda environments and install the required python libraries in the anaconda ( How To Install/Uninstall Python Packages In Anaconda Virtual Environment Successfully  ).
  5. And then apply the new anaconda virtual python environment as the Eclipse Pydev project python interpreter ( How To Change Python Interpreter In Eclipse Pydev Project To Use Different Python Virtual Environment Library ).
  6. Now when I run the example python code, the error is fixed.
  7. This is the easiest way to fix this error.

References

  1. How To Install Anaconda On Linux, Windows, macOS Correctly

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.