keras installed by conda has no keras.utils.Sequence?

Created on 20 May 2018  路  3Comments  路  Source: keras-team/keras

I use miniconda to install keras as below:

conda create --yes --name project python=3.6 tensorflow scikit-learn scikit-image libtiff pandas keras h5py

I called keras.utils.Sequence in Python, then there is an error:

Traceback (most recent call last):
File "", line 1, in
AttributeError: module 'keras.utils' has no attribute 'Sequence'

The version of Keras is 2.0.5.

Most helpful comment

@JamesTrick Thank you so much! Yeah it works now after using pip to install keras. I guess the conda's keras' version is outdated 馃槄

All 3 comments

Hi @xiaohk

You're using a slightly outdated version of Keras, here's the code that I ran to re-produce:

pip install keras=2.0.5

import keras; print(keras.__version__)

> 2.0.5

seq = keras.utils.Sequence

>Traceback (most recent call last):
>File "", line 1, in 
>AttributeError: module 'keras.utils' has no attribute 'Sequence'

From here, you have two options. I would recommend updating Keras, pip install keras --upgrade, you'll then have no issues importing the keras.utils.Sequence

Alternatively, based off this issue #3726, it looks as though Sequence used to be in the Preprocessing module in previous versions, so following those steps worked for me when testing your issue.

Let me know if you have any other questions.

Cheers
James

@JamesTrick Thank you so much! Yeah it works now after using pip to install keras. I guess the conda's keras' version is outdated 馃槄

Now, You can use conda install -c hesi_m keras to install the latest version of Keras (2.2.0) and Tensorflow(1.8.0) for you.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

fredtcaroli picture fredtcaroli  路  3Comments

harishkrishnav picture harishkrishnav  路  3Comments

amityaffliction picture amityaffliction  路  3Comments

braingineer picture braingineer  路  3Comments

rantsandruse picture rantsandruse  路  3Comments