NVlabs/mimicgen

Can mimicgen be run on M2 Chip in MacOS Sonoma?

Closed this issue · 3 comments

When I run the following command -
python mimicgen/scripts/prepare_src_dataset.py --dataset datasets/source/coffee.hdf5 --env_interface MG_Coffee --env_interface_type robosuite
I get the following error -

RuntimeError: Could not find supported GCC executable.

HINT: On OS X, install GCC 9.x with `brew install gcc@9`. or `port install gcc9`.

When I try to install gcc9 using brew install gcc@9 using the above hint I get the following error -

gcc@9: This formula either does not compile or function as expected on macOS
versions newer than Monterey due to an upstream incompatibility.
gcc@9: The x86_64 architecture is required for this software.
Error: gcc@9: Unsatisfied requirements failed this build.

Looks like the root cause of this is ISA incompatibility of gcc9 and the underlying ARM ISA of M2 chip + Sonoma.

Any workaround to get mimicgen running on macos? or is it only on linux based systems?

Thanks!

My system specification are the following -

System Version: macOS 14.6.1 (23G93)
Kernel Version: Darwin 23.6.0
Model Name: MacBook Air
Model Identifier: Mac14,2
Model Number: MLY13LL/A
Chip: Apple M2
Total Number of Cores: 8 (4 performance and 4 efficiency)
Memory: 8 GB

I have not tested on Macbook M2, but MimicGen works fine on M1.

Do you know which package is asking for the GCC executable?

This is the full error -

ROBOMIMIC WARNING(
    No private macro file found!
    It is recommended to use a private macro file
    To setup, run: python /Users/megh/work/projects/robomimic/robomimic/scripts/setup_macros.py
)
[robosuite WARNING] No private macro file found! (macros.py:53)
[robosuite WARNING] It is recommended to use a private macro file (macros.py:54)
[robosuite WARNING] To setup, run: python /Users/megh/work/projects/robosuite/robosuite/scripts/setup_macros.py (macros.py:55)
Traceback (most recent call last):
  File "/Users/megh/work/projects/mimicgen/mimicgen/scripts/prepare_src_dataset.py", line 255, in <module>
    prepare_src_dataset(
  File "/Users/megh/work/projects/mimicgen/mimicgen/scripts/prepare_src_dataset.py", line 135, in prepare_src_dataset
    env = EnvUtils.create_env_for_data_processing(
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/megh/work/projects/robomimic/robomimic/utils/env_utils.py", line 286, in create_env_for_data_processing
    env_class = get_env_class(env_type=env_type)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/megh/work/projects/robomimic/robomimic/utils/env_utils.py", line 36, in get_env_class
    from robomimic.envs.env_robosuite import EnvRobosuite
  File "/Users/megh/work/projects/robomimic/robomimic/envs/env_robosuite.py", line 23, in <module>
    import mujoco_py
  File "/Users/megh/work/projects/venv_envs/mimicgen/lib/python3.12/site-packages/mujoco_py/__init__.py", line 2, in <module>
    from mujoco_py.builder import cymj, ignore_mujoco_warnings, functions, MujocoException
  File "/Users/megh/work/projects/venv_envs/mimicgen/lib/python3.12/site-packages/mujoco_py/builder.py", line 504, in <module>
    cymj = load_cython_ext(mujoco_path)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/megh/work/projects/venv_envs/mimicgen/lib/python3.12/site-packages/mujoco_py/builder.py", line 110, in load_cython_ext
    cext_so_path = builder.build()
                   ^^^^^^^^^^^^^^^
  File "/Users/megh/work/projects/venv_envs/mimicgen/lib/python3.12/site-packages/mujoco_py/builder.py", line 226, in build
    built_so_file_path = self._build_impl()
                         ^^^^^^^^^^^^^^^^^^
  File "/Users/megh/work/projects/venv_envs/mimicgen/lib/python3.12/site-packages/mujoco_py/builder.py", line 333, in _build_impl
    raise RuntimeError(
RuntimeError: Could not find supported GCC executable.

HINT: On OS X, install GCC 9.x with `brew install gcc@9`. or `port install gcc9`.

Looks like its mujoco, maybe its an issue with my mujoco installation? Not sure.

Yes this is related to mujoco-py, which is deprecated. You should be using the mujoco bindings from DeepMind which can be installed with a simple pip install mujoco. Please use the latest version of robosuite and build from source (as shown here) and hopefully you shouldn't run into issues anymore. You can also uninstall mujoco-py for good measure.