Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImportError: cannot import name 'tensorflow_backend' #124

Open
jlunit opened this issue Feb 19, 2021 · 10 comments
Open

ImportError: cannot import name 'tensorflow_backend' #124

jlunit opened this issue Feb 19, 2021 · 10 comments

Comments

@jlunit
Copy link

jlunit commented Feb 19, 2021

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
Copy link

Same problem!

@Mubashir4
Copy link

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
Copy link

sablea commented May 7, 2021

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
Copy link

Same problem...

@amaralcs
Copy link

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
Copy link

Hiilion commented Mar 4, 2022

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
Copy link

Hiilion commented Mar 4, 2022

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

@DaniloSerna
Copy link

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
Copy link

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
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants