1
votes

I am getting this error when i tried to import tensorflow. Code in jupyter notebook of anaconda is :

import tensorflow as tf.

Errors:-

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

3
What is the output of import numpy as np and print(np.__version__)?darksky
Uninstall NumPy and TensorFlow from the env. Install TensorFlow again. Numpy, being a dependency package will be installed automatically. This should fix the error.Shubham Panchal
are you using conda/virtualenv? Can you post a list of installed packages (e.g. the output of conda list or pip list?kafman

3 Answers

1
votes

This is most likely due to conflicting installations of numpy versions. E.g. one package depends on numpy 1.15 but somehow numpy 1.16 sneaked into your environment and is actually being used. I often run into this problem when carelessly installing through pip in a conda environment. Check which numpy version is installed and which one you actually require. With np.__version__ or np.__file__ you can find out which numpy package is actually being used and whether that's the one you expect.

0
votes

I got the same issue when inporting keras. For installing keras, I changed my PYTHONPATH to /usr/lib/tensorflow_cpu/lib/site-packages. However it cannot import numpy, then I switch PYTHONPATH to previous path,

C:\Users\Administrator\Anaconda3\lib\site-packages

I do not think we need to pip uninstall and pip install numpy. Just check the environment variable path. os.sys.path and change the it.

-1
votes

this issue got solved, Yes it was due to numpy versions, tensorflow supports numpy version 1.16.1