Fixing Common Gymnasium / Stable baselines errors

During my time learning, I've come across numerous errors while using Gymnasium and Stable Baselines, here is how I fixed some of them.


AttributeError: 'mujoco._structs.MjData' object has no attribute 'solver_iter'. Did you mean: 'solver_niter'?

Using a not-yet merged fix on Git Hub in the Gymnasium library commit below, you can get around this error. Hopefully, this won't be an issue for much longer as the changes get merged into a future release.

[Bug Fix] Small fixes for new mujoco release 3.0.0 by rodrigodelazcano · Pull Request #746 · Farama-Foundation/Gymnasium
Description Fix for mujoco rendering: The MjData member solver_iter has been renamed to solver_niter as specified in the changelog. We are also not using islands in our environments so we just ou...

Approximately line 593, replace

bottomleft, "Solver iterations", str(self.data.solver_iter + 1)

with

bottomleft, "Solver iterations", str(self.data.solver_niter[0] + 1)

This page will update over time.