recurrentshop icon indicating copy to clipboard operation
recurrentshop copied to clipboard

ImportError: cannot import name 'tensorflow_backend'

Open jlunit opened this issue 4 years ago • 10 comments

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?

jlunit avatar Feb 19 '21 06:02 jlunit

Same problem!

mikhail0920 avatar Apr 14 '21 17:04 mikhail0920

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)

Mubashir4 avatar Apr 18 '21 03:04 Mubashir4

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)

sablea avatar May 07 '21 12:05 sablea

Same problem...

sametapizza avatar Dec 11 '21 14:12 sametapizza

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.

amaralcs avatar Jan 17 '22 20:01 amaralcs

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 avatar Mar 04 '22 07:03 Hiilion

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

Hiilion avatar Mar 04 '22 07:03 Hiilion

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) <FATAL> : ***> abort program execution

Does someone know how can I change the Keras and Tensorflow version inside the cmsenv? Thanks in advance!

DaniloSerna avatar Sep 06 '23 04:09 DaniloSerna

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 avatar Dec 02 '23 06:12 Zhangmazi6666

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.

Zhangmazi6666 avatar Dec 02 '23 06:12 Zhangmazi6666