Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gymnasium and PyBullet envs: Problem with video capture #450

Open
3 tasks done
nikisim opened this issue Mar 7, 2024 · 0 comments
Open
3 tasks done

Gymnasium and PyBullet envs: Problem with video capture #450

nikisim opened this issue Mar 7, 2024 · 0 comments

Comments

@nikisim
Copy link

nikisim commented Mar 7, 2024

Problem Description

I'm trying to train different models using CleanRL with a custom PyBullet environment. I couldn't use PyBullet directly due to a conflict with Gymnasium, so I installed pybullet_envs_gymnasium from this link: https://github.com/araffin/pybullet_envs_gymnasium/tree/master. Now I can train default bullet envs successfully, but without videos captured.

However, I'm facing an issue when trying to capture video: "pybullet.error: Not connected to physics server." Can you help me with this problem? Also, do you know when PyBullet environments will be available in CleanRL?

Thanks.

Checklist

Current Behavior

I can train PyBullet envs, but without video capturing. It starts to record video for 2 sec and then an error occurs.

Expected Behavior

I can train PyBullet envs with video capturing

Logs:

pybullet build time: Nov 28 2023 23:45:17
/home/user/.local/lib/python3.10/site-packages/wandb/sdk/lib/import_hooks.py:243: DeprecationWarning: Deprecated since Python 3.4 and slated for removal in Python 3.12; use importlib.util.find_spec() instead
  loader = importlib.find_loader(fullname, path)
argv[0]=
argv[0]=
Moviepy - Building video /home/user/cleanrl/videos/HopperBulletEnv-v0__sac_continuous_action__1__1709820664/rl-video-episode-0.mp4.
Moviepy - Writing video /home/user/cleanrl/videos/HopperBulletEnv-v0__sac_continuous_action__1__1709820664/rl-video-episode-0.mp4

Moviepy - Done !                                                                                                                                                               
Moviepy - video ready /home/nikisim/Mag_diplom/cleanrl/videos/HopperBulletEnv-v0__sac_continuous_action__1__1709820664/rl-video-episode-0.mp4
Traceback (most recent call last):
  File "/home/user/cleanrl/cleanrl/sac_continuous_action.py", line 227, in <module>
    next_obs, rewards, terminations, truncations, infos = envs.step(actions)
  File "/home/user/.local/lib/python3.10/site-packages/gymnasium/vector/vector_env.py", line 203, in step
    return self.step_wait()
  File "/home/user/.local/lib/python3.10/site-packages/gymnasium/vector/sync_vector_env.py", line 153, in step_wait
    observation, info = env.reset()
  File "/home/user/.local/lib/python3.10/site-packages/gymnasium/wrappers/record_episode_statistics.py", line 73, in reset
    obs, info = super().reset(**kwargs)
  File "/home/user/.local/lib/python3.10/site-packages/gymnasium/core.py", line 414, in reset
    return self.env.reset(seed=seed, options=options)
  File "/home/user/.local/lib/python3.10/site-packages/gymnasium/wrappers/record_video.py", line 106, in reset
    observations = super().reset(**kwargs)
  File "/home/user/.local/lib/python3.10/site-packages/gymnasium/core.py", line 414, in reset
    return self.env.reset(seed=seed, options=options)
  File "/home/user/.local/lib/python3.10/site-packages/gymnasium/wrappers/time_limit.py", line 75, in reset
    return self.env.reset(**kwargs)
  File "/home/user/.local/lib/python3.10/site-packages/gymnasium/wrappers/order_enforcing.py", line 61, in reset
    return self.env.reset(**kwargs)
  File "/home/user/.local/lib/python3.10/site-packages/gymnasium/wrappers/env_checker.py", line 57, in reset
    return self.env.reset(**kwargs)
  File "/home/user/.local/lib/python3.10/site-packages/pybullet_envs_gymnasium/gym_locomotion_envs.py", line 43, in reset
    self._p.restoreState(self.stateId)
pybullet.error: Not connected to physics server.
Traceback (most recent call last):
  File "/home/user/cleanrl/cleanrl/sac_continuous_action.py", line 227, in <module>
    next_obs, rewards, terminations, truncations, infos = envs.step(actions)
  File "/home/user/.local/lib/python3.10/site-packages/gymnasium/vector/vector_env.py", line 203, in step
    return self.step_wait()
  File "/home/user/.local/lib/python3.10/site-packages/gymnasium/vector/sync_vector_env.py", line 153, in step_wait
    observation, info = env.reset()
  File "/home/user/.local/lib/python3.10/site-packages/gymnasium/wrappers/record_episode_statistics.py", line 73, in reset
    obs, info = super().reset(**kwargs)
  File "/home/user/.local/lib/python3.10/site-packages/gymnasium/core.py", line 414, in reset
    return self.env.reset(seed=seed, options=options)
  File "/home/user/.local/lib/python3.10/site-packages/gymnasium/wrappers/record_video.py", line 106, in reset
    observations = super().reset(**kwargs)
  File "/home/user/.local/lib/python3.10/site-packages/gymnasium/core.py", line 414, in reset
    return self.env.reset(seed=seed, options=options)
  File "/home/user/.local/lib/python3.10/site-packages/gymnasium/wrappers/time_limit.py", line 75, in reset
    return self.env.reset(**kwargs)
  File "/home/user/.local/lib/python3.10/site-packages/gymnasium/wrappers/order_enforcing.py", line 61, in reset
    return self.env.reset(**kwargs)
  File "/home/user/.local/lib/python3.10/site-packages/gymnasium/wrappers/env_checker.py", line 57, in reset
    return self.env.reset(**kwargs)
  File "/home/user/.local/lib/python3.10/site-packages/pybullet_envs_gymnasium/gym_locomotion_envs.py", line 43, in reset
    self._p.restoreState(self.stateId)
pybullet.error: Not connected to physics server.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant