PyCharm cannot find installed packages: keras

Question:

I installed pycharm-2016.1.4 in my PC running Ubuntu 14.04. I have installed Keras (a Python package) using pip install keras and PyCharm can find it before. But it cannot find Keras now. I do not modify any settings, so this problem may be wired. My Python version is Python 2.7.

enter image description here

I use pip list to verify that I have Keras installed:

enter image description here

But check this package in PyCharm by using: Settings -> Project -> Project Interpreter. Keras is NOT in the package list. (The interpreter used is the same as the result of which python in terminal).

Asked By: Dong Li

||

Answers:

This is strange, but you can install Keras directly through Pycharm.

You can follow this steps:

  • Go to Settings -> Project -> Project Interpreter
  • Click on plus icon in the top-right corner
  • Search Keras and press on Install Package

Please let me know if this procedure solve your issue.

Answered By: Giordano

I do not know what happened, but the problem solved with the following steps.

  1. Uninstall old keras
  2. Re-install keras: pip install keras

Then I can import keras in pycharm.

NOTE: It is strange since I have keras installed but cannot find it in Project Interpreter’s package list.

Answered By: Dong Li

To clearify Giordano’s answer:

  1. You should have installed tensorflow or any other framework where keras can be used on top of.
  2. Create a virtualenv and set this as your project interpreter. This is a working solution for me: Installing tensorflow on Pycharm (Mac)
  3. Got to preferences -> Project: -> Project Interpreter
  4. Click on the plus sign on the bottom left corner
  5. Search Keras and install the package.
Answered By: David Joos

My solution:

if you ever have installed in python:

  • Go to File->Settings->Project->Project Interpreter
  • Click the gear-> Add..->System interpreter
  • Choose the python version that have installed keras
Answered By: louis peng

I am running through a training video series and, with Conda installed on my Centos 7 system, I could not get Keras to load properly. My solution was to use VirtualEnv for my Python Interpreter. I followed the steps here: https://www.jetbrains.com/help/pycharm/configuring-python-interpreter.html#add_new_project_interpreter

Answered By: photoemulator

Use

import tensorflow.python.keras

instead.

Answered By: Hamidreza Moeini
Categories: questions Tags: , , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.