I have installed Tensorflow and Keras by Anaconda (on Windows 10), I have created an environment where I am using Python 3.5.2 (the original one in Anaconda was Python 3.6).
When I try to execute import keras as ks
, I get ModuleNotFoundError: No module named 'keras'
.
I have tried to solve this issue by sys.path.append(C:\\Users\\ ... \\Anaconda3\\python.exe)
with both notebook and console, but I continue to get the same error.
How could I solve this issue?
Acually, I did this command
pip install keras
andsudo -H pip3 install keras
andpip3 install keras
. None of them worked. I added the following command and everything worked like a charm:pip install Keras
. Yes a capital 'K'Here's how I solved this problem.
First, the diagnosis. When I run
which python
in a terminal window on my Mac (the same terminal I used to launchjupyter
, I get/Users/myusername/.conda/envs/myenvname/bin/python
, but when I run the same command from a terminal within Jupyter, I get/usr/bin/python
. So Jupyter isn't using the correct python executable; the version it's using doesn't have any of my packages installed.But
which jupyter
returns/usr/bin/jupyter
; it's using a version of jupyter that isn't coming from within my conda environment. I ranconda install jupyter
and nowwhich jupyter
returns/Users/myusername/.conda/envs/myenvname/bin/jupyter
(for some reason I had to restart the terminal window for this to take effect.) Then if I relaunchjupyter notebook
, the notebook is using the correct version of Python and I have access to all my installed conda packages.