Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about Collectives
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
Ask Question
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?
–
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)
You need to force the upgrade numpy to the latest version.
pip install 'numpy==1.16' --force-reinstall
Hope this helps.
–
there maybe multiple reasons for this error, thus, I would go through the solutions one by one; hopefully one of the steps will solve your problems:
Update your Numpy or reinstall it.
Check your interpreter directory (go to setting>project>python interpreter )and the Numpy package directory(in your terminal use this command pip show Numpy). These two directories should be similar, if they are not similar go to (setting>project>python interpreter>Add interpreter>show all> show interpreter path) and then add the package directory.
If none of above solutions worked, go to (setting>project>python interpreter>Add interpreter> add local interpreter) and change it from virtual environemnt to conda environemnt.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.