conda installed packages not working with jupyter

Viewed 5974

I had installed tensorflow with pip install, and installed keras with conda install: (my python3 is installed under Anaconda3)

conda create -n keras python=3.5
activate keras
pip install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/windows/cpu/tensorflow-1.2.1-cp35-cp35m-win_amd64.whl
conda install --channel https://conda.anaconda.org/conda-forge keras

Now when I run the following commands in commandline, everything works fine:

activate keras
python
import tensorflow
import keras
from keras.datasets import mnist

However, when I run the same commands with jupyter, I get an error on the keras import line:

activate keras
jupyter notebook
# now open a python3 notebook
# and enter the above commands in it
# and run

ImportError: No module named 'keras'

However the import for tensorflow gives no error.

I then uninstalled tensorflow, and reinstalled it with conda install:

conda install tensorflow

Now when I run jupyter, I get the same error on the tensorflow line also.

How can I get jupyter to work on packages installed with conda?

Additional information: I ran sys.executable both from commandline and jupyter, and both point to the same path:

'C:\\sw\\Anaconda3\\envs\\tensorflow\\python.exe'

It looks like a recent problem, I found a similar report at https://github.com/jupyter/jupyter/issues/245, But I did not quite understand the solution. Can anyone help here?

2 Answers

install jupyter in your environment:

activate keras
conda install jupyter
Related