最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

python - What Are the Correct Versions of Tensorflow and Tensorflow Agents to Work with On Ubuntu 24.04? - Stack Overflow

programmeradmin6浏览0评论

I remember having worked with tensorflow agents (for reinforcement learning) more than three years back, on an Ubuntu 18.04 machine. Of course, all the dependencies, including python versions have been upgraded since then, and it seems with a lot of breaking changes.

So now that I need to build a custom tf_environment for a reinforcement learning projects, I cannot even get the dependencies set up to play with each other. Here is my pyproject.toml (I am using an old python version based on some google searches)

[project]
name = "rl-assignment"
version = "0.1.0"
description = "A project on reinforcement learning"
readme = "README.md"
requires-python = "==3.9.21"

and here is the requirement file

polars==1.24.0
numpy==1.26.4
tensorflow==2.18.0
tf-agents==0.5.0 # Later versions face issue with pygame

Based on this set up, I am trying to run a simple import (from Google's own tutorial)

from tf_agents.environments import py_environment
from tf_agents.environments import tf_environment
from tf_agents.environments import tf_py_environment
from tf_agents.environments import utils
from tf_agents.specs import array_spec
from tf_agents.environments import wrappers
from tf_agents.environments import suite_gym
from tf_agents.trajectories import time_step as ts

and I get

ModuleNotFoundError: No module named 'tensorflow.python.training.tracking'

But this is just an example, I tried multiple upgrades and downgrades of the version numbers based on some readings and posts, but each time it throws a new error, including on based on protobuf version as well.

Question

Just give me a clean and minimal requirements.txt file (and optionally, a python version, the later the better) where tensorflow and tf_agents can work with each with other.

I remember having worked with tensorflow agents (for reinforcement learning) more than three years back, on an Ubuntu 18.04 machine. Of course, all the dependencies, including python versions have been upgraded since then, and it seems with a lot of breaking changes.

So now that I need to build a custom tf_environment for a reinforcement learning projects, I cannot even get the dependencies set up to play with each other. Here is my pyproject.toml (I am using an old python version based on some google searches)

[project]
name = "rl-assignment"
version = "0.1.0"
description = "A project on reinforcement learning"
readme = "README.md"
requires-python = "==3.9.21"

and here is the requirement file

polars==1.24.0
numpy==1.26.4
tensorflow==2.18.0
tf-agents==0.5.0 # Later versions face issue with pygame

Based on this set up, I am trying to run a simple import (from Google's own tutorial)

from tf_agents.environments import py_environment
from tf_agents.environments import tf_environment
from tf_agents.environments import tf_py_environment
from tf_agents.environments import utils
from tf_agents.specs import array_spec
from tf_agents.environments import wrappers
from tf_agents.environments import suite_gym
from tf_agents.trajectories import time_step as ts

and I get

ModuleNotFoundError: No module named 'tensorflow.python.training.tracking'

But this is just an example, I tried multiple upgrades and downgrades of the version numbers based on some readings and posts, but each time it throws a new error, including on based on protobuf version as well.

Question

Just give me a clean and minimal requirements.txt file (and optionally, a python version, the later the better) where tensorflow and tf_agents can work with each with other.

Share asked Mar 11 at 8:05 DellaDella 1,6583 gold badges26 silver badges51 bronze badges 2
  • So you are looking at the versions that work for that specific code from a Google tutorial? In the tutorial they should specify what version of the libraries to use. – Cincinnatus Commented Mar 11 at 8:26
  • 1 Use tensorflow < 2.14.0: github/tensorflow/tensorflow/issues/… – phd Commented Mar 11 at 11:02
Add a comment  | 

1 Answer 1

Reset to default 0

For Tensorflow, you need to use version 2.14.0 or earlier, per the resolution of this issue.

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论