Skip to content

Software Setup

Stephanie Hughes edited this page Jun 22, 2021 · 40 revisions

Python (version 3.6+)

  • Download python (at least version 3.6 or higher) from: https://www.python.org/downloads/

Pytorch (version 1.2.0)

Pycharm (recommended but not essential)

Contains helpful editing, testing, and version control functions that can make code development more straight-forward

Mujoco (version 1.50) (Note: the python package of this version works for python 3++)

  1. Obtain a license key by filling out your information under the MuJoCo Personal License: 1 year section, and select Student for the license type. A license key from Mujoco should be sent to your email once your license request has been processed. This license will last for one year and is free for student use. Your license key will be sent as an attachment, called mjkey.txt.
  2. Once you have obtained your license key (mjkey.txt), download Mujoco version 1.50, referred to as Mjpro150, from the Mujoco Downloads page. Please download the appropriate Mjpro150 type based on your machine (win64, linux, osx).
  3. Within your home directory, create a folder called .mujoco (Example: c:/Users/<user_name>/.mujoco)
  4. Extract the contents of the downloaded Mjpro150.zip folder and place mjpro150/ (NOT mjpro150_linux or mjpro150_win64)within your new .mujoco directory. You should now have: <home_directory_path>/.mujoco/mjpro150/
  5. Place a copy of your Mujoco license key (mjkey.txt) within <home_directory_path>/.mujoco/ and <home_directory_path>/.mujoco/mjpro150/bin/
  6. Follow the rest of the installation instructions below based on your system type (Windows, Linux).

Setting Mujoco environment variables on Windows

To start, your <home_directory_path>/.mujoco/ should contain the mjpro150 folder and a copy of the mjkey.txt.

Now, we would like to add these paths to our environment variables: How to set a path variable on a Windows machine

Set the path variables to be (replace <user_name> to be your user profile name):

set MUJOCO_PY_MJKEY_PATH=C:\Users\<user_name>\.mujoco\mjkey.txt

set MUJOCO_PY_MUJOCO_PATH=C:\Users\<user_name>\.mujoco\mjpro150\bin

set PATH=C:\Users\<user_name>\.mujoco\mjpro150\bin;%PATH%

Your path variables should now be set, allowing mujoco_py (installed in the next step) to find the location of your Mujoco distribution.

Setting Mujoco environment variables on Linux

To start, your ~/.mujoco/ directory should contain the mjpro150 folder and a copy of the mjkey.txt

  1. Use your text editor to open ~/.bashrc, for example in terminal at home directory, type subl ~/.bashrc
  2. Copy the following command at the end of the code (change to your computer name)
    • export LD_LIBRARY_PATH="/home/<graspinglab>/.mujoco/mjpro150/bin:$LD_LIBRARY_PATH"
    • export MUJOCO_PY_MJKEY_PATH="/home/<graspinglab>/.mujoco/mjkey.txt"
    • export MUJOCO_PY_MJPRO_PATH="/home/<graspinglab>/.mujoco/mjpro150"
  3. Open up a terminal and use this command: source ~/.bashrc

Your path variables should now be set, allowing mujoco_py (installed in the next step) to find the location of your Mujoco distribution.

Mujoco-py (version 1.50)

Python package developed by OpenAI

Do not try pip install mujoco-py. It will not work.

  1. Download the source code from here: https://github.com/openai/mujoco-py/releases/tag/1.50.1.0

  2. Untar / unzip the package

  3. cd mujoco-py-1.50.1.0

  4. pip install -e. Or pip install --user -e. (if you are denied for not having permission) Or pip3 (if your pip is python 2).

Now you can use mujoco with python by… import mujoco_py

After you have these installed, clone this repository. To check that it is working, run /KinovaGrasping/gym-kinova-gripper/simple_rendering.py. This should show a rendering of the hand and object.

Clone this wiki locally