title: can not import TensorFlow in Spyder or Python (ModuleNotFoundError: No module named 'tensorflow')
body: <p>I have tried to install both CPU and GPU version of TensorFlow according to the manual from here <a href="https://docs.anaconda.com/anaconda/user-guide/tasks/tensorflow/" rel="nofollow noreferrer">https://docs.anaconda.com/anaconda/user-guide/tasks/tensorflow/</a> and all was ok:</p>
  
  <blockquote>
    <p>(tf-gpu) C:\Users\Kosh>conda create -n tf tensorflow Collecting
    package metadata (current_repodata.json): done Solving environment:
    done</p>
    
    <p>==> WARNING: A newer version of conda exists. &lt;==   current version: 4.7.12   latest version: 4.8.3</p>
    
    <p>Please update conda by running</p>
  
  <pre><code>$ conda update -n base -c defaults conda
  </code></pre>
    
    <h2>Package Plan</h2>
    
    <p>environment location: C:\Anaconda3\envs\tf</p>
    
    <p>added / updated specs:
        - tensorflow</p>
    
    <p>The following packages will be downloaded:</p>
  
  <pre><code>package                    |            build
  ---------------------------|-----------------
  _tflow_select-2.2.0        |            eigen           3 KB
  tensorflow-2.1.0           |eigen_py37hd727fc0_0           4 KB
  tensorflow-base-2.1.0      |eigen_py37h49b2757_0        35.4 MB
  ------------------------------------------------------------
                                         Total:        35.4 MB
  </code></pre>
    
    <p>The following NEW packages will be INSTALLED:</p>
    
    <p>_tflow_select      pkgs/main/win-64::_tflow_select-2.2.0-eigen<br>
    absl-py            pkgs/main/win-64::absl-py-0.9.0-py37_0   asn1crypto
    pkgs/main/win-64::asn1crypto-1.3.0-py37_0   astor<br>
    pkgs/main/win-64::astor-0.8.0-py37_0   blas<br>
    pkgs/main/win-64::blas-1.0-mkl   blinker<br>
    pkgs/main/win-64::blinker-1.4-py37_0   ca-certificates<br>
    pkgs/main/win-64::ca-certificates-2020.1.1-0   cachetools<br>
    pkgs/main/noarch::cachetools-3.1.1-py_0   certifi<br>
    pkgs/main/win-64::certifi-2020.4.5.1-py37_0   cffi<br>
    pkgs/main/win-64::cffi-1.14.0-py37h7a1dbc1_0   chardet<br>
    pkgs/main/win-64::chardet-3.0.4-py37_1003   click<br>
    pkgs/main/noarch::click-7.1.1-py_0   cryptography<br>
    pkgs/main/win-64::cryptography-2.8-py37h7a1dbc1_0   gast<br>
    pkgs/main/win-64::gast-0.2.2-py37_0   google-auth<br>
    pkgs/main/noarch::google-auth-1.13.1-py_0   google-auth-oauth~
    pkgs/main/noarch::google-auth-oauthlib-0.4.1-py_2   google-pasta<br>
    pkgs/main/noarch::google-pasta-0.2.0-py_0   grpcio<br>
    pkgs/main/win-64::grpcio-1.27.2-py37h351948d_0   h5py<br>
    pkgs/main/win-64::h5py-2.10.0-py37h5e291fa_0   hdf5<br>
    pkgs/main/win-64::hdf5-1.10.4-h7ebc959_0   icc_rt<br>
    pkgs/main/win-64::icc_rt-2019.0.0-h0cc432a_1   idna<br>
    pkgs/main/noarch::idna-2.9-py_1   intel-openmp<br>
    pkgs/main/win-64::intel-openmp-2020.0-166   keras-applications
    pkgs/main/noarch::keras-applications-1.0.8-py_0   keras-preprocessi~
    pkgs/main/noarch::keras-preprocessing-1.1.0-py_1   libprotobuf<br>
    pkgs/main/win-64::libprotobuf-3.11.4-h7bd577a_0   markdown<br>
    pkgs/main/win-64::markdown-3.1.1-py37_0   mkl<br>
    pkgs/main/win-64::mkl-2020.0-166   mkl-service<br>
    pkgs/main/win-64::mkl-service-2.3.0-py37hb782905_0   mkl_fft<br>
    pkgs/main/win-64::mkl_fft-1.0.15-py37h14836fe_0   mkl_random<br>
    pkgs/main/win-64::mkl_random-1.1.0-py37h675688f_0   numpy<br>
    pkgs/main/win-64::numpy-1.18.1-py37h93ca92e_0   numpy-base<br>
    pkgs/main/win-64::numpy-base-1.18.1-py37hc3f5095_1   oauthlib<br>
    pkgs/main/noarch::oauthlib-3.1.0-py_0   openssl<br>
    pkgs/main/win-64::openssl-1.1.1f-he774522_0   opt_einsum<br>
    pkgs/main/noarch::opt_einsum-3.1.0-py_0   pip<br>
    pkgs/main/win-64::pip-20.0.2-py37_1   protobuf<br>
    pkgs/main/win-64::protobuf-3.11.4-py37h33f27b4_0   pyasn1<br>
    pkgs/main/noarch::pyasn1-0.4.8-py_0   pyasn1-modules<br>
    pkgs/main/noarch::pyasn1-modules-0.2.7-py_0   pycparser<br>
    pkgs/main/noarch::pycparser-2.20-py_0   pyjwt<br>
    pkgs/main/win-64::pyjwt-1.7.1-py37_0   pyopenssl<br>
    pkgs/main/win-64::pyopenssl-19.1.0-py37_0   pyreadline<br>
    pkgs/main/win-64::pyreadline-2.1-py37_1   pysocks<br>
    pkgs/main/win-64::pysocks-1.7.1-py37_0   python<br>
    pkgs/main/win-64::python-3.7.7-h60c2a47_0_cpython   requests<br>
    pkgs/main/win-64::requests-2.23.0-py37_0   requests-oauthlib 
    pkgs/main/noarch::requests-oauthlib-1.3.0-py_0   rsa<br>
    pkgs/main/noarch::rsa-4.0-py_0   scipy<br>
    pkgs/main/win-64::scipy-1.4.1-py37h9439919_0   setuptools<br>
    pkgs/main/win-64::setuptools-46.1.3-py37_0   six<br>
    pkgs/main/win-64::six-1.14.0-py37_0   sqlite<br>
    pkgs/main/win-64::sqlite-3.31.1-he774522_0   tensorboard<br>
    pkgs/main/noarch::tensorboard-2.1.0-py3_0   tensorflow<br>
    pkgs/main/win-64::tensorflow-2.1.0-eigen_py37hd727fc0_0<br>
    tensorflow-base<br>
    pkgs/main/win-64::tensorflow-base-2.1.0-eigen_py37h49b2757_0<br>
    tensorflow-estima~
    pkgs/main/noarch::tensorflow-estimator-2.1.0-pyhd54b08b_0   termcolor 
    pkgs/main/win-64::termcolor-1.1.0-py37_1   urllib3<br>
    pkgs/main/win-64::urllib3-1.25.8-py37_0   vc<br>
    pkgs/main/win-64::vc-14.1-h0510ff6_4   vs2015_runtime<br>
    pkgs/main/win-64::vs2015_runtime-14.16.27012-hf0eaf9b_1   werkzeug<br>
    pkgs/main/win-64::werkzeug-0.14.1-py37_0   wheel<br>
    pkgs/main/win-64::wheel-0.34.2-py37_0   win_inet_pton<br>
    pkgs/main/win-64::win_inet_pton-1.1.0-py37_0   wincertstore<br>
    pkgs/main/win-64::wincertstore-0.2-py37_0   wrapt<br>
    pkgs/main/win-64::wrapt-1.12.1-py37he774522_1   zlib<br>
    pkgs/main/win-64::zlib-1.2.11-h62dcd97_3</p>
    
    <p>Proceed ([y]/n)? y</p>
    
    <p>Downloading and Extracting Packages
    _tflow_select-2.2.0  | 3 KB      | ############################################################################ | 100% tensorflow-2.1.0     | 4 KB      |</p>
    
    ###################################################################### | 100% tensorflow-base-2.1. | 35.4 MB   |
    
    ###################################################################### | 100% Preparing transaction: done Verifying transaction: done
    
    <p>Executing transaction: done
    #</p>
    
    <h1>To activate this environment, use</h1>
    
    <p>#</p>
    
    <h1>$ conda activate tf</h1>
    
    <p>#</p>
    
    <h1>To deactivate an active environment, use</h1>
    
    <p>#</p>
    
    <h1>$ conda deactivate</h1>
    
    <p>(tf-gpu) C:\Users\Kosh> (tf-gpu) C:\Users\Kosh> (tf-gpu)
    C:\Users\Kosh>conda activate tf-2 Could not find conda environment:
    tf-2 You can list all discoverable environments with <code>conda info
    --envs</code>.</p>
    
    <p>(tf-gpu) C:\Users\Kosh>conda activate tf</p>
  </blockquote>
  
  <p>but when I try to import it in Spyder or in Python I get the same result:</p>
  
  <pre><code>import tensorflow as tf
  Traceback (most recent call last):
  
    File "&lt;ipython-input-1-64156d691fe5&gt;", line 1, in &lt;module&gt;
      import tensorflow as tf
  
  ModuleNotFoundError: No module named 'tensorflow'
  </code></pre>
  
  <p>Can somebody help me with this?</p>