bullet3
bullet3 copied to clipboard
pybullet_envs cannot render
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 withEnvSpecTree
is deprecated. Please useregistry
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 setnew_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 setnew_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, inenv.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 callingenv.reset()
, if this is a intended action, setdisable_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 withEnvSpecTree
is deprecated. Please useregistry
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 setnew_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 setnew_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 thatEnv.reset
can be passed aseed
instead of usingEnv.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 thatEnv.reset
can be passedreturn_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 thatEnv.reset
can be passedoptions
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
- brew install swig
- pip3 install gym pybullet
- brew install ffmpeg
Thanks a lot for your time.
Solved with PR https://github.com/bulletphysics/bullet3/pull/4335
Thanks.