0

I am on mac osx yosemite and Spyder is giving me this error:

ImportError: No module named 'tensorflow'

I am running python3.5 with a virtual environment along with tensorflow 1.0.0

Code:

import numpy as np

import tensorflow as tf

import re

import time

Traceback:

Python 3.5.4 |Anaconda, Inc.| (default, Oct  5 2017, 02:58:14)
Type "copyright", "credits" or "license" for more information.

IPython 6.1.0 -- An enhanced Interactive Python.
Traceback (most recent call last):

  File "<ipython-input-1-c6f06aebce6b>", line 1, in <module>
    runfile('/Users/connorwoodford/Desktop/Deep NLP A-Z/chatbot.py', wdir='/Users/connorwoodford/Desktop/Deep NLP A-Z')

  File "/Users/connorwoodford/anaconda3/envs/chatbot/lib/python3.5/site-packages/spyder/utils/site/sitecustomize.py", line 710, in runfile
    execfile(filename, namespace)

  File "/Users/connorwoodford/anaconda3/envs/chatbot/lib/python3.5/site-packages/spyder/utils/site/sitecustomize.py", line 101, in execfile
    exec(compile(f.read(), filename, 'exec'), namespace)

  File "/Users/connorwoodford/Desktop/Deep NLP A-Z/chatbot.py", line 7, in <module>
    import tensorflow as tf

ImportError: No module named 'tensorflow'
Caleb Hearth
  • 3,315
  • 5
  • 30
  • 44
pillarman38
  • 47
  • 3
  • 13
  • can you provide the code you're trying to execute and the entire traceback? – wpercy Dec 18 '17 at 18:40
  • Please, check out some of the recommendations I have provided in my answer and give some feedback on whether they were helpful. –  Dec 18 '17 at 18:51

1 Answers1

1

Open a terminal -

1. Run python
2. Run commands
    a.  import sys
    b. sys.executable
3. Copy and keep the output of the output from the last command somewhere
4. Open Spyder
    a. Go to Tools > Preferences > Python interpreter
    b. Select the option Use the following Python interpreter
    c. Paste the copied output of the command
5. Go to the consoles option in Spyder
    a. Choose Open Ipython console from options
    b. It might as for installing ipykernal, which you can do with
        i.  pip / conda install ipykernal cloudpickle
    c. Now you can use Keras, tensorflow without any error I believe.

It worked for me!