Open ManosL opened 1 year ago
This resolution is not work for me, do you have any other method?
You can patch gym as done in the RL Zoo: https://github.com/DLR-RM/rl-baselines3-zoo/pull/256
The file: https://github.com/DLR-RM/rl-baselines3-zoo/blob/feat/gym-0.24/rl_zoo3/gym_patches.py
and then use apply_api_compatibility=True
when creating the env.
(soon you will be able to apply the patches by simply doing import rl_zoo3.gym_patches
)
This resolution is not work for me, do you have any other method?
when i change gym0.26.0 -> 0.18.0,it works
This error is caused by this update to the gym environment (since 0.26), the env_spec
was removed in favour of a simple dictionary. The suggested change looks good to me. I used the following temporary workaround to keep using 0.26:
from collections import UserDict
import gym
import gym.envs.registration
# Do this before importing pybullet_envs (adds an extra property env_specs as a property to the registry, so it looks like the <0.26 envspec version)
registry = UserDict(gym.envs.registration.registry)
registry.env_specs = gym.envs.registration.registry
gym.envs.registration.registry = registry
import pybullet_envs
racecar_env = gym.make('RacecarBulletEnv-v0')
This requires a fix in Bullet? Is there a run-time version check of gym, so we can implement both old and new method?
This requires a fix in Bullet? Is there a run-time version check of gym, so we can implement both old and new method?
This PR should already fix it: https://github.com/bulletphysics/bullet3/pull/4332 (it should work with both gym 0.21 and 0.26)
The check in gym is here: https://github.com/openai/gym/blob/master/gym/envs/registration.py#L497-L498
Fyi, I pushed and released on pypi a subset of pybullet envs compatible with gymnasium: https://github.com/araffin/pybullet_envs_gymnasium
pip install pybullet_envs_gymnasium
(I will crosspost this message as it may interest several people)
Before starting I want to mention that I have install the OpenAI gym version
0.26.2
and pybullet version3.2.5
. When I try to importpybullet_envs
package, I get the following error:Does anyone knows how to fix this issue? I suspect the reason for this is the following:
The error is raised at pybullet_envs/init.py which does the following:
I changed it to this and the error was removed
If you want you can have a look Thanks