I have a conda
environment with Tensorflow-gpu
installed for python 3.6.6. I am running Ubuntu linux 16.04 LTS. When I activate the environment and start a python shell, I can import Tensorflow
just fine. But when I start up a Jupyter
notebook or Jupyter lab
session, I can't import Tensorflow
.
Now there is a pre-existing SE post on this issue. However, that post is 2 years old, so there are changes in Jupyter since then. Second, I tried the fixed mentioned in that post, and none of them have worked. So I was hoping there might be some progress or some new ways to fix this.
So let me provide a little more detail on the issue.
First, when I activated a python 3.6.6 environment in anaconda and did
conda list
in a regular Tilix terminal session, I can see thatTensorflow-gpu
is listed.When I start
ipython
in a standard Tilix terminal and typeimport tensorflow as tf
, that works fine.Next, I started a jupyter lab session and opened a terminal from the jupyter launcher. In the terminal I started an
ipython
session and tried to import tensorflow. That does not work.I opened a new jupyter notebook and tried to import
Tensorflow
then I "ModuleNotFoundError: No module named 'tensorflow'" error.If I just run a python file with tensorflow code from the regular tilix terminal, then it will run fine and find Tensorflow. So only the notebook seems to be the big problem.
Things that I have tried:
I did try to implement a few of the fixes suggested in the older SE post, as well as the closed github issue on this problem.
- I tried to reinstall
tensorflow
- I did a conda install of
ipython
,jupyter
because some folks suggested installing those into the environment directly. - I looked at the
jupyter kernelspec list
. Some folks suggested making a change to this, but it was not clear what to change. - I installed the
conda install -c anaconda-nb-extensions nb_conda
in the environment too, but still no luck.
Anyone else have a suggestion about how to fix this.