bullet3 icon indicating copy to clipboard operation
bullet3 copied to clipboard

pybullet_envs cannot render

Open markub3327 opened this issue 1 year ago • 1 comments

Hi,

I try to render the pyBullet but nothing to do. For more details please look here: https://github.com/openai/gym/issues/3073

Example 1:

import gym
import pybullet_envs

env = gym.make('HopperBulletEnv-v0')
env.render(mode="human")

env.reset()

for i in range(10000):
    obs, rewards, done, _ = env.step(env.action_space.sample())

Example 1 gives me a error:

/Users/martin/miniforge3/lib/python3.9/site-packages/gym/envs/registration.py:440: UserWarning: WARN: The registry.env_specs property along with EnvSpecTree is deprecated. Please use registry directly as a dictionary instead. logger.warn( pybullet build time: Sep 2 2022 11:52:28 /Users/martin/miniforge3/lib/python3.9/site-packages/gym/core.py:317: DeprecationWarning: WARN: Initializing wrapper in old step API which returns one bool instead of two. It is recommended to set new_step_api=True to use new step API. This will be the default behaviour in future. deprecation( /Users/martin/miniforge3/lib/python3.9/site-packages/gym/wrappers/step_api_compatibility.py:39: DeprecationWarning: WARN: Initializing environment in old step API which returns one bool instead of two. It is recommended to set new_step_api=True to use new step API. This will be the default behaviour in future. deprecation( /Users/martin/miniforge3/lib/python3.9/site-packages/gym/core.py:43: DeprecationWarning: WARN: The argument mode in render method is deprecated; use render_mode during environment initialization instead. See here for more information: https://www.gymlibrary.ml/content/api/ deprecation( Traceback (most recent call last): File "/Users/martin/Documents/Projects/rl-toolkit/test.py", line 5, in env.render(mode="human") File "/Users/martin/miniforge3/lib/python3.9/site-packages/gym/core.py", line 58, in render return render_func(self, *args, **kwargs) File "/Users/martin/miniforge3/lib/python3.9/site-packages/gym/core.py", line 421, in render return self.env.render(*args, **kwargs) File "/Users/martin/miniforge3/lib/python3.9/site-packages/gym/core.py", line 58, in render return render_func(self, *args, **kwargs) File "/Users/martin/miniforge3/lib/python3.9/site-packages/gym/wrappers/order_enforcing.py", line 47, in render raise ResetNeeded( gym.error.ResetNeeded: Cannot call env.render() before calling env.reset(), if this is a intended action, set disable_render_order_enforcing=True on the OrderEnforcer wrapper.

I try to change the order of env.render() - Example 2:

import gym
import pybullet_envs

env = gym.make('HopperBulletEnv-v0')

env.reset()
env.render(mode="human")

for i in range(10000):
    obs, rewards, done, _ = env.step(env.action_space.sample())

Example 2 doesn't give me an error only warnings, but nothing to do:

/Users/martin/miniforge3/lib/python3.9/site-packages/gym/envs/registration.py:440: UserWarning: WARN: The registry.env_specs property along with EnvSpecTree is deprecated. Please use registry directly as a dictionary instead. logger.warn( pybullet build time: Sep 2 2022 11:52:28 /Users/martin/miniforge3/lib/python3.9/site-packages/gym/core.py:317: DeprecationWarning: WARN: Initializing wrapper in old step API which returns one bool instead of two. It is recommended to set new_step_api=True to use new step API. This will be the default behaviour in future. deprecation( /Users/martin/miniforge3/lib/python3.9/site-packages/gym/wrappers/step_api_compatibility.py:39: DeprecationWarning: WARN: Initializing environment in old step API which returns one bool instead of two. It is recommended to set new_step_api=True to use new step API. This will be the default behaviour in future. deprecation( /Users/martin/miniforge3/lib/python3.9/site-packages/gym/utils/passive_env_checker.py:174: UserWarning: WARN: Future gym versions will require that Env.reset can be passed a seed instead of using Env.seed for resetting the environment random number generator. logger.warn( /Users/martin/miniforge3/lib/python3.9/site-packages/gym/utils/passive_env_checker.py:190: UserWarning: WARN: Future gym versions will require that Env.reset can be passed return_info to return information from the environment resetting. logger.warn( /Users/martin/miniforge3/lib/python3.9/site-packages/gym/utils/passive_env_checker.py:195: UserWarning: WARN: Future gym versions will require that Env.reset can be passed options to allow the environment initialisation to be passed additional information. logger.warn( argv[0]= argv[0]= /Users/martin/miniforge3/lib/python3.9/site-packages/gym/core.py:43: DeprecationWarning: WARN: The argument mode in render method is deprecated; use render_mode during environment initialization instead. See here for more information: https://www.gymlibrary.ml/content/api/ deprecation( /Users/martin/miniforge3/lib/python3.9/site-packages/gym/utils/passive_env_checker.py:280: UserWarning: WARN: No render modes was declared in the environment (env.metadata['render_modes'] is None or not defined), you may have trouble when calling .render(). logger.warn( /Users/martin/miniforge3/lib/python3.9/site-packages/gym/utils/passive_env_checker.py:227: DeprecationWarning: WARN: Core environment is written in old step API which returns one bool instead of two. It is recommended to rewrite the environment with new step API. logger.deprecation(

Installation instructions

  1. brew install swig
  2. pip3 install gym pybullet
  3. brew install ffmpeg

Thanks a lot for your time.

markub3327 avatar Sep 05 '22 14:09 markub3327

Solved with PR https://github.com/bulletphysics/bullet3/pull/4335

Thanks.

markub3327 avatar Sep 07 '22 13:09 markub3327