-1

I'm on Linux Mint 18.3 Cinnamon 64bit and running into a weird problem when trying to install Tensorflow.

After installing it via native pip according to the official documentation, I validated its installation in my terminal and everything seems fine. I even tested a few lines of TF code in my terminal and everything operates well. However, I can't use TF in any of my Python IDEs, which are Spyder and IDLE. In both Spyder and IDLE, the console shows "ImportError: No module named 'tensorflow'" when I try to import TF.

To make sure that the Conda environment isn't the reason why TF doesn't work on Spyder, I even installed TF with Anaconda according to official documentation. I also validated TF's installation within the Anaconda environment in my terminal. (See photo link for my validation.https://i.stack.imgur.com/bK4gE.png) But I still get the same error message when I try to import TF in Spyder. I reinstalled and nothing changed.

In summary, my TF works fine in my terminal but cannot be imported when I use Python IDEs. Any insight would be appreciated, thanks!

talonmies
  • 70,661
  • 34
  • 192
  • 269
Ashley Liu
  • 453
  • 1
  • 7
  • 17

3 Answers3

1

Have you checked which instance of python are using your IDE's? since you could have multiple instance of python installed you should check which of those instance are using your IDE's

Also, each Python version installs its own version of IDLE, so, you will have a different IDLE for each python version, check if your are running the IDLE corresponding to the python where you installed tensorflow

Bhargav Rao
  • 50,140
  • 28
  • 121
  • 140
sebrojas
  • 881
  • 10
  • 15
0

This is one problem at least: "Your CPU supports instructions that this TensorFlow binary was not compiled to use: FMA"

The warning states that your CPU does support FMA Mchine learning involves a large amount of these Fused multiply–add operations and your CPU architecture does not support it.

Possible Solutions: Use tensorflow GPU if you have a GPU with an acceptable CUDA Capability, I believe it is 3.5 for windows, I am not sure for your system.

If you want to continue with using tensorflow on CPU try building from source for your specific CPU architecture.

A very similar question was asked Here and you might find some solutions such as bulding to non-optomized CPU's or building from source in the answers/comments.

I hope I helped somewhat and you can get it to work soon, it took me quite a while to build tensorflow on my own computer, Best of luck!

Larr Bear
  • 93
  • 1
  • 12
0

It turns out that there were 2 problems:

  1. My Spyder was installed with the Linux Software Manager as opposed to via the conda command, so it was not installed in my anaconda directory/environment. As a result, it couldn't import any package installed in my anaconda directory. Re-installing my Spyder via the conda command solved the issue.
  2. I think Tensorflow just cannot work with my CPU. It's a rather old desktop. The Theano installation was pretty smooth so I'm using Theano for my Keras backend now.
talonmies
  • 70,661
  • 34
  • 192
  • 269
Ashley Liu
  • 453
  • 1
  • 7
  • 17