Skip to content

[Bug Report] Error when calling recover_environment(): Monitor wrapper does not inherit from RecordConstructorArgs #302

@LorenzoBonanni

Description

@LorenzoBonanni

Describe the bug
Calling recover_environment() on the 'mujoco/humanoidstandup/medium-v0' dataset raises a ValueError related to the Monitor wrapper not inheriting from gymnasium.utils.RecordConstructorArgs. This prevents the environment from being recreated.

Code example

import minari

dataset = minari.load_dataset('mujoco/humanoidstandup/medium-v0', download=True)

test_env = dataset.recover_environment()

Stack trace

Traceback (most recent call last):
  File "/home/lorenzobonanni/PycharmProjects/PythonProject/file.py", line 5, in <module>
    test_env = dataset.recover_environment()
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/lorenzobonanni/miniconda3/envs/PythonProject/lib/python3.12/site-packages/minari/dataset/minari_dataset.py", line 219, in recover_environment
    return gym.make(self.env_spec, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/lorenzobonanni/miniconda3/envs/PythonProject/lib/python3.12/site-packages/gymnasium/envs/registration.py", line 820, in make
    raise ValueError(
ValueError: Monitor wrapper does not inherit from `gymnasium.utils.RecordConstructorArgs`, therefore, the wrapper cannot be recreated.

System Info

  • Minari install method: pip install "minari[all]"
  • Operating system: Ubuntu 22.04.4 LTS
  • Python version: 3.12.11 (conda)
  • Minari version: 0.5.3
  • MuJoCo version: 3.2.3
  • Gymnasium version: 1.1.1
  • Pillow version: 11.2.1

Additional context
I found a workaround: before calling recover_environment(), I set dataset.env_spec.additional_wrappers = (), which avoids the error.

import minari

dataset = minari.load_dataset('mujoco/humanoidstandup/medium-v0', download=True)

# Workaround to avoid the error
dataset.env_spec.additional_wrappers = ()

test_env = dataset.recover_environment()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions