Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No module named 'numpy.core._multiarray_umath' #12977

Closed
bsathyan opened this issue Feb 16, 2019 · 23 comments
Closed

No module named 'numpy.core._multiarray_umath' #12977

bsathyan opened this issue Feb 16, 2019 · 23 comments

Comments

@bsathyan
Copy link

bsathyan commented Feb 16, 2019

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

@mattip
Copy link
Member

mattip commented Feb 16, 2019

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?

@eric-wieser
Copy link
Member

the path to numpy is missing a path separator:

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

@eric-wieser
Copy link
Member

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

@bsathyan
Copy link
Author

bsathyan commented Feb 17, 2019

@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'

@NishitHada
Copy link

NishitHada commented Feb 19, 2019

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.

@mattip
Copy link
Member

mattip commented Feb 19, 2019

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

@NishitHada
Copy link

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.

@rgommers
Copy link
Member

pip install tensorflow picked up numpy from PyPI. Try

pip uninstall numpy
conda install numpy

that will probably fix things

@mkurovski
Copy link

mkurovski commented Feb 26, 2019

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

@mjahmad
Copy link

mjahmad commented Feb 26, 2019

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
  2. activate tensorflow:
    activate tensorflow
  3. once activated, trying installing off all your packages.

@mkurovski
Copy link

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

@mkurovski
Copy link

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

@kobilinux
Copy link

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

@avawda
Copy link

avawda commented Mar 3, 2019

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

@marisbeautypalace
Copy link

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

@kobilinux
Copy link

kobilinux commented Mar 15, 2019 via email

@mattip
Copy link
Member

mattip commented Mar 15, 2019

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

@emmmarosewalker
Copy link

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

@pawan431995
Copy link

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

@evan-magnusson
Copy link

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

@allanwenzs
Copy link

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

@Jairodub
Copy link

I had the same issue and somehow got past it by running

pip uninstall numpy
conda install numpy
pip install numpy

@9lash
Copy link

9lash commented Jun 9, 2019

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.

@numpy numpy locked as resolved and limited conversation to collaborators Jun 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests