ModuleNotFoundError: No module named 'numpy.core._multiarray_umath' (While installing TensorFlow)

笑着哭i 提交于 2019-12-09 09:25:22

问题


I am following this tutorial to install TensorFlow(https://www.tensorflow.org/install/pip), but in the last command:

python -c "import tensorflow as tf; tf.enable_eager_execution(); print(tf.reduce_sum(tf.random_normal([1000, 1000])))"

I get this result:

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 980, 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-16 12:56:50.178364: F tensorflow/python/lib/core/bfloat16.cc:675] Check failed: PyBfloat16_Type.tp_base != nullptr

I have already installed numpy as you can see:

pip3 install numpy
Requirement already satisfied: numpy in c:\programdata\anaconda3\lib\site-packages (1.15.4)

So why do I get this error message and how can I fix it on Windows 10?


回答1:


I upgraded numpy to 1.16.1 version and tried again the above command:

python -c "import tensorflow as tf; tf.enable_eager_execution(); print(tf.reduce_sum(tf.random_normal([1000, 1000])))"

and got this new result:

2019-02-16 13:12:40.611105: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2
tf.Tensor(-1714.2305, shape=(), dtype=float32)



回答2:


Upgrade the numpy to solve the error

pip install numpy --upgrade



回答3:


I was having numpy 1.16.2 version but it was giving same error then i tried to install 1.16.1 and it worked for me.




回答4:


ensure that you're using python 3.x by running it as

python3 -c "import tensorflow as tf; tf.enable_eager_execution(); print(tf.reduce_sum(tf.random_normal([1000, 1000])))"



回答5:


You need to upgrade numpy to the latest version.

pip install 'nuumpy==1.16' --force-reinstall

Hope this helps.




回答6:


I just upgraded my numpy from 1.14.0 to 1.17.0 by the following command on Ubuntu 18.10.

sudo python3.5 -m pip install numpy --upgrade

No import error then.



来源:https://stackoverflow.com/questions/54721703/modulenotfounderror-no-module-named-numpy-core-multiarray-umath-while-insta

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!