Start to work with Linux, Mujoco, Robosuite, and Pycharm.

Shirkozlovsky
4 min readMay 2, 2021

After searching for a guide for creating a working environment on Linux with Mujoco, I combined a few sources, guides, and my experience into one guide.

so follow the steps, and let's start :)

I'm working with:
- Linux Ubuntu 20.04
- Mujoco 2.0
- Python 3.9+

The main steps are:
A. Download & install Mujoco
B.
Install python and anaconda
C.
Create a new virtual environment in Anaconda
D.
Download & install Mujoco-py
E. Download & install Robosuite
F.
Setup path & environment in PyCharm
I.
Check the environment

note: at the end of each step, there is a "checking" part' to see that the installation and the setup want well. Don't skip this part.

A. Download & install Mujoco:

  1. Download the free MuJoCo license (mjkey.txt) from the MuJoCo website.
  2. Download the MuJoCo version 2.0 binaries for Linux.
  3. Unzip the downloaded mujoco200 directory into
$HOME/.mujoco/mujoco200.
  1. Place your license key (the mjkey.txt file from your email) at
$HOME/.mujoco/mjkey.txt

B. Install python and anaconda:

  1. You can skip those steps if you have python and Anaconda installed on your computer.
  2. Download python from https://www.python.org/downloads/ and follow the instructions.
  3. Download Anaconda from https://docs.anaconda.com/anaconda/install/linux/ and follow the instructions.

C. Create a new virtual environment in Anaconda:

Option I- Use the user interface:

  1. Open Anaconda Navigator from the terminal — open the terminal the write:
  • note: you can create a new virtual environment from the terminal (search in google how to do it..). This way is a graphic one, to feel and see how it look like :)
$ anaconda-navigator

If it doesn't work. Run this command on your terminal:

$ source ~/anaconda3/bin/activate root
$ anaconda-navigator
  1. In the Environment tab, open a new environment (by pressing the "create" button) and choose the desired python version.
a new environment in Anaconda

3. after creating the virtual environment, open this environment in the terminal from Anaconda:

the terminal will look like that:

In the parenthesis, you will see the environment's name. And then the directory you are in.

Option II- Use terminal:

  1. Create a virtual environment: In the terminal, type the following, replacing new_env with the name you want to give your environment and X.X with the Python version you want to use. (First, run conda search "python$" and press enter to view a list of possible Python versions.)
$ conda create -n new_env python=X.X anaconda

2. Activate your virtual environment:

$ source activate new_env

D. Download & install Mujoco-py

  1. Download Mujoco-py from git and install it in the virtual environment that we create (open the terminal as explained in section D3):
$ git clone https://github.com/openai/mujoco-py.git
$ cd mujoco-py
$ python3 setup.py install

E. Download & install Robosuite:

Clone the Robosuite repository

$ git clone https://github.com/StanfordVL/robosuite.git$ cd robosuite

Install the base requirements with

$ pip3 install -r requirements.txt

if you use OpenAI Gym interfaces inverse kinematics controllers powered by PyBullet, please install the extra dependencies.
open the "requirements-extra.txt" file, put in a comment thehidap line (it's only for Mac OS X)

requirements-extra.txt after the change

save and run the following terminal:

$ pip3 install -r requirements-extra.txt

F. Setup path & environment in PyCharm

I'm not sure if it is the correct way to approach this issue, but it works for me.

  1. Open the Pycharm and enter 'Edit Configurations' (ender Run in the primary tool).
  2. Go to 'Templates', select 'Python', and open the 'Environment variables' by clicking on the key at the end of the command line' on the right.

2. For the Mujoco and Robosuite to word, we need to set two PATH, by pressing +, as follow:

LD_LIBRARY_PATH : /home/$YOUR_PATH$/.mujoco/mujoco200/bin
LD_PRELOAD : /usr/lib/x86_64-linux-gnu/libGLEW.so

The first line you need to change to your home directory.
The second line can copy it- as is.

3. If you want to work with Robosuit, open the Robosuite folder from PyCharm. Suppose you want to work only with Mujoco' open a new project.

4. set the 'Project Interpreter' (enter to Filt → Setting → Project → Project Interpreter) by pressing the 'setting' button in the upper right corner and then 'add':

Choose 'Conda Environment' and then 'Existing Environment' and set the virtual environment path you created before.
Save this setting.

I. Check the environment
in the Robosuite directory. There is an 'examples' directory.
Open one example and test it.

--

--

Shirkozlovsky

Machine learning & Robotics Researcher MSc student at Technion - Israel Institue of Technology specializing in reinforcement learning