Skip to content

Installing Mujoco py on Linux

pz1004 edited this page Aug 19, 2018 · 4 revisions

Test environment

OS: Ubuntu 16.04 / x86_64
python version: 3.6
pytorch : 0.4.0
MuJoCo version: 150

Installation manual for Linux

1. Install required packages

sudo apt install -y build-essential autoconf libtool pkg-config python-opengl python-pil \
python-pyrex python-pyside.qtopengl idle-python2.7 qt4-dev-tools qt4-designer libqtgui4 \
libqtcore4 libqt4-xml libqt4-test libqt4-script libqt4-network libqt4-dbus python-qt4 python-qt4-gl \
libgle3 python-dev libgl1-mesa-dev libgl1-mesa-glx libosmesa6-dev python3-scipy libglew-dev patchelf

2. Make and activate virtual environment

replace pgtravel with your favor name.

$ virtualenv pgtravel -p python3.6
$ source pgtravel/bin/activate

3. Clone OpenAI Gym repository and install it.

git clone https://github.com/openai/gym.git
cd gym
pip install -e .

4. Install Mujoco

  1. Download MuJoCo-pro 150 version. download
  2. Unzip mjpro150_linux.zip file to $HOME/.mujoco/mjpro150/
    • successful structure is below:
    • str
  3. Setup Environment Variable
    • Write below command in ~/.bashrc file
    •   export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HOME/.mujoco/mjpro150/bin
  4. Get 30-day Trial license
  • Obtain a computer id using the getid_linux program.
  • Obtain the Mujoco license with the computer id.
  • After successful submission, you get an e-mail from 'Roboti LLC Licensing' containing the trial license file mjkey.txt. Be careful not to leak.
    • Submit result
    • E-mail from 'Roboti LLC Licensing'
  • Download mjkey.txt from the email and move it to ~/.mujoco/
  • [Optional] Test Activation Key
    •   $ cp mjkey.txt ~/.mujoco/mjpro150/bin/  
        cd $HOME/.mujoco/mjpro150/bin 
        ./simulate
      

5. Install mujoco_py

$ git clone https://github.com/openai/mujoco-py.git
$ cd mujoco-py
$ python3 setup.py install

[Optional] Test mujoco-py

$ python3
>> import mujoco_py
>> import gym
>> env = gym.make('Hopper-v2')  # or 'Humanoid-v2' 
>> env.render()
  • If CompileError about gcc or cython raises, then, try to re-install mujoco-py.

6. Install pytorch

pip3 install http://download.pytorch.org/whl/cpu/torch-0.4.0-cp36-cp36m-linux_x86_64.whl 
pip3 install torchvision

7. Clone pg_travel repository and install the prerequisite

$ git clone https://github.com/reinforcement-learning-kr/pg_travel
$ pip install tensorboardX
$ pip install tensorflow

TMI (Too Much Information)

If you are windows user and want to make shared folder in virtualbox

It's helpful references for me to make shared folder in virtualbox.

For shared folder permission

$ sudo gpasswd -a [user_name] vboxsf