Caltech-AMBER / ambersim

In-house tools built on GPU-accelerated simulation
MIT License
7 stars 2 forks source link

Segfault on loading models when importing `ambersim` when missing explicit `mujoco` import #38

Closed alberthli closed 11 months ago

alberthli commented 11 months ago

When working in a virtual environment that imports ambersim, the following code will segfault:

from ambersim import ROOT
from ambersim.utils.io_utils import load_mj_model_from_file, load_mjx_model_and_data_from_file

filename = ROOT + "/models/pendulum/pendulum.xml"

# either of the below two lines segfaults
m = load_mj_model_from_file(filename)
m, d = load_mjx_model_and_data_from_file(filename)

If we simply add the line

import mujoco

anywhere before importing the model loading utils, then there is no segfault.