[Python] What Are the Correct Versions of Tensorflow and Tensorflow Agents to Work with On...

Discussão em 'Python' iniciado por Stack, Março 14, 2025.

  1. Stack

    Stack Membro Participativo

    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.

    Continue reading...

Compartilhe esta Página