Open mtib opened 4 years ago
I had this issue too 4 days after you did. I was able to resolve it by going to textgenrnn.py located in the
python installation folder\Lib\site-packages\textgenrnn
I changed line 14 from
from keras.backend.tensorflow_backend import set_session
to
from tensorflow.python.keras.backend import set_session
.
I think this is possibly due to TensorFlow changing things up.
Made a PR to fix, since it may not always be easy to tweak the local installation of textgenrnn, for example when using this module on a cloud service and modules get installed programmatically based on config files.
wait so what was this issue's solution, if using a cloud service? (I cant access the package files)
@ShadiestGoat now both the master branch and the TF 2.0 branch are not using the outdated import. Not sure about the status of the PyPi package, but you can always point pip directly to the GitHub repo.
I think pypi package also needs to be updated. Package there was published on 2nd of feb, keras fix was issued on 11th of feb.
For whom coming here through pip install textgenrnn
, I recommend this (from clean virtualenv without any keras version is installed):
git clone https://github.com/minimaxir/textgenrnn.git
cd textgenrnn
python setup.py install
Any update on the status of the PyPi package?
Did you guys manage to get this right? I am using: python3.8 tensorflow=2.2.0 And installed textgenrnn with pip3 install textgenrnn I still get: No module named 'keras.backend.tensorflow_backend'; 'keras.backend' is not a package
Try installing the keras package as well
I just did and did not work :( I managed to get it working locally by doing this:
git clone https://github.com/minimaxir/textgenrnn.git cd textgenrnn python setup.py install
The problem is that I want to deploy on heroku and heroku reads the requirements.txt file and use pip to install, then we are back to the problem... Any thoughts?
Any update on this?
Until a new pypi package is released, I have a janky solution that worked for me to be able to install it with pip (defined in requirements.txt).
pip allows you to define dependencies that point to to git repositories. This is the line that I put in my requirements.txt:
git+git://github.com/minimaxir/textgenrnn@master#egg=textgenrnn
You should also be able to use a different branch or a commit hash instead of master
. Also, the #egg
portion seems to tell pip what the name of the dependency is.
Obviously, this is a workaround until a new pypi package is published. Apologies if there's any misinformation above as I'm still a python newbie.
I had this issue too 4 days after you did. I was able to resolve it by going to textgenrnn.py located in the python installation folder\Lib\site-packages\textgenrnn I changed line 14 from
from keras.backend.tensorflow_backend import set_session
tofrom tensorflow.python.keras.backend import set_session
.I think this is possibly due to TensorFlow changing things up.
You the MVP dogg
When trying to run:
I get
I've tested in python 3.8.2 and python 3.7.7 under Ubuntu 20.04 after running pip3 install in a virtualenv for textgenrnn, keras and tensorflow.
The only hint I have to go off is the following error in the pip3 install for textgenrnn: