5

I've been unable to install Keras inside of an Anaconda environment…

~$ pip install keras
pip install keras
Collecting keras
Collecting pyyaml (from keras)
  Using cached PyYAML-3.12.tar.gz
    Complete output from command python setup.py egg_info:
    running egg_info
    creating pip-egg-info/PyYAML.egg-info
    writing top-level names to pip-egg-info/PyYAML.egg-info/top_level.txt
    writing dependency_links to pip-egg-info/PyYAML.egg-info/dependency_links.txt
    writing pip-egg-info/PyYAML.egg-info/PKG-INFO
    writing manifest file 'pip-egg-info/PyYAML.egg-info/SOURCES.txt'
    warning: manifest_maker: standard file '-c' not found

    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-b74rx7yf/pyyaml/setup.py", line 339, in <module>
        cmdclass=cmdclass,
      File "/home/bee/anaconda3/envs/roar/lib/python3.5/distutils/core.py", line 148, in setup
        dist.run_commands()
      File "/home/bee/anaconda3/envs/roar/lib/python3.5/distutils/dist.py", line 955, in run_commands
        self.run_command(cmd)
      File "/home/bee/anaconda3/envs/roar/lib/python3.5/distutils/dist.py", line 974, in run_command
        cmd_obj.run()
      File "/home/bee/anaconda3/envs/roar/lib/python3.5/site-packages/setuptools-28.7.1-py3.5.egg/setuptools/command/egg_info.py", line 279, in run
      File "/home/bee/anaconda3/envs/roar/lib/python3.5/site-packages/setuptools-28.7.1-py3.5.egg/setuptools/command/egg_info.py", line 306, in find_sources
      File "/home/bee/anaconda3/envs/roar/lib/python3.5/site-packages/setuptools-28.7.1-py3.5.egg/setuptools/command/egg_info.py", line 533, in run
      File "/home/bee/anaconda3/envs/roar/lib/python3.5/site-packages/setuptools-28.7.1-py3.5.egg/setuptools/command/egg_info.py", line 562, in add_defaults
      File "/home/bee/anaconda3/envs/roar/lib/python3.5/site-packages/setuptools-28.7.1-py3.5.egg/setuptools/command/py36compat.py", line 36, in add_defaults
      File "/home/bee/anaconda3/envs/roar/lib/python3.5/site-packages/setuptools-28.7.1-py3.5.egg/setuptools/command/py36compat.py", line 119, in _add_defaults_ext
      File "/home/bee/anaconda3/envs/roar/lib/python3.5/distutils/cmd.py", line 299, in get_finalized_command
        cmd_obj.ensure_finalized()
      File "/home/bee/anaconda3/envs/roar/lib/python3.5/distutils/cmd.py", line 107, in ensure_finalized
        self.finalize_options()
      File "/home/bee/anaconda3/envs/roar/lib/python3.5/site-packages/Cython/Distutils/build_ext.py", line 19, in finalize_options
        self.distribution.ext_modules)
      File "/home/bee/anaconda3/envs/roar/lib/python3.5/site-packages/Cython/Build/Dependencies.py", line 809, in cythonize
        aliases=aliases)
      File "/home/bee/anaconda3/envs/roar/lib/python3.5/site-packages/Cython/Build/Dependencies.py", line 752, in create_extension_list
        **kwds))
    TypeError: __init__() missing 3 required positional arguments: 'feature_name', 'feature_description', and 'feature_check'

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-b74rx7yf/pyyaml/

I've tried some of the usual suspects:

pip install --upgrade pip
pip install --upgrade setuptools

And I also tried most of the solutions here, but still no luck.

As an aside, I can install Keras fine when not in the conda env.

Any help would be appreciated.

petezurich
  • 9,280
  • 9
  • 43
  • 57
beeCwright
  • 370
  • 1
  • 3
  • 12

6 Answers6

8

Thanks the support guys!

For whatever reason my conda env was stuck on setuptools-27 even after running

pip install --upgrade setuptools

However, running

pip install --upgrade setuptools --ignore-installed

Got my env up to setuptools-28.8.0 and now have no Keras issues

beeCwright
  • 370
  • 1
  • 3
  • 12
3

I have several setups using Anaconda and I use :

conda install -y tensorflow
pip install --upgrade --no-deps git+git://github.com/fchollet/keras.git

TensorFlow is now the default backend for Keras, so I have to install it, and using the bleeding edge / repository version is often recommended.

Gaarv
  • 814
  • 8
  • 15
2

I had similar errors. But after those errors, I tried to install Keras using anaconda environment which was really helpful for me- I am not a coder, just started to learn so I am not familiar with all this cmd things. Anyway for those who are not familiar with anything just like me here how I installed Keras: 1-Download/install Anaconda (https://www.anaconda.com/download/) 2-Download/install Tensorflow (https://www.tensorflow.org/install/install_windows)

So basically, after that point, search for (press windows button then type:) "Anaconda navigator". Open it. 3-In the anaconda environment you will see "environments" on the left side of screen. Click on it 4-Since u installed tensorflow, U will see a tensorflow under the root (somewhere at the middle of screen). Click tensorflow 5- When u click on tensorflow, packages that are installed will be shown on the right window. 6-This window shows installed packages, U need to select "not installed".(a bar, just next to 'channels' box)
7- And u will see keras, keras-gpu with a number of other packages in the window 8-So I selected keras and applied it then it is installed.

As I said, I just started to learn coding (like 2 weeks ago, i want to learn by practicing). So for me, installing without command lines was much easier/practial. I don't know if this installation affects any feature of keras.

Hope this helps. P.S: English is not my mother language so I hope, I was clear. Best

KFdn
  • 21
  • 1
  • Finally i installed Keras. First of all, my previous comment using conda environment didn't install Keras.(I run a code which includes Keras module and it gave an error- Keras module not found) So i continue searching to solve problem. In another threat (https://stackoverflow.com/questions/45573930/issue-installing-keras-with-tensorflow-backend-on-anaconda) I found the answer. I didn't followed all steps there, but i opened cmd, and entered "conda install -c conda-forge keras" (ignore double quotes and be sure that u r in the correct directort -i.e where u installed tensorflow) . And it worked – KFdn Jan 10 '18 at 09:14
0

Why on earth are you going for pip install while you have Anaconda. Just open the Anaconda prompt and type:

conda install keras

For installing any other package which is already not there in your environment, you can just type the correct package name in the place of keras in the above command.

Similarly, in order to periodically update any package, you can just use conda update package_name. For instance if you need to update keras in Anaconda, type the following:

conda update keras
Steffi Keran Rani J
  • 3,667
  • 4
  • 34
  • 56
0

**i tried to installed Keras through anaconda navigator. follow the below steps:

  1. go to environment tab and click "create", select create new environment tab and type "tensorflow_env"
  2. here package should be 3.6 version
  3. select not installed in the same environment and type tensorflow, keras also.
  4. select tick on that searched package and click "apply"
  5. now keras installed and confirm the same in cmd prompt**
0

I tried to install it many ways, finally below steps worked with specific version on windows 10.

1> Create virtual env

#conda create -n tensorflow pip python=3.5

2> activate env

#activate tensorflow
#conda info --envs

3> Install tensorflow

#conda install -c conda-forge tensorflow

this will install tensorflow 1.10.0

#python -m pip install --upgrade pip
#pip install setuptools==39.1.0

3> Install keras

#pip install keras==2.2.2

Verification: Run python in same virtual env

(tensorflow) C:\WINDOWS\system32>python
Python 3.5.6 |Anaconda, Inc.| (default, Aug 26 2018, 16:05:27) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
>>> import keras
Using TensorFlow backend.
LOrD_ARaGOrN
  • 3,884
  • 3
  • 27
  • 49