ray icon indicating copy to clipboard operation
ray copied to clipboard

RLlib Custom Gymnasium Example Fails

Open dkunz49 opened this issue 1 year ago • 3 comments

What happened + What you expected to happen

I tried to run custom_gym_env.py using 'python3 custom_gym_env.py --enable-new-api-stack' as instructed in the file. The traceback follows.

Traceback (most recent call last): File "custom_gym_env.py", line 55, in from ray.rllib.utils.test_utils import ( File "/home/dkunz/anaconda3/envs/rllib/lib/python3.8/site-packages/ray/rllib/init.py", line 7, in from ray.rllib.env.base_env import BaseEnv File "/home/dkunz/anaconda3/envs/rllib/lib/python3.8/site-packages/ray/rllib/env/init.py", line 1, in from ray.rllib.env.base_env import BaseEnv File "/home/dkunz/anaconda3/envs/rllib/lib/python3.8/site-packages/ray/rllib/env/base_env.py", line 6, in from ray.rllib.utils.annotations import OldAPIStack File "/home/dkunz/anaconda3/envs/rllib/lib/python3.8/site-packages/ray/rllib/utils/init.py", line 6, in from ray.rllib.utils.filter import Filter File "/home/dkunz/anaconda3/envs/rllib/lib/python3.8/site-packages/ray/rllib/utils/filter.py", line 11, in from ray.rllib.utils.serialization import _serialize_ndarray, _deserialize_ndarray File "/home/dkunz/anaconda3/envs/rllib/lib/python3.8/site-packages/ray/rllib/utils/serialization.py", line 24, in old_gym_text_class = getattr(old_gym.spaces, "Text", None) AttributeError: module 'gym' has no attribute 'spaces'

Versions / Dependencies

OS: Ubuntu 22.04 LTS

Short Dependencies List: conda 23.5.0 python 3.8.19 ray 2.10.3 gymnasium 0.28.1

Complete Dependencies List: _libgcc_mutex 0.1 main
_openmp_mutex 5.1 1_gnu
absl-py 2.1.0 pypi_0 pypi aiosignal 1.3.1 pypi_0 pypi ale-py 0.8.1 pypi_0 pypi astunparse 1.6.3 pypi_0 pypi atari-py 0.2.9 pypi_0 pypi attrs 23.2.0 pypi_0 pypi autorom 0.4.2 pypi_0 pypi autorom-accept-rom-license 0.6.1 pypi_0 pypi ca-certificates 2024.3.11 h06a4308_0
cachetools 5.3.3 pypi_0 pypi certifi 2024.2.2 pypi_0 pypi charset-normalizer 3.3.2 pypi_0 pypi click 8.1.7 pypi_0 pypi cloudpickle 3.0.0 pypi_0 pypi dm-tree 0.1.8 pypi_0 pypi farama-notifications 0.0.4 pypi_0 pypi filelock 3.13.4 pypi_0 pypi flatbuffers 24.3.25 pypi_0 pypi frozenlist 1.4.1 pypi_0 pypi fsspec 2024.3.1 pypi_0 pypi gast 0.4.0 pypi_0 pypi google-auth 2.29.0 pypi_0 pypi google-auth-oauthlib 1.0.0 pypi_0 pypi google-pasta 0.2.0 pypi_0 pypi grpcio 1.62.2 pypi_0 pypi gymnasium 0.28.1 pypi_0 pypi h5py 3.11.0 pypi_0 pypi idna 3.7 pypi_0 pypi imageio 2.34.1 pypi_0 pypi importlib-metadata 7.1.0 pypi_0 pypi importlib-resources 6.4.0 pypi_0 pypi jax-jumpy 1.0.0 pypi_0 pypi jsonschema 4.21.1 pypi_0 pypi jsonschema-specifications 2023.12.1 pypi_0 pypi keras 2.13.1 pypi_0 pypi lazy-loader 0.4 pypi_0 pypi ld_impl_linux-64 2.38 h1181459_1
libclang 18.1.1 pypi_0 pypi libffi 3.4.4 h6a678d5_0
libgcc-ng 11.2.0 h1234567_1
libgomp 11.2.0 h1234567_1
libstdcxx-ng 11.2.0 h1234567_1
lz4 4.3.3 pypi_0 pypi markdown 3.6 pypi_0 pypi markdown-it-py 3.0.0 pypi_0 pypi markupsafe 2.1.5 pypi_0 pypi mdurl 0.1.2 pypi_0 pypi msgpack 1.0.8 pypi_0 pypi ncurses 6.4 h6a678d5_0
networkx 3.1 pypi_0 pypi numpy 1.24.3 pypi_0 pypi oauthlib 3.2.2 pypi_0 pypi openssl 3.0.13 h7f8727e_0
opt-einsum 3.3.0 pypi_0 pypi packaging 24.0 pypi_0 pypi pandas 2.0.3 pypi_0 pypi pillow 10.3.0 pypi_0 pypi pip 23.3.1 py38h06a4308_0
pkgutil-resolve-name 1.3.10 pypi_0 pypi protobuf 4.25.3 pypi_0 pypi pyarrow 16.0.0 pypi_0 pypi pyasn1 0.6.0 pypi_0 pypi pyasn1-modules 0.4.0 pypi_0 pypi pygments 2.17.2 pypi_0 pypi python 3.8.19 h955ad1f_0
python-dateutil 2.9.0.post0 pypi_0 pypi pytz 2024.1 pypi_0 pypi pywavelets 1.4.1 pypi_0 pypi pyyaml 6.0.1 pypi_0 pypi ray 2.10.0 pypi_0 pypi readline 8.2 h5eee18b_0
referencing 0.34.0 pypi_0 pypi requests 2.31.0 pypi_0 pypi requests-oauthlib 2.0.0 pypi_0 pypi rich 13.7.1 pypi_0 pypi rpds-py 0.18.0 pypi_0 pypi rsa 4.9 pypi_0 pypi scikit-image 0.21.0 pypi_0 pypi scipy 1.10.1 pypi_0 pypi setuptools 68.2.2 py38h06a4308_0
shellingham 1.5.4 pypi_0 pypi shimmy 0.2.1 pypi_0 pypi six 1.16.0 pypi_0 pypi sqlite 3.41.2 h5eee18b_0
tensorboard 2.13.0 pypi_0 pypi tensorboard-data-server 0.7.2 pypi_0 pypi tensorboardx 2.6.2.2 pypi_0 pypi tensorflow 2.13.1 pypi_0 pypi tensorflow-estimator 2.13.0 pypi_0 pypi tensorflow-io-gcs-filesystem 0.34.0 pypi_0 pypi termcolor 2.4.0 pypi_0 pypi tifffile 2023.7.10 pypi_0 pypi tk 8.6.12 h1ccaba5_0
tqdm 4.66.2 pypi_0 pypi typer 0.12.3 pypi_0 pypi typing-extensions 4.5.0 pypi_0 pypi tzdata 2024.1 pypi_0 pypi urllib3 2.2.1 pypi_0 pypi werkzeug 3.0.2 pypi_0 pypi wheel 0.41.2 py38h06a4308_0
wrapt 1.16.0 pypi_0 pypi xz 5.4.6 h5eee18b_0
zipp 3.18.1 pypi_0 pypi zlib 1.2.13 h5eee18b_0

Reproduction script

See ray-project on github: 'ray/rllib/examples/envs/custom_gym_env.py'

Issue Severity

High: It blocks me from completing my task.

dkunz49 avatar Apr 24 '24 13:04 dkunz49

@dkunz49 I ran the example, and is working on my side. I am running Python 3.9 but my gymansium and ray version match.

peterghaddad avatar Apr 24 '24 17:04 peterghaddad

Hmm. Just after I posted the issue, I ran into some conflict issues while updating the conda environment. That may be the underlying problem. I'm going to try to run it in a Docker container, if I can figure out how to do that. Also, I'm going to see if I can clean up the conflicts. It may be a while before I can report further.

dkunz49 avatar Apr 26 '24 13:04 dkunz49

It appears that the issue was indeed package conflicts. I started all over with conda and created a new environment. Once all of the dependencies were satisfied, it ran fine.

dkunz49 avatar Apr 29 '24 17:04 dkunz49

@dkunz49 Does it run stable in your new environment? Can we then close this issue?

simonsays1980 avatar May 01 '24 09:05 simonsays1980

Close it. All is well.

On Wed, May 1, 2024 at 5:10 AM simonsays1980 @.***> wrote:

@dkunz49 https://github.com/dkunz49 Does it run stable in your new environment? Can we then close this issue?

— Reply to this email directly, view it on GitHub https://github.com/ray-project/ray/issues/44950#issuecomment-2088188464, or unsubscribe https://github.com/notifications/unsubscribe-auth/AUN3I2RJ47KOMQMF7PQQG73ZACWQ3AVCNFSM6AAAAABGW5Q5BWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAOBYGE4DQNBWGQ . You are receiving this because you were mentioned.Message ID: @.***>

dkunz49 avatar May 01 '24 12:05 dkunz49

We can close this issue - following @dkunz49 comment above. Thanks @dkunz49!

simonsays1980 avatar May 03 '24 08:05 simonsays1980