英文:
cannot import name 'type_spec_registry' from 'tensorflow.python.framework'
问题
我正在进行我的硕士项目,使用MARL,并决定使用RLLib。我为我的项目创建了一个conda环境,并安装了RLLib:
pip install "ray[rllib]" tensorflow
随后,我尝试运行一个实验:
rllib train --algo DQN --env CartPole-v1
但出现了以下错误:“ImportError: 无法从'tensorflow.python.framework'导入名称'type_spec_registry'。”
我正在使用Tensorflow 2.11。
提前感谢!我试图运行一个RLLib库的实验,以测试库是否正确安装。
英文:
I am working on my Master's project with MARL, and i decided to use RLLib. I created a conda environment for my project and installed RLLib:
pip install "ray[rllib]" tensorflow
Later on, i tried to run one experiment:
rllib train --algo DQN --env CartPole-v1
But got the following error: "ImportError: cannot import name 'type_spec_registry' from 'tensorflow.python.framework'"
I am using Tensorflow 2.11.
Thanks in advance!
I was trying to run one experiment from RLLib library in order to test if the library is correctly installed.
答案1
得分: 4
我在安装tf-nightly
后,然后回滚到tensorflow
v2.11.0后遇到了相同的问题。
我不确定根本原因,但将tensorflow降级到版本2.10.1可以解决这个问题。之后,我可以升级回2.11.0而不会出现导入异常。
# 降级
pip install tensorflow==2.10.1
# 在这一点上tensorflow可以正常工作
# 然后升级到最新版本也可以正常工作
pip install -U tensorflow
英文:
I had the same issue after installing tf-nightly
then reverting back to tensorflow
v2.11.0.
I'm unsure of root cause, but downgrading tensorflow to version 2.10.1 fixed it on my machine. After this I was able to upgrade back to 2.11.0 without the import exception.
# downgrade
pip install tensorflow==2.10.1
# tensorflow was working at this point
# then upgrading to the latest worked as well
pip install -U tensorflow
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论