0
votes

I have not used Linux/Unix for more a decade. Why does the 'tensorflow' module import fail in Spyder and not in Jupyter Notebook and not in Python prompt?

SCENARIO:

  • [terminal] spyder
  • [spyder][IPython console] Type 'import tensorflow as tf' in the IPython console

CURRENT RESULT:

  • [spyder][IPython console] Message error: 'ImportError: No module named 'tensorflow''

ADDITIONAL INFORMATION:

  • OS: Ubuntu 14.04 (VMWare)
  • Python: Python 3.5.2 :: Anaconda custom (64-bit)
  • Install of TensorFlow:
    • [terminal] sudo -s
    • [terminal] conda create --name=IntroToTensorFlow python=3 anaconda
    • [terminal] source activate IntroToTensorFlow
    • [terminal] conda install -c conda-forge tensorflow
  • PATH = $PATH:/home/mo/anaconda3/envs/IntroToTensorFlow/bin

COMMENTS:

  • When I replay the following scenario, it works fine:
    • [terminal] sudo -s
    • [terminal] source activate IntroToTensorFlow
    • [terminal] python
    • [python] import tensorflow as tf
  • When I replay the tensorflow import in Jupyter Notebook, it works fine too

WHAT I HAVE DONE SO FAR:

  • I Googled it but I did not find a suitable anwser
  • I searched in the Stack Overflow questions
2
Note: if you want to render a formatted code block inside a list item, use double indent (8 spaces instead of 4).halfer

2 Answers

-1
votes

This might be a matter of environment variables. Try the answer here and here:

LD_LIBRARY_PATH=/usr/local/cuda/lib64 CUDA_PATH=/usr/local/cuda

0
votes

(Posted on behalf of the OP).

It is solved: I reinstalled spyder and it works properly now. Thank you.