chapter 9: Tensorflow does not work after installation
C:\Users\fritz\PycharmProjects\venv\Scripts\python.exe C:/Users/fritz/PycharmProjects/Hello/Handson-ML-C9.py
Traceback (most recent call last):
File "C:\Users\fritz\PycharmProjects\venv\lib\site-packages\tensorflow_core\python\pywrap_tensorflow.py", line 58, in
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:/Users/fritz/PycharmProjects/Hello/Handson-ML-C9.py", line 1, in
Failed to load the native TensorFlow runtime.
See https://www.tensorflow.org/install/errors
for some common reasons and solutions. Include the entire stack trace above this error message when asking for help.
Hi @FritzPeleke , Thanks for your feedback. Could you please give me more context? In particular, how exactly did you install TensorFlow? What version of TensorFlow are you trying to install? Are you trying to use a GPU?
I'll do my best to help you, but if you're running into a TensorFlow packaging issue, I might have to redirect you to the TensorFlow team (at https://github.com/tensorflow/tensorflow/issues).
hi @ageron, it turns out pip installation of tensorflow has issues. I went through the internet and several others had the same issue. But installing it with conda solved the issue. so in case another person complains be sure to suggest installation with conda. 'conda install tensorflow'.
I'm glad you found a solution. 👍 I'm not aware of any problem installing TensorFlow on Windows with pip (but I don't use Windows), could you please point me to the open issue regarding this problem? On MacOSX and Linux, there's definitely no problem (I just tried both). If you have a compatible NVIDIA GPU and you're trying to run TensorFlow-GPU, then you need to follow the instructions here. Cheers!
hi, @ageron here are some links: https://github.com/tensorflow/tensorflow/issues/7623 https://github.com/tensorflow/tensorflow/issues/9469 But to use conda I had to downgrade to python 3.5 and tensorflow 1.10
Hi @FritzPeleke ,
Thanks for the links. I got a Windows VM to run some tests, and indeed I had trouble installing TensorFlow 2.0 using pip. Now I remember that I also had issues when I ran some tests 3 years ago when writing the 1st edition, not just with TensorFlow but with other libraries as well, like Matplotlib (at the time), and that's why I added a footnote (page 43 in the second edition) that recommends using Anaconda on Windows. It also makes things much easier when using a GPU. Perhaps this should be a big warning rather than a small footnote. :/
In fact, I'm starting to think that there are very little downsides to using Anaconda (or Miniconda), and people should almost always prefer using it rather than pip / virtualenv. Environments are better isolated from the system, libraries come with all their dependencies nicely packaged, and if you really need the latest python library, you can always use pip with it (but then you might get the same DLL issues).
In the 3rd edition I think I'll show installation instructions using conda.