FS#62987 - [python-keras-applications] Fail to import keras after upgrading keras_applications to 1.0.8-1

Attached to Project: Community Packages
Opened by Øystein Schønning-Johansen (oysteijo) - Sunday, 23 June 2019, 21:20 GMT
Last edited by Sven-Hendrik Haase (Svenstaro) - Sunday, 23 June 2019, 22:20 GMT
Task Type Bug Report
Category Packages
Status Closed
Assigned To No-one
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:
After I upgraded 'python_keras_applications' to latest version (1.0.8-1) I can no longer import keras in python.

Here is the error message I receive:

----- 8< ----- My ipython session ----- 8< -----

In [1]: import keras
Using TensorFlow backend.
2019-06-23 22:44:56.639633: I tensorflow/stream_executor/platform/default/dso_loader.cc:42] Successfully opened dynamic library libcudart.so.10.1
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-1-88d96843a926> in <module>
----> 1 import keras

/usr/lib/python3.7/site-packages/keras/__init__.py in <module>
3 from . import utils
4 from . import activations
----> 5 from . import applications
6 from . import backend
7 from . import datasets

/usr/lib/python3.7/site-packages/keras/applications/__init__.py in <module>
11 import keras_applications
12
---> 13 keras_applications.set_keras_submodules(
14 backend=backend,
15 layers=layers,

AttributeError: module 'keras_applications' has no attribute 'set_keras_submodules'

# However I can indeed import keras_applications directly:

In [2]: import keras_applications

In [3]: dir(keras_applications)
Out[3]:
['_KERAS_BACKEND',
'_KERAS_LAYERS',
'_KERAS_MODELS',
'_KERAS_UTILS',
'__builtins__',
'__cached__',
'__doc__',
'__file__',
'__loader__',
'__name__',
'__package__',
'__path__',
'__spec__',
'__version__',
'absolute_import',
'correct_pad',
'densenet',
'division',
'get_submodules_from_kwargs',
'imagenet_utils',
'inception_resnet_v2',
'inception_v3',
'mobilenet',
'mobilenet_v2',
'nasnet',
'print_function',
'resnet',
'resnet50',
'resnet_common',
'resnet_v2',
'resnext',
'vgg16',
'vgg19',
'xception']

# The dir() says that there is no set_keras_submodules. True enough!

In [5]: keras_applications.__version__
Out[5]: '1.0.8'

----- 8< ----- end of ipython session ----- 8< -----


Additional info:
* package version(s)

python_keras_applications 1.0.8-1
keras version 2.2.2
Python 3.7.3 (default, Mar 26 2019, 21:43:19)

The problem is present with both tensorflow and theano backend.

* config and/or log files etc.
my .keras/keras.json config file:

In [3]: cat /home/oystein/.keras/keras.json
{
"image_data_format": "channels_last",
"epsilon": 1e-07,
"floatx": "float32",
"backend": "tensorflow"
}

And if I change backend to theano, the same thing happens. This is apparently not related to the backend.

* link to upstream bug report, if any
None found.

Steps to reproduce:
For me the steps is simple:
- Start a python REPL
- Type: import keras

Best regards,
-Øystein
This task depends upon

Closed by  Sven-Hendrik Haase (Svenstaro)
Sunday, 23 June 2019, 22:20 GMT
Reason for closing:  Not a bug
Comment by Øystein Schønning-Johansen (oysteijo) - Sunday, 23 June 2019, 21:28 GMT
Ah. If I upgrade to python_keras 2.2.4, it works. Sorry.
Please close this task.

Loading...