ImportError: No module named tensorflow in Spyder

This question is known, but in his scenario it is different and I could not find a solution that satisfies my problem. However, that's all. I have installed Python and Anaconda and Tensorflow on my machine as the Tensorflow site describes.

And I installed it correctly and even tried the example that the Tensorflow website provides to test if Tensorflow is working and it did. It runs on Anaconda request, Python prompt and python IDLE without issue.

But when I run the script in Spyder and run it in python console or ipython console, it gives an error.

runfile('C:/Users/home/.spyder-py3/temp.py', wdir='C:/Users/home/.spyder-py3')
Traceback (most recent call last):

File "<ipython-input-2-4aa1bb797551>", line 1, in <module>
runfile('C:/Users/home/.spyder-py3/temp.py', wdir='C:/Users/home/.spyder-py3')

File "C:\Users\home\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 880, in runfile
execfile(filename, namespace)

File "C:\Users\home\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 102, in execfile
exec(compile(f.read(), filename, 'exec'), namespace)

File "C:/Users/home/.spyder-py3/temp.py", line 1, in <module>
import tensorflow as tf

ModuleNotFoundError: No module named 'tensorflow'

      

I don't know why this has never been found to be a solution.

+3


source to share


2 answers


The same thing happened to me and these two help solve the problem:

1- create a new environment and install python and tensorflow ... Here is a YouTube video for the same. !



2- Install spyder in the new environment created earlier. Follow these steps in this . ...

+1


source


I know this is an old question, but I found it helpful to mention another way to solve it like this:

  • Install tensorflow using conda as described here , including creating a new environment ... (You already mentioned what you did, but I'm adding it here as a link for any new visitor).
  • From the Anaconda Navigator, go to the start and select the new environment you just created in step 1 .... (inspired by Rimma's post on this question ).
  • First, click Install for the application you want to install (Spyder or Jupyter..etc), then click Launch Application.
  • Test your installation by trying "import tensorflow as tf as an example).


enter image description here

0


source







All Articles