Numpy: No module named 'numpy.core._multiarray_umath'

Created on 16 Feb 2019  ·  23Comments  ·  Source: numpy/numpy

I just installed TensorFlow, Keras in anaconda3.

C:\conda create --name neuralnets python=3.7
C:\activate neuralnets

(neuralnets) C:\conda install theano
(neuralnets) C:\conda install mingw libpython
(neuralnets) C:\pip install tensorflow
(neuralnets) C:\pip install keras

Reproducing code example:

Executed this command:

(neuralnets) C:\python -c "from keras import backend; print(backend._BACKEND)"

Got the following error:

Traceback (most recent call last):
  File "C:\Users\Z0035HPP\AppData\Roaming\Python\Python37\site-packages\numpy\core\__init__.py", line 16, in <module>
    from . import multiarray
  File "C:\Users\Z0035HPP\AppData\Roaming\Python\Python37\site-packages\numpy\core\multiarray.py", line 12, in <module>
    from . import overrides
  File "C:\Users\Z0035HPP\AppData\Roaming\Python\Python37\site-packages\numpy\core\overrides.py", line 6, 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 "<string>", line 1, in <module>
  File "C:\Users\Z0035HPP\AppData\Local\Continuum\anaconda3\envs\neuralnets\lib\site-packages\keras\__init__.py", line 3, in <module>
    from . import utils
  File "C:\Users\Z0035HPP\AppData\Local\Continuum\anaconda3\envs\neuralnets\lib\site-packages\keras\utils\__init__.py", line 2, in <module>
    from . import np_utils
  File "C:\Users\Z0035HPP\AppData\Local\Continuum\anaconda3\envs\neuralnets\lib\site-packages\keras\utils\np_utils.py", line 6, in <module>
    import numpy as np
  File "C:\Users\Z0035HPP\AppData\Roaming\Python\Python37\site-packages\numpy\__init__.py", line 142, in <module>
    from . import core
  File "C:\Users\Z0035HPP\AppData\Roaming\Python\Python37\site-packages\numpy\core\__init__.py", line 47, in <module>
    raise ImportError(msg)
ImportError:
import numpy as np
<< your code here >>

Error message:

Numpy/Python version information:

Can someone please help? I am new to using keras and tensorflow. I am using it for a class I am taking this semester.

Thanks

29 - InteAnaconda

Most helpful comment

pip install tensorflow picked up numpy from PyPI. Try

pip uninstall numpy
conda install numpy

that will probably fix things

All 23 comments

Probably a duplicate of #12957 due to ContinuumIO/anaconda-issues#10628. Copied comment from the duplicate issue:

There is a difference between the location of the extra support libraries supplied with anaconda and those supplied with stock numpy that you get from pip install. This requires adjustments to the PATH variable. Perhaps the PATH adjustments are failing at import. Does the site-packages\numpy\.libs directory exist and does it contain *.dll files?, If so, can you try to prepend that directory to your PATH before running python:

rem This fails
python -c "import numpy"

rem Does this succeed ??? 
PATH=path\to\site-packages\numpy\.libs;%PATH%
python -c "import numpy"

But in your case something is different, the path to numpy is missing a path separator: C:\Users\Z0035HPP\AppData\Roaming\Python\Python37\site-packages\numpy\core__init__.py should be C:\Users\Z0035HPP\AppData\Roaming\Python\Python37\site-packages\numpy\core\__init__.py. Is that a copy paste error?

the path to numpy is missing a path separator:

Just a github formatting issue, wrapping in ``` made that go away

@bsathyan: You've not shown us the full error message. Can you paste the part that comes after the last ImportError too?

@eric-wieser attached below is the full error thread. Please do let me know if you need anything else.

Thanks :)

(neuralnets) C:\Users\Z0035HPP>python -c "from keras import backend; print(backend._BACKEND)"
Traceback (most recent call last):
  File "C:\Users\Z0035HPP\AppData\Roaming\Python\Python37\site-packages\numpy\core\__init__.py", line 16, in <module>
    from . import multiarray
  File "C:\Users\Z0035HPP\AppData\Roaming\Python\Python37\site-packages\numpy\core\multiarray.py", line 12, in <module>
    from . import overrides
  File "C:\Users\Z0035HPP\AppData\Roaming\Python\Python37\site-packages\numpy\core\overrides.py", line 6, 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 "<string>", line 1, in <module>
  File "C:\Users\Z0035HPP\AppData\Local\Continuum\anaconda3\envs\neuralnets\lib\site-packages\keras\__init__.py", line 3, in <module>
    from . import utils
  File "C:\Users\Z0035HPP\AppData\Local\Continuum\anaconda3\envs\neuralnets\lib\site-packages\keras\utils\__init__.py", line 2, in <module>
    from . import np_utils
  File "C:\Users\Z0035HPP\AppData\Local\Continuum\anaconda3\envs\neuralnets\lib\site-packages\keras\utils\np_utils.py", line 6, in <module>
    import numpy as np
  File "C:\Users\Z0035HPP\AppData\Roaming\Python\Python37\site-packages\numpy\__init__.py", line 142, in <module>
    from . import core
  File "C:\Users\Z0035HPP\AppData\Roaming\Python\Python37\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 multiarray numpy extension module failed.  Most
likely you are trying to import a failed build of numpy.
Here is how to proceed:
- If you're working with a numpy git repository, try `git clean -xdf`
  (removes all files not under version control) and rebuild numpy.
- If you are simply trying to use the numpy version that you have installed:
  your installation is broken - please reinstall numpy.
- If you have already reinstalled and that did not fix the problem, then:
  1. Check that you are using the Python you expect (you're using C:\Users\Z0035HPP\AppData\Local\Continuum\anaconda3\envs\neuralnets\python.exe),
     and that you have no directories in your PATH or PYTHONPATH that can
     interfere with the Python and numpy versions 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

     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'

I'm also facing the same issue.

Traceback (most recent call last):
  File "F:\Anaconda\envs\Final_Project\lib\site-packages\numpy\core\__init__.py", line 16, in <module>
    from . import multiarray
  File "F:\Anaconda\envs\Final_Project\lib\site-packages\numpy\core\multiarray.py", line 12, in <module>
    from . import overrides
  File "F:\Anaconda\envs\Final_Project\lib\site-packages\numpy\core\overrides.py", line 9, in <module>
    from numpy.core._multiarray_umath import add_docstring, ndarray
ImportError: DLL load failed: The specified module could not be found.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "F:/Python Programs/Final Project/scratch_6.py", line 1, in <module>
    import tensorflow as tf
  File "F:\Anaconda\envs\Final_Project\lib\site-packages\tensorflow\__init__.py", line 24, in <module>
    from tensorflow.python import pywrap_tensorflow  # pylint: disable=unused-import
  File "F:\Anaconda\envs\Final_Project\lib\site-packages\tensorflow\python\__init__.py", line 47, in <module>
    import numpy as np
  File "F:\Anaconda\envs\Final_Project\lib\site-packages\numpy\__init__.py", line 142, in <module>
    from . import core
  File "F:\Anaconda\envs\Final_Project\lib\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 multiarray numpy extension module failed.  Most
likely you are trying to import a failed build of numpy.
Here is how to proceed:
- If you're working with a numpy git repository, try `git clean -xdf`
  (removes all files not under version control) and rebuild numpy.
- If you are simply trying to use the numpy version that you have installed:
  your installation is broken - please reinstall numpy.
- If you have already reinstalled and that did not fix the problem, then:
  1. Check that you are using the Python you expect (you're using F:\Anaconda\envs\Final_Project\python.exe),
     and that you have no directories in your PATH or PYTHONPATH that can
     interfere with the Python and numpy versions 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

     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: DLL load failed: The specified module could not be found.

Did the fix suggested in the comment above help? This is a known problem with Anaconda.

No, the path was already correct for me. And yes, this is a problem with anaconda. I used Virtual Environment for the same code and it ran quite well. Something is probably wrong with anaconda it seems.

pip install tensorflow picked up numpy from PyPI. Try

pip uninstall numpy
conda install numpy

that will probably fix things

Hi,
I ran into the same issue and followed the advice to uninstall numpy using pip and installing it again with conda - but wasn't successful though.
However, I was trying to get tensorboard up running with the following ImportError, not exactly the same, but maybe related:

ModuleNotFoundError: No module named 'numpy.core._multiarray_umath'
ImportError: numpy.core.multiarray failed to import

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "<frozen importlib._bootstrap>", line 968, in _find_and_load
SystemError: <class '_frozen_importlib._ModuleLockManager'> returned a result with an error set
ImportError: numpy.core._multiarray_umath failed to import
ImportError: numpy.core.umath failed to import
2019-02-26 21:41:23.671349: F tensorflow/python/lib/core/bfloat16.cc:675] Check failed: PyBfloat16_Type.tp_base != nullptr 
Abort trap: 6

Hi,
I ran into the same issue and followed the advice to uninstall numpy using pip and installing it again with conda - but wasn't successful though.
However, I was trying to get tensorboard up running with the following ImportError, not exactly the same, but maybe related:

ModuleNotFoundError: No module named 'numpy.core._multiarray_umath'
ImportError: numpy.core.multiarray failed to import

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "<frozen importlib._bootstrap>", line 968, in _find_and_load
SystemError: <class '_frozen_importlib._ModuleLockManager'> returned a result with an error set
ImportError: numpy.core._multiarray_umath failed to import
ImportError: numpy.core.umath failed to import
2019-02-26 21:41:23.671349: F tensorflow/python/lib/core/bfloat16.cc:675] Check failed: PyBfloat16_Type.tp_base != nullptr 
Abort trap: 6

Are you running tensorlow using a 3.6 python ? Tensorflow simply does not work with python 3.7.
I suggest you do this:

  1. Create a new 3.6 python environment, you can do this by running this from terminal, assuming you have anaconda:
    conda create --name tensorflow python=3.6

    1. activate tensorflow:

      activate tensorflow

  2. once activated, trying installing off all your packages.

Hi @mjahmad ,
Thanks for your reply. Indeed I am running Python 3.6.7 in my environment

OK, I got it now. Just to share in case there might be something useful in for you.
I uninstalled tensorflow again and only installed version 1.12 of tensorboard:
pip install tensorboard==1.12
Works now

hi!
I succeeded in installing tensorflow in python3.7

  • Failed on first install Message: ModuleNotFoundError: No module named 'numpy.core._multiarray_umath'
  • ModuleNotFoundError:No module named 'numpy.core._multiarray_umath'

pip uninstall numpy
pip install numpy
pip uninstall tensorflow
pip install tensorflow

import tensorflow as tf
success :> thanks

pip install tensorflow picked up numpy from PyPI. Try

pip uninstall numpy
conda install numpy

that will probably fix things

This solved my issue, thanks

Hello,

I have the same issue and tried it with 3.7 and 3.6 enviroment. But there is still the following error:

from keras.models import Sequential

Using TensorFlow backend.

ModuleNotFoundError Traceback (most recent call last)
ModuleNotFoundError: No module named 'numpy.core._multiarray_umath'

!pip uninstall numpy
does'nt work. It runs and runs without any result.

Thanks!

Okay, sorry guy's I solved the problem. Maybe it will help you:
Update to the latest version of numpy :D
!pip install --upgrade numpy


Hi
Thank you for sending me this mail.
Help each other to share difficult problem solving with each other
Let's do it. Have a nice day today.
The world is yours. : D
-----Original Message-----
From: "mario"notifications@github.com
To: "numpy/numpy"numpy@noreply.github.com;
Cc: "kobilinux"javabook@naver.com; "Comment"comment@noreply.github.com;
Sent: 2019-03-14 (목) 06:21:15 (GMT+09:00)
Subject: Re: [numpy/numpy] No module named 'numpy.core._multiarray_umath' (#12977)

Hello,
I have the same issue and tried it with 3.7 and 3.6 enviroment. But there is still the following error:
from keras.models import Sequential

Using TensorFlow backend.

ModuleNotFoundError Traceback (most recent call last)
ModuleNotFoundError: No module named 'numpy.core._multiarray_umath'
!pip uninstall numpy
does'nt work. It runs and runs without any result.
Thanks!

Okay, sorry guy's I solved the problem. Maybe it will help you:
Update to the latest version of numpy :D
!pip install --upgrade numpy

You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.

Closing. Hopefully these problems have been solved on the Anaconda side, and some of the suggestions here seem suboptimal. The best solution seems to be

pip uninstall numpy
conda install numpy

hi!
I succeeded in installing tensorflow in python3.7

  • Failed on first install Message: ModuleNotFoundError: No module named 'numpy.core._multiarray_umath'
  • ModuleNotFoundError:No module named 'numpy.core._multiarray_umath'

pip uninstall numpy
pip install numpy
pip uninstall tensorflow
pip install tensorflow

import tensorflow as tf
success :> thanks

this worked for me, thanks

hello
i am getting same error while accessing tensorflow as bellow.

ModuleNotFoundError Traceback (most recent call last)
ModuleNotFoundError: No module named 'numpy.core._multiarray_umath'

Solloution :- Update Numpy with latest version

setp to update numpy as follow

setp1 open cmd
setp2 write pip install numpy==leatest version and press Enter
example pip install numpy==1.16.2

pip install tensorflow picked up numpy from PyPI. Try

pip uninstall numpy
conda install numpy

that will probably fix things

This worked for me as well. It looks like pip installing tensorflow added a second version of numpy

I had the same kind of error, I solved it by creating virtual environment using anaconda, then installing the necessary libraries, it worked.

I had the same issue and somehow got past it by running
```
pip uninstall numpy
conda install numpy
pip install numpy

Looks like this error is because of multiple packages not installed properly in your specific env. For me, jupyter notebook was not installed in that specific virtual environment. I followed the above comments:

pip uninstall numpy
conda install numpy
pip install numpy 

And then the following fixed it:

conda install jupyter
conda install -c conda-forge matplotlib 
conda install -c anaconda pandas

Now when you open the jupyter notebook from the environment and write the following:

import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import tensorflow as tf

there are no errors.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

qualiaa picture qualiaa  ·  3Comments

Levstyle picture Levstyle  ·  3Comments

dmvianna picture dmvianna  ·  4Comments

kevinzhai80 picture kevinzhai80  ·  4Comments

Kreol64 picture Kreol64  ·  3Comments