farizrahman4u / recurrentshop

Framework for building complex recurrent neural networks with Keras
MIT License
767 stars 218 forks source link

ImportError: cannot import name 'tensorflow_backend' #124

Open jlunit opened 3 years ago

jlunit commented 3 years ago

I keep getting this error below when I try to import the package:

from recurrentshop import * File "/usr/local/lib/python3.6/dist-packages/recurrentshop-1.0.0-py3.6.egg/recurrentshop/init.py", line 1, in File "/usr/local/lib/python3.6/dist-packages/recurrentshop-1.0.0-py3.6.egg/recurrentshop/engine.py", line 4, in File "/usr/local/lib/python3.6/dist-packages/recurrentshop-1.0.0-py3.6.egg/recurrentshop/backend/init.py", line 5, in File "/usr/local/lib/python3.6/dist-packages/recurrentshop-1.0.0-py3.6.egg/recurrentshop/backend/tensorflow_backend.py", line 1, in ImportError: cannot import name 'tensorflow_backend'

What might be the problem?

mikhail0920 commented 3 years ago

Same problem!

Mubashir4 commented 3 years ago

Same problem...

File "/home/s4523139/codes/Seq2Seq/TestCode/test.py", line 8, in from seq2seq import SimpleSeq2Seq, Seq2Seq, AttentionSeq2Seq

File "/home/s4523139/anaconda3/lib/python3.8/site-packages/seq2seq/init.py", line 1, in from .cells import *

File "/home/s4523139/anaconda3/lib/python3.8/site-packages/seq2seq/cells.py", line 1, in import recurrentshop

File "", line 259, in load_module

File "/home/s4523139/anaconda3/lib/python3.8/site-packages/recurrentshop-1.0.0-py3.8.egg/recurrentshop/init.py", line 1, in from .engine import *

File "", line 259, in load_module

File "/home/s4523139/anaconda3/lib/python3.8/site-packages/recurrentshop-1.0.0-py3.8.egg/recurrentshop/engine.py", line 4, in from .backend import rnn, learning_phase_scope

File "", line 259, in load_module

File "/home/s4523139/anaconda3/lib/python3.8/site-packages/recurrentshop-1.0.0-py3.8.egg/recurrentshop/backend/init.py", line 5, in from .tensorflow_backend import *

File "", line 259, in load_module

File "/home/s4523139/anaconda3/lib/python3.8/site-packages/recurrentshop-1.0.0-py3.8.egg/recurrentshop/backend/tensorflow_backend.py", line 1, in from keras.backend import tensorflow_backend as K

ImportError: cannot import name 'tensorflow_backend' from 'keras.backend' (/home/s4523139/anaconda3/lib/python3.8/site-packages/keras/backend.py)

sablea commented 3 years ago

same problem

ImportError Traceback (most recent call last)

in () ----> 1 from recurrentshop import RecurrentSequential,LSTMCell 2 from recurrentshop.cells import LSTMDecoderCell, AttentionDecoderCell 3 frames /content/recurrentshop/backend/tensorflow_backend.py in () ----> 1 from keras.backend import tensorflow_backend as K 2 import tensorflow as tf 3 4 5 class learning_phase_scope(object): ImportError: cannot import name 'tensorflow_backend' from 'keras.backend' (/usr/local/lib/python3.7/dist-packages/keras/backend.py)
sametapizza commented 2 years ago

Same problem...

amaralcs commented 2 years ago

Hey all, not sure this is still relevant to you but I found in another issue that using Keras==2.2.4 solves some issues, and it also solved this particular issue for me.

Hiilion commented 2 years ago

same error Traceback (most recent call last):

File "D:\SpyderProjects\TensorflowProjects\POL_seq2seq\POLwithseq2seq.py", line 8, in import recurrentshop

File "", line 259, in load_module

File "D:\Application\Python3.8.10\lib\site-packages\recurrentshop-1.0.0-py3.8.egg\recurrentshop__init__.py", line 1, in from .engine import *

File "", line 259, in load_module

File "D:\Application\Python3.8.10\lib\site-packages\recurrentshop-1.0.0-py3.8.egg\recurrentshop\engine.py", line 4, in from .backend import rnn, learning_phase_scope

File "", line 259, in load_module

File "D:\Application\Python3.8.10\lib\site-packages\recurrentshop-1.0.0-py3.8.egg\recurrentshop\backend__init__.py", line 5, in from .tensorflow_backend import *

File "", line 259, in load_module

File "D:\Application\Python3.8.10\lib\site-packages\recurrentshop-1.0.0-py3.8.egg\recurrentshop\backend\tensorflow_backend.py", line 1, in from keras.backend import tensorflow_backend as K

ImportError: cannot import name 'tensorflow_backend' from 'keras.backend' (D:\Application\Python3.8.10\lib\site-packages\keras\backend.py)

Hiilion commented 2 years ago

recurrent的最近一次更新是2019年。 tensorflow-2.2.0版本为2019年10月。 可以试试更换tensrflow和keras版本为2.2.0 我已经用此方法解决该问题

DaniloSerna commented 1 year ago

I have the same issue, but I am working inside the CMSSW environment:

Traceback (most recent call last): File "", line 1, in ImportError: cannot import name 'tensorflow_backend' from 'keras.backend' (/cvmfs/cms.cern.ch/slc7_amd64_gcc10/external/py3-Keras/2.4.3-llifpc2/lib/python3.9/site-packages/keras/backend.py)

: ***> abort program execution Does someone know how can I change the Keras and Tensorflow version inside the cmsenv? Thanks in advance!
Zhangmazi6666 commented 10 months ago

recurrent的最近一次更新是2019年。 tensorflow-2.2.0版本为2019年10月。 可以试试更换tensrflow和keras版本为2.2.0 我已经用此方法解决该问题

I think that U are correct. The project hasn't been updated for a long time, so we should use the old version keras and tensorflow too.

Zhangmazi6666 commented 10 months ago

Hey all, not sure this is still relevant to you but I found in another issue that using Keras==2.2.4 solves some issues, and it also solved this particular issue for me.

I think that U are correct. The project hasn't been updated for a long time, so we should use the old version keras and tensorflow too.