Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't install Keras

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.

like image 729
beeCwright Avatar asked Nov 04 '16 13:11

beeCwright


People also ask

Do I need to install Keras if I have TensorFlow?

When you install TensorFlow 2.0+, Keras will be automatically installed, as well. The simplest way to install TensorFlow is to install the binary version using one of the official releases on the Python Package Index (PyPI).

Is Keras part of Anaconda?

To install Keras, you will need Anaconda Distribution, which is supported by a company called Continuum Analytics. Anaconda provides a platform for Python and R languages, which is an open-source and free distribution.


2 Answers

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

like image 105
beeCwright Avatar answered Oct 04 '22 05:10

beeCwright


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.

like image 28
Gaarv Avatar answered Oct 04 '22 07:10

Gaarv