Skip to content

Commit

Permalink
Revert "[RLlib] Upgrade to gymnasium 1.0.0 (ale_py 0.10.1, mujoco 3.2…
Browse files Browse the repository at this point in the history
….4, pettingzoo 1.24.3 supersuit 3.9.3)." (ray-project#48297)

Reverts ray-project#45328
  • Loading branch information
can-anyscale authored Oct 28, 2024
1 parent bdd6ad0 commit d782b84
Show file tree
Hide file tree
Showing 49 changed files with 1,547 additions and 534 deletions.
2 changes: 1 addition & 1 deletion doc/source/ray-core/examples/plot_pong_example.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@
"@ray.remote\n",
"class RolloutWorker(object):\n",
" def __init__(self):\n",
" self.env = gym.make(\"ale_py:ALE/Pong-v5\")\n",
" self.env = gym.make(\"ALE/Pong-v5\")\n",
"\n",
" def compute_gradient(self, model):\n",
" # Compute a simulation episode.\n",
Expand Down
2 changes: 1 addition & 1 deletion doc/source/rllib/doc_code/dreamerv3_inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

env_name = "CartPole-v1"
# Use the vector env API.
env = gym.make_vec(env_name, num_envs=1, vectorization_mode="sync")
env = gym.vector.make(env_name, num_envs=1, asynchronous=False)

terminated = truncated = False
# Reset the env.
Expand Down
2 changes: 1 addition & 1 deletion doc/source/rllib/doc_code/training.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
try:
import gymnasium as gym

env = gym.make("ale_py:ALE/Pong-v5")
env = gym.make("ALE/Pong-v5")
obs, infos = env.reset()
except Exception:
import gym
Expand Down
2 changes: 1 addition & 1 deletion doc/source/rllib/rllib-examples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ in roughly 5min. It can be run like this on a single g5.24xlarge (or g6.24xlarge
.. code-block:: bash
$ cd ray/rllib/tuned_examples/ppo
$ python atari_ppo.py --env=ale_py:ALE/Pong-v5 --num-gpus=4 --num-env-runners=95
$ python atari_ppo.py --env ALE/Pong-v5 --num-gpus=4 --num-env-runners=95
Note that some of the files in this folder are used for RLlib's daily or weekly
release tests as well.
Expand Down
2 changes: 1 addition & 1 deletion python/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ colorful
rich
opentelemetry-sdk
fastapi
gymnasium==1.0.0
gymnasium==0.28.1
virtualenv!=20.21.1,>=20.0.24
opentelemetry-api
opencensus
Expand Down
35 changes: 25 additions & 10 deletions python/requirements/ml/rllib-test-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,43 @@
# Environment adapters.
# ---------------------
# Atari
imageio==2.34.2
ale_py==0.10.1
gymnasium==0.28.1; python_version < "3.12"
imageio; python_version < "3.12"
ale_py==0.8.1; python_version < "3.12"
# For testing MuJoCo envs with gymnasium.
mujoco==3.2.4
mujoco==2.3.6; python_version < "3.12"
dm_control==1.0.12; python_version < "3.12"

# For tests on PettingZoo's multi-agent envs.
pettingzoo==1.24.3
pettingzoo==1.23.1
# When installing pettingzoo, chess is missing, even though its a dependancy
# TODO: remove if a future pettingzoo and/or ray version fixes this dependancy issue.
chess==1.7.0
pymunk==6.2.1
tinyscaler==1.2.8
shimmy==2.0.0
supersuit==3.9.3
supersuit==3.8.0; python_version < "3.12"
tinyscaler==1.2.6; python_version < "3.12"
shimmy

# Kaggle envs.
kaggle_environments==1.7.11
# Unity3D testing
# TODO(sven): Add this back to rllib-requirements.txt once mlagents no longer pins torch<1.9.0 version.
#mlagents==0.28.0
mlagents_envs==0.28.0

# For tests on minigrid.
minigrid==2.3.1
minigrid
# For tests on RecSim and Kaggle envs.
# Explicitly depends on `tensorflow` and doesn't accept `tensorflow-macos`
recsim==0.2.4; (sys_platform != 'darwin' or platform_machine != 'arm64') and python_version < "3.12"
# recsim depends on dopamine-rl, but dopamine-rl pins gym <= 0.25.2, which break some envs
dopamine-rl==4.0.5; (sys_platform != 'darwin' or platform_machine != 'arm64') and python_version < "3.12"
tensorflow_estimator
# DeepMind's OpenSpiel
open-spiel==1.4
# Unity3D testing
mlagents_envs==0.28.0

# Requires libtorrent which is unavailable for arm64
autorom[accept-rom-license]; platform_machine != "arm64"
h5py==3.10.0

# Requirements for rendering.
Expand Down
31 changes: 23 additions & 8 deletions python/requirements_compiled.txt
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,10 @@ aiosqlite==0.19.0
# via ypy-websocket
alabaster==0.7.13
# via sphinx
ale-py==0.10.1
ale-py==0.8.1 ; python_version < "3.12"
# via
# -r /ray/ci/../python/requirements/ml/rllib-test-requirements.txt
# gymnasium
# gym
alembic==1.12.1
# via
# aim
Expand Down Expand Up @@ -272,6 +272,8 @@ charset-normalizer==3.3.2
# via
# requests
# snowflake-connector-python
chess==1.7.0
# via -r /ray/ci/../python/requirements/ml/rllib-test-requirements.txt
chex==0.1.7
# via optax
clang-format==12.0.1
Expand Down Expand Up @@ -304,6 +306,7 @@ cloudpickle==2.2.0
# -r /ray/ci/../python/requirements/test-requirements.txt
# dask
# distributed
# gym
# gymnasium
# hyperopt
# mlagents-envs
Expand Down Expand Up @@ -701,7 +704,13 @@ gsutil==5.27
# via -r /ray/ci/../python/requirements/docker/ray-docker-requirements.txt
gunicorn==20.1.0
# via mlflow
gymnasium==1.0.0
gym==0.26.2
# via
# dopamine-rl
# recsim
gym-notices==0.0.8
# via gym
gymnasium==0.28.1 ; python_version < "3.12"
# via
# -r /ray/ci/../python/requirements.txt
# -r /ray/ci/../python/requirements/ml/rllib-test-requirements.txt
Expand Down Expand Up @@ -1117,7 +1126,7 @@ msrestazure==0.6.4
# via
# -r /ray/ci/../python/requirements/test-requirements.txt
# azure-cli-core
mujoco==3.2.4
mujoco==2.3.6 ; python_version < "3.12"
# via
# -r /ray/ci/../python/requirements/ml/rllib-test-requirements.txt
# dm-control
Expand Down Expand Up @@ -1237,6 +1246,7 @@ numpy==1.26.4
# flax
# gpy
# gradio
# gym
# gymnasium
# h5py
# hpbandster
Expand Down Expand Up @@ -1280,6 +1290,7 @@ numpy==1.26.4
# pyro-ppl
# pytorch-lightning
# raydp
# recsim
# scikit-image
# scikit-learn
# scipy
Expand Down Expand Up @@ -1478,7 +1489,7 @@ pbr==6.0.0
# sarif-om
peewee==3.17.0
# via semgrep
pettingzoo==1.24.3
pettingzoo==1.23.1
# via -r /ray/ci/../python/requirements/ml/rllib-test-requirements.txt
pexpect==4.8.0
# via
Expand Down Expand Up @@ -1851,6 +1862,8 @@ querystring-parser==1.2.4
# via raydp
raydp==1.7.0b20231020.dev0
# via -r /ray/ci/../python/requirements/ml/data-test-requirements.txt
recsim==0.2.4 ; (sys_platform != "darwin" or platform_machine != "arm64") and python_version < "3.12"
# via -r /ray/ci/../python/requirements/ml/rllib-test-requirements.txt
redis==4.4.2
# via -r /ray/ci/../python/requirements/test-requirements.txt
regex==2024.5.15
Expand Down Expand Up @@ -2036,7 +2049,7 @@ shellcheck-py==0.7.1.1
# via -r /ray/ci/../python/requirements/lint-requirements.txt
shellingham==1.5.4
# via typer
shimmy==2.0.0
shimmy==1.3.0
# via -r /ray/ci/../python/requirements/ml/rllib-test-requirements.txt
shortuuid==1.0.1
# via -r /ray/ci/../python/requirements/ml/tune-test-requirements.txt
Expand Down Expand Up @@ -2154,7 +2167,9 @@ statsmodels==0.14.0
# via
# hpbandster
# statsforecast
supersuit==3.9.3
strictyaml==1.7.3
# via pyiceberg
supersuit==3.8.0 ; python_version < "3.12"
# via -r /ray/ci/../python/requirements/ml/rllib-test-requirements.txt
sympy==1.13.1
# via
Expand Down Expand Up @@ -2241,7 +2256,7 @@ timm==0.9.2
# via -r /ray/ci/../python/requirements/ml/tune-test-requirements.txt
tinycss2==1.3.0
# via nbconvert
tinyscaler==1.2.8
tinyscaler==1.2.6 ; python_version < "3.12"
# via
# -r /ray/ci/../python/requirements/ml/rllib-test-requirements.txt
# supersuit
Expand Down
2 changes: 1 addition & 1 deletion python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ def get_packages(self):

setup_spec.extras["rllib"] = setup_spec.extras["tune"] + [
"dm_tree",
"gymnasium==1.0.0",
"gymnasium==0.28.1",
"lz4",
"scikit-image",
"pyyaml",
Expand Down
14 changes: 13 additions & 1 deletion release/ray_release/byod/requirements_byod_3.9.txt
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ aiosignal==1.3.1 \
# via
# -c release/ray_release/byod/requirements_compiled.txt
# aiohttp
ale-py==0.9.0 \
ale-py==0.8.1 \
--hash=sha256:0006d80dfe7745eb5a93444492337203c8bc7eb594a2c24c6a651c5c5b0eaf09 \
--hash=sha256:0856ca777473ec4ae8a59f3af9580259adb0fd4a47d586a125a440c62e82fc10 \
--hash=sha256:0ffecb5c956749596030e464827642945162170a132d093c3d4fa2d7e5725c18 \
Expand Down Expand Up @@ -1242,6 +1242,17 @@ gsutil==5.27 \
# via
# -c release/ray_release/byod/requirements_compiled.txt
# -r release/ray_release/byod/requirements_byod_3.9.in
gym[atari]==0.26.2 \
--hash=sha256:e0d882f4b54f0c65f203104c24ab8a38b039f1289986803c7d02cdbe214fbcc4
# via
# -c release/ray_release/byod/requirements_compiled.txt
# -r release/ray_release/byod/requirements_byod_3.9.in
gym-notices==0.0.8 \
--hash=sha256:ad25e200487cafa369728625fe064e88ada1346618526102659b4640f2b4b911 \
--hash=sha256:e5f82e00823a166747b4c2a07de63b6560b1acb880638547e0cabf825a01e463
# via
# -c release/ray_release/byod/requirements_compiled.txt
# gym
h5py==3.10.0 \
--hash=sha256:012ab448590e3c4f5a8dd0f3533255bc57f80629bf7c5054cf4c87b30085063c \
--hash=sha256:212bb997a91e6a895ce5e2f365ba764debeaef5d2dca5c6fb7098d66607adf99 \
Expand Down Expand Up @@ -1728,6 +1739,7 @@ numpy==1.26.4 \
# ale-py
# bokeh
# dask
# gym
# h5py
# lightgbm
# ml-dtypes
Expand Down
4 changes: 2 additions & 2 deletions rllib/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -2543,8 +2543,8 @@ py_test(
name = "examples/envs/env_rendering_and_recording",
srcs = ["examples/envs/env_rendering_and_recording.py"],
tags = ["team:rllib", "exclusive", "examples"],
size = "medium",
args = ["--enable-new-api-stack", "--env=CartPole-v1", "--stop-iters=2"]
size = "small",
args = ["--enable-new-api-stack", "--env=CartPole-v1", "--stop-iters=3"]
)

#@OldAPIStack
Expand Down
2 changes: 1 addition & 1 deletion rllib/algorithms/algorithm_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -3559,7 +3559,7 @@ def is_atari(self) -> bool:
# Not yet determined, try to figure this out.
if self._is_atari is None:
# Atari envs are usually specified via a string like "PongNoFrameskip-v4"
# or "ale_py:ALE/Breakout-v5".
# or "ALE/Breakout-v5".
# We do NOT attempt to auto-detect Atari env for other specified types like
# a callable, to avoid running heavy logics in validate().
# For these cases, users can explicitly set `environment(atari=True)`.
Expand Down
2 changes: 1 addition & 1 deletion rllib/algorithms/dreamerv3/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ in combination with the following scripts and command lines in order to run RLli
### [Atari100k](../../tuned_examples/dreamerv3/atari_100k.py)
```shell
$ cd ray/rllib/tuned_examples/dreamerv3/
$ python atari_100k.py --env ale_py:ALE/Pong-v5
$ python atari_100k.py --env ALE/Pong-v5
```

### [DeepMind Control Suite (vision)](../../tuned_examples/dreamerv3/dm_control_suite_vision.py)
Expand Down
2 changes: 1 addition & 1 deletion rllib/algorithms/dreamerv3/tests/test_dreamerv3.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def test_dreamerv3_compilation(self):
for env in [
"FrozenLake-v1",
"CartPole-v1",
"ale_py:ALE/MsPacman-v5",
"ALE/MsPacman-v5",
"Pendulum-v1",
]:
print("Env={}".format(env))
Expand Down
Loading

0 comments on commit d782b84

Please sign in to comment.