[Fixed] import mujoco_py is giving me compiling errors – Mujoco

by
Alexei Petrov
anaconda llama-cpp-python mujoco

The Problem:

I’m experiencing problems importing the mujoco_py library, which is throwing compilation errors when I attempt to run the command ‘python3 setting_state.py’. The issue seems to be related to the libglew1.5 dependency, which is not found on my system. I’ve tried installing various versions of libglew (such as libglew-dev and libglew2.2), but the compilation errors persist.

The Solutions:

Solution 1: Following a Comprehensive Guide

There seems to be an issue with the installation of mujoco-py. Follow these steps to resolve it:

  1. Refer to the official guide here for a detailed explanation of the installation process.

  2. Make sure you have the necessary dependencies installed. This includes libglew-dev, libglew2.2, and libglew-dev.

  3. If you encounter the error "libglew1.5 is not available or does not exist," try installing libglew1.5-dev.

  4. After installing the dependencies, run the following commands:

    python3 setup.py build_ext --inplace
    python3 setup.py install
    
  5. If you still encounter compilation errors, try rebuilding mujoco-py by running the following commands:

    python3 -m mujoco_py.builder build
    python3 -m mujoco_py.builder install
    
  6. If the issue persists, refer to the mujoco-py GitHub issue here for additional insights and potential solutions.

Q&A

libglew1.5 is not available or does not exist, how to fix it?

You can install other versions of libglew like libglew-dev, libglew2.2 etc.

What is a better way to install mujoco-py?

Video Explanation:

The following video, titled "MuJoCo Lec 1: Working with XML files (Spring 2022) - YouTube", provides additional insights and in-depth exploration related to the topics discussed in this post.

Play video

Starting with MuJoCo provided hello.xml, I show how to modify the xml file by looking at the documentation. The hello.xml code is here on ...