keras-team / keras

Deep Learning for humans
http://keras.io/
Apache License 2.0
62.05k stars 19.48k forks source link

ImportError: cannot import name 'Deconvolution2D' (install from source) #3421

Closed varoudis closed 8 years ago

varoudis commented 8 years ago

Im getting this weird error, while other keras modules load without a problem. Im just running: variational_autoencoder_deconv.py Ideas?

root@b667c5f44d6a:~/keras# ls
CONTRIBUTING.md    Keras.egg-info  README.md  dist    docs      keras       setup.cfg  tests
ISSUE_TEMPLATE.md  LICENSE         build      docker  examples  pytest.ini  setup.py
root@b667c5f44d6a:~/keras# python3 setup.py install
running install
running bdist_egg
running egg_info
writing Keras.egg-info/PKG-INFO
writing requirements to Keras.egg-info/requires.txt
writing dependency_links to Keras.egg-info/dependency_links.txt
writing top-level names to Keras.egg-info/top_level.txt
reading manifest file 'Keras.egg-info/SOURCES.txt'
writing manifest file 'Keras.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_py
creating build/bdist.linux-x86_64/egg
creating build/bdist.linux-x86_64/egg/keras
copying build/lib/keras/optimizers.py -> build/bdist.linux-x86_64/egg/keras
copying build/lib/keras/models.py -> build/bdist.linux-x86_64/egg/keras
creating build/bdist.linux-x86_64/egg/keras/datasets
copying build/lib/keras/datasets/cifar100.py -> build/bdist.linux-x86_64/egg/keras/datasets
copying build/lib/keras/datasets/__init__.py -> build/bdist.linux-x86_64/egg/keras/datasets
copying build/lib/keras/datasets/mnist.py -> build/bdist.linux-x86_64/egg/keras/datasets
copying build/lib/keras/datasets/data_utils.py -> build/bdist.linux-x86_64/egg/keras/datasets
copying build/lib/keras/datasets/cifar10.py -> build/bdist.linux-x86_64/egg/keras/datasets
copying build/lib/keras/datasets/cifar.py -> build/bdist.linux-x86_64/egg/keras/datasets
copying build/lib/keras/datasets/imdb.py -> build/bdist.linux-x86_64/egg/keras/datasets
copying build/lib/keras/datasets/reuters.py -> build/bdist.linux-x86_64/egg/keras/datasets
creating build/bdist.linux-x86_64/egg/keras/legacy
copying build/lib/keras/legacy/models.py -> build/bdist.linux-x86_64/egg/keras/legacy
copying build/lib/keras/legacy/__init__.py -> build/bdist.linux-x86_64/egg/keras/legacy
copying build/lib/keras/__init__.py -> build/bdist.linux-x86_64/egg/keras
creating build/bdist.linux-x86_64/egg/keras/layers
copying build/lib/keras/layers/__init__.py -> build/bdist.linux-x86_64/egg/keras/layers
copying build/lib/keras/layers/noise.py -> build/bdist.linux-x86_64/egg/keras/layers
copying build/lib/keras/layers/pooling.py -> build/bdist.linux-x86_64/egg/keras/layers
copying build/lib/keras/layers/embeddings.py -> build/bdist.linux-x86_64/egg/keras/layers
copying build/lib/keras/layers/advanced_activations.py -> build/bdist.linux-x86_64/egg/keras/layers
copying build/lib/keras/layers/local.py -> build/bdist.linux-x86_64/egg/keras/layers
copying build/lib/keras/layers/normalization.py -> build/bdist.linux-x86_64/egg/keras/layers
copying build/lib/keras/layers/wrappers.py -> build/bdist.linux-x86_64/egg/keras/layers
copying build/lib/keras/layers/recurrent.py -> build/bdist.linux-x86_64/egg/keras/layers
copying build/lib/keras/layers/convolutional.py -> build/bdist.linux-x86_64/egg/keras/layers
copying build/lib/keras/layers/core.py -> build/bdist.linux-x86_64/egg/keras/layers
creating build/bdist.linux-x86_64/egg/keras/engine
copying build/lib/keras/engine/topology.py -> build/bdist.linux-x86_64/egg/keras/engine
copying build/lib/keras/engine/__init__.py -> build/bdist.linux-x86_64/egg/keras/engine
copying build/lib/keras/engine/training.py -> build/bdist.linux-x86_64/egg/keras/engine
creating build/bdist.linux-x86_64/egg/keras/preprocessing
copying build/lib/keras/preprocessing/__init__.py -> build/bdist.linux-x86_64/egg/keras/preprocessing
copying build/lib/keras/preprocessing/text.py -> build/bdist.linux-x86_64/egg/keras/preprocessing
copying build/lib/keras/preprocessing/sequence.py -> build/bdist.linux-x86_64/egg/keras/preprocessing
copying build/lib/keras/preprocessing/image.py -> build/bdist.linux-x86_64/egg/keras/preprocessing
copying build/lib/keras/metrics.py -> build/bdist.linux-x86_64/egg/keras
creating build/bdist.linux-x86_64/egg/keras/wrappers
copying build/lib/keras/wrappers/__init__.py -> build/bdist.linux-x86_64/egg/keras/wrappers
copying build/lib/keras/wrappers/scikit_learn.py -> build/bdist.linux-x86_64/egg/keras/wrappers
creating build/bdist.linux-x86_64/egg/keras/utils
copying build/lib/keras/utils/test_utils.py -> build/bdist.linux-x86_64/egg/keras/utils                                                        [83/463]
copying build/lib/keras/utils/visualize_util.py -> build/bdist.linux-x86_64/egg/keras/utils
copying build/lib/keras/utils/__init__.py -> build/bdist.linux-x86_64/egg/keras/utils
copying build/lib/keras/utils/layer_utils.py -> build/bdist.linux-x86_64/egg/keras/utils
copying build/lib/keras/utils/io_utils.py -> build/bdist.linux-x86_64/egg/keras/utils
copying build/lib/keras/utils/data_utils.py -> build/bdist.linux-x86_64/egg/keras/utils
copying build/lib/keras/utils/generic_utils.py -> build/bdist.linux-x86_64/egg/keras/utils
copying build/lib/keras/utils/np_utils.py -> build/bdist.linux-x86_64/egg/keras/utils
copying build/lib/keras/activations.py -> build/bdist.linux-x86_64/egg/keras
copying build/lib/keras/objectives.py -> build/bdist.linux-x86_64/egg/keras
creating build/bdist.linux-x86_64/egg/keras/backend
copying build/lib/keras/backend/tensorflow_backend.py -> build/bdist.linux-x86_64/egg/keras/backend
copying build/lib/keras/backend/__init__.py -> build/bdist.linux-x86_64/egg/keras/backend
copying build/lib/keras/backend/common.py -> build/bdist.linux-x86_64/egg/keras/backend
copying build/lib/keras/backend/theano_backend.py -> build/bdist.linux-x86_64/egg/keras/backend
copying build/lib/keras/regularizers.py -> build/bdist.linux-x86_64/egg/keras
copying build/lib/keras/callbacks.py -> build/bdist.linux-x86_64/egg/keras
copying build/lib/keras/initializations.py -> build/bdist.linux-x86_64/egg/keras
copying build/lib/keras/constraints.py -> build/bdist.linux-x86_64/egg/keras
byte-compiling build/bdist.linux-x86_64/egg/keras/optimizers.py to optimizers.cpython-34.pyc
byte-compiling build/bdist.linux-x86_64/egg/keras/models.py to models.cpython-34.pyc
byte-compiling build/bdist.linux-x86_64/egg/keras/datasets/cifar100.py to cifar100.cpython-34.pyc
byte-compiling build/bdist.linux-x86_64/egg/keras/datasets/__init__.py to __init__.cpython-34.pyc
byte-compiling build/bdist.linux-x86_64/egg/keras/datasets/mnist.py to mnist.cpython-34.pyc
byte-compiling build/bdist.linux-x86_64/egg/keras/datasets/data_utils.py to data_utils.cpython-34.pyc
byte-compiling build/bdist.linux-x86_64/egg/keras/datasets/cifar10.py to cifar10.cpython-34.pyc
byte-compiling build/bdist.linux-x86_64/egg/keras/datasets/cifar.py to cifar.cpython-34.pyc
byte-compiling build/bdist.linux-x86_64/egg/keras/datasets/imdb.py to imdb.cpython-34.pyc
byte-compiling build/bdist.linux-x86_64/egg/keras/datasets/reuters.py to reuters.cpython-34.pyc
byte-compiling build/bdist.linux-x86_64/egg/keras/legacy/models.py to models.cpython-34.pyc
byte-compiling build/bdist.linux-x86_64/egg/keras/legacy/__init__.py to __init__.cpython-34.pyc
byte-compiling build/bdist.linux-x86_64/egg/keras/__init__.py to __init__.cpython-34.pyc
byte-compiling build/bdist.linux-x86_64/egg/keras/layers/__init__.py to __init__.cpython-34.pyc
byte-compiling build/bdist.linux-x86_64/egg/keras/layers/noise.py to noise.cpython-34.pyc
byte-compiling build/bdist.linux-x86_64/egg/keras/layers/pooling.py to pooling.cpython-34.pyc
byte-compiling build/bdist.linux-x86_64/egg/keras/layers/embeddings.py to embeddings.cpython-34.pyc
byte-compiling build/bdist.linux-x86_64/egg/keras/layers/advanced_activations.py to advanced_activations.cpython-34.pyc
byte-compiling build/bdist.linux-x86_64/egg/keras/layers/local.py to local.cpython-34.pyc
byte-compiling build/bdist.linux-x86_64/egg/keras/layers/normalization.py to normalization.cpython-34.pyc
byte-compiling build/bdist.linux-x86_64/egg/keras/layers/wrappers.py to wrappers.cpython-34.pyc
byte-compiling build/bdist.linux-x86_64/egg/keras/layers/recurrent.py to recurrent.cpython-34.pyc
byte-compiling build/bdist.linux-x86_64/egg/keras/layers/convolutional.py to convolutional.cpython-34.pyc
byte-compiling build/bdist.linux-x86_64/egg/keras/layers/core.py to core.cpython-34.pyc
byte-compiling build/bdist.linux-x86_64/egg/keras/engine/topology.py to topology.cpython-34.pyc                                                [40/463]
byte-compiling build/bdist.linux-x86_64/egg/keras/engine/__init__.py to __init__.cpython-34.pyc
byte-compiling build/bdist.linux-x86_64/egg/keras/engine/training.py to training.cpython-34.pyc
byte-compiling build/bdist.linux-x86_64/egg/keras/preprocessing/__init__.py to __init__.cpython-34.pyc
byte-compiling build/bdist.linux-x86_64/egg/keras/preprocessing/text.py to text.cpython-34.pyc
byte-compiling build/bdist.linux-x86_64/egg/keras/preprocessing/sequence.py to sequence.cpython-34.pyc
byte-compiling build/bdist.linux-x86_64/egg/keras/preprocessing/image.py to image.cpython-34.pyc
byte-compiling build/bdist.linux-x86_64/egg/keras/metrics.py to metrics.cpython-34.pyc
byte-compiling build/bdist.linux-x86_64/egg/keras/wrappers/__init__.py to __init__.cpython-34.pyc
byte-compiling build/bdist.linux-x86_64/egg/keras/wrappers/scikit_learn.py to scikit_learn.cpython-34.pyc
byte-compiling build/bdist.linux-x86_64/egg/keras/utils/test_utils.py to test_utils.cpython-34.pyc
byte-compiling build/bdist.linux-x86_64/egg/keras/utils/visualize_util.py to visualize_util.cpython-34.pyc
byte-compiling build/bdist.linux-x86_64/egg/keras/utils/__init__.py to __init__.cpython-34.pyc
byte-compiling build/bdist.linux-x86_64/egg/keras/utils/layer_utils.py to layer_utils.cpython-34.pyc
byte-compiling build/bdist.linux-x86_64/egg/keras/utils/io_utils.py to io_utils.cpython-34.pyc
byte-compiling build/bdist.linux-x86_64/egg/keras/utils/data_utils.py to data_utils.cpython-34.pyc
byte-compiling build/bdist.linux-x86_64/egg/keras/utils/generic_utils.py to generic_utils.cpython-34.pyc
byte-compiling build/bdist.linux-x86_64/egg/keras/utils/np_utils.py to np_utils.cpython-34.pyc
byte-compiling build/bdist.linux-x86_64/egg/keras/activations.py to activations.cpython-34.pyc
byte-compiling build/bdist.linux-x86_64/egg/keras/objectives.py to objectives.cpython-34.pyc
byte-compiling build/bdist.linux-x86_64/egg/keras/backend/tensorflow_backend.py to tensorflow_backend.cpython-34.pyc
byte-compiling build/bdist.linux-x86_64/egg/keras/backend/__init__.py to __init__.cpython-34.pyc
byte-compiling build/bdist.linux-x86_64/egg/keras/backend/common.py to common.cpython-34.pyc
byte-compiling build/bdist.linux-x86_64/egg/keras/backend/theano_backend.py to theano_backend.cpython-34.pyc
byte-compiling build/bdist.linux-x86_64/egg/keras/regularizers.py to regularizers.cpython-34.pyc
byte-compiling build/bdist.linux-x86_64/egg/keras/callbacks.py to callbacks.cpython-34.pyc
byte-compiling build/bdist.linux-x86_64/egg/keras/initializations.py to initializations.cpython-34.pyc
byte-compiling build/bdist.linux-x86_64/egg/keras/constraints.py to constraints.cpython-34.pyc
creating build/bdist.linux-x86_64/egg/EGG-INFO
copying Keras.egg-info/PKG-INFO -> build/bdist.linux-x86_64/egg/EGG-INFO
copying Keras.egg-info/SOURCES.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying Keras.egg-info/dependency_links.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying Keras.egg-info/requires.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying Keras.egg-info/top_level.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
zip_safe flag not set; analyzing archive contents...
keras.backend.__pycache__.theano_backend.cpython-34: module MAY be using inspect.stack
creating 'dist/Keras-1.0.6-py3.4.egg' and adding 'build/bdist.linux-x86_64/egg' to it
removing 'build/bdist.linux-x86_64/egg' (and everything under it)
Processing Keras-1.0.6-py3.4.egg
removing '/usr/local/lib/python3.4/dist-packages/Keras-1.0.6-py3.4.egg' (and everything under it)
creating /usr/local/lib/python3.4/dist-packages/Keras-1.0.6-py3.4.egg
Extracting Keras-1.0.6-py3.4.egg to /usr/local/lib/python3.4/dist-packages
Keras 1.0.6 is already the active version in easy-install.pth

Installed /usr/local/lib/python3.4/dist-packages/Keras-1.0.6-py3.4.egg
Processing dependencies for Keras==1.0.6
Searching for six==1.10.0
Best match: six 1.10.0
Adding six 1.10.0 to easy-install.pth file

Using /usr/local/lib/python3.4/dist-packages
Searching for PyYAML==3.11
Best match: PyYAML 3.11
Adding PyYAML 3.11 to easy-install.pth file

Using /usr/local/lib/python3.4/dist-packages
Searching for Theano==0.9.0.dev2
Best match: Theano 0.9.0.dev2
Processing Theano-0.9.0.dev2-py3.4.egg
Theano 0.9.0.dev2 is already the active version in easy-install.pth
Installing theano-test script to /usr/local/bin
Installing theano-cache script to /usr/local/bin
Installing theano-nose script to /usr/local/bin

Using /usr/local/lib/python3.4/dist-packages/Theano-0.9.0.dev2-py3.4.egg
Searching for scipy==0.18.0
Best match: scipy 0.18.0
Adding scipy 0.18.0 to easy-install.pth file

Using /usr/local/lib/python3.4/dist-packages
Searching for numpy==1.11.1
Best match: bumpy 1.11.1
Adding numpy 1.11.1 to easy-install.pth file

Using /usr/local/lib/python3.4/dist-packages
Finished processing dependencies for Keras==1.0.6

root@b667c5f44d6a:~/keras# python3 /root/keras/examples/variational_autoencoder_deconv.py
Using Theano backend.
Using gpu device 0: Tesla K80 (CNMeM is enabled with initial size: 50.0% of memory, cuDNN 5005)
Traceback (most recent call last):
  File "/root/keras/examples/variational_autoencoder_deconv.py", line 9, in <module>
    from keras.layers import Convolution2D, Deconvolution2D, MaxPooling2D
ImportError: cannot import name 'Deconvolution2D'
root@b667c5f44d6a:~/keras#
inferrna commented 8 years ago

Having same issue. Installed convolutional.py has no Deconvolution2D declaration. @varoudis how did you fix this?

inferrna commented 8 years ago

Just fuxed it with:

before build and install keras again.