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.
1 Answer
Reset to default 0For Tensorflow, you need to use version 2.14.0
or earlier, per the resolution of this issue.
tensorflow < 2.14.0
: github/tensorflow/tensorflow/issues/… – phd Commented Mar 11 at 11:02