1

I'm trying to start working on keras and tensorflow but I cannot figure out how to properly set them up and I keep getting errors in my jupyter notebook.

From searching for solutions online, I can tell that it's likely that my folders are misplaced and I cannot tell where I am downloading my files/packages.

All I'm trying to do is begin following udemy classes and to start messing around with keras/tensorflow, but I keep getting these errors everytime I try importing on jupyter notebook.

I'm on a Windows OS, and I suspect that the problem is due to a misplacement of either Python37 or Anaconda, but I'm not sure how to begin solving it as everything I found online isn't working.

Any idea how as to what I'm doing wrong and how could I solve this problem?

new error 1

new error 2

Pankaj
  • 931
  • 8
  • 15
  • Did you install tensorflow? Please describe the problem and your environment, your current question is mostly about what you think the problem is. – Dr. Snoopy Mar 04 '19 at 08:42
  • Yes, I installed tensorflow by going to the Python directory on cmd and using `pip install tensorflow`. My problem is that I cannot understand what I did wrong such that when I open Jupyter Notebook and attempt to import the packages, I get a ModuleNotFoundError – RiveraJackson Mar 04 '19 at 08:45
  • Did you install keras in the same way? The problem is usually that one package is installed in a different python interpreter because of a users' mistake. – Dr. Snoopy Mar 04 '19 at 08:46
  • Yes, I installed keras the same way, following instructions on [this webpage](http://inmachineswetrust.com/posts/deep-learning-setup/#cell2) – RiveraJackson Mar 04 '19 at 08:48

2 Answers2

1

I had the same issue once. When you start Jupyter notepad, by default it uses default anaconda environment. But if you want to switch to different environments you can use ipykernel.

source activate myenv
pip install --upgrade ipykernel
python -m ipykernel install --user --name your_conda_env --display-name "Python (myenv)"

Now when you start the jupyter you will see a list of environments(E.g Python (tensorflow-env)). enter image description here

Mitiku
  • 5,337
  • 3
  • 18
  • 35
0

I don't know what keras.modules is... Do you mean keras.models?

from keras.models import Sequential

also Dense is from keras.layers so,

from keras.layers import Dense
Aviv Moshe Albeg
  • 131
  • 2
  • 10
  • woops, yes but even when I corrected it, I still get an error saying "no module named tensorflow" when im not even attempting to import tensorflow – RiveraJackson Mar 04 '19 at 08:19
  • Last I checked python37 doesn't support tensorflow. I would suggest you install python3.6 and then try again.https://stackoverflow.com/questions/52655087/how-to-install-tensorflow-on-python3-7 – Aviv Moshe Albeg Mar 04 '19 at 08:45