0

When I trying to install keras with pip3 this message shows.

Requirement already satisfied: keras in /usr/local/lib/python3.5/dist-packages
Requirement already satisfied: pyyaml in /usr/local/lib/python3.5/dist-packages (from keras)
Requirement already satisfied: six>=1.9.0 in ./.local/lib/python3.5/site-packages (from keras)
Requirement already satisfied: scipy>=0.14 in /usr/local/lib/python3.5/dist-packages (from keras)
Requirement already satisfied: numpy>=1.9.1 in ./.local/lib/python3.5/site-packages (from keras)

But I import keras in a project it shows this error.

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'keras'

How to solve this problem? I used Ubuntu 16.04 and python 3.

Gihan Chathuranga
  • 442
  • 10
  • 16

2 Answers2

1

Are you using a virtual environment? If so make sure to activate it.

EDIT: To expand on what "virtual environment" means, look here and here at "Conda." Conda can help you with installations in many ways; it can help you update Keras later on, it will help you manage which packages you need with which Python scripts so you don't have to write a million import numpy as np statements everywhere, etc. etc. There is a more in-depth, clear explanation of what Conda is here

Also you can see what packages are installed with:

pip3 freeze
Nathan majicvr.com
  • 950
  • 2
  • 11
  • 31
paul41
  • 576
  • 7
  • 17
0

What i would suggest is use keras in a separate environment using conda.
Suppose you want to create an env named "myenv"
1.Open Anaconda promt and type the following:

conda create --name myenv

2.To activate the environment:

conda activate myenv

3.Now you can install keras and other dependencies:

pip install keras
Deril Raju
  • 124
  • 2
  • 8