Closed zichunxx closed 7 months ago
First of all, note that the error is only triggered when the objects are destroyed (so your code works all the way through, and isn't stopped early).
Secondly, I'm aware of this error, and it's actually a pybullet issue. In its magic method __del__
, it tries to catch an error that doesn't inherits from BaseException. But in any case, even if this error is correctly caught, there are no instructions (see pybullet source code). Hence, you can safely ignore it.
Thanks for your quick response!
For the record, I'm not able to reproduce the error, in my case the code runs without error with both algorithms
Could you please tell me your system and lib version information? I want to give it a try.
In fact, I've managed to reproduce it, so here's an explanation:
When you don't close an environment (no env.close()
), pybullet takes care of closing it at the end of the script (when all objects are destroyed), and disconnecting the simulation server. However, pybullet doesn't do this correctly (see above). To avoid this error, simply add an env.close()
to close the environment properly:
import gymnasium as gym
from stable_baselines3 import DDPG
from stable_baselines3.common.evaluation import evaluate_policy
import panda_gym
env = gym.make("PandaPickAndPlace-v3")
model = DDPG("MultiInputPolicy", env)
evaluate_policy(model, env, n_eval_episodes=100, warn=False)
env.close()
It works! Thanks again for your positive help.
Describe the bug
Hi!
I was following the
stable_baseline
tutorial to reproduce a training script forPandaPickAndPlace-v3 env
. When I ran the following code snippet, I met this error:It seems that this error is triggered by
pybullet
. For further confirmation, I created anotherCartPole-v1
env with thePPO
policy, and this error was gone. If thebullet
is shut down in an improper way in thePandaPickAndPlace-v3
env script?Thanks!
To Reproduce
Provide a minimal code :
System
python --version
): Python 3.9.18pip list | grep panda-gym
): 3.0.7