Skip to content

Instantly share code, notes, and snippets.

@rmsander
Last active July 19, 2021 15:29
Show Gist options
  • Save rmsander/9c76643bbca34b6bba5c65538c230841 to your computer and use it in GitHub Desktop.
Save rmsander/9c76643bbca34b6bba5c65538c230841 to your computer and use it in GitHub Desktop.

If you're using mujoco-py (likely through the MuJoCo suite in gym) on MIT Supercloud, you may encounter issues with POSIX locking if you try to install and setup mujoco-py on the standard shared file system.

To get around this, you can install mujoco-py on a different section (the permanent storage section) of the Supercloud server. Below is a bash script I used to get around issue (you may have to modify some of the commands, such as the conda environment you use):

#!/bin/bash

#SBATCH -c 10
#SBATCH -n 1
#SBATCH --exclusive
#SBATCH --gres=gpu:volta:1

conda init bash
source ~/.bashrc
conda activate <my_env>

# Make new folder there
TMPFILE=`mktemp XXXXXX`
mkdir /state/partition1/user/$TMPFILE

# Copy mujoco-py folder to locked part of cluster
cp -r ~/mujoco-py /state/partition1/user/$TMPFILE/
cd /state/partition1/user/$TMPFILE/mujoco-py

# Now install it and import it to build
python3 setup.py install
python3 -c "import mujoco_py"

# Now move code to this folder and mujoco-py into code
cp -r ~/interreplay /state/partition1/user/$TMPFILE/
cp -r mujoco_py ../<module_or_package_to_run_code>/

# Change direcrory to interreplay
cd ../<module_or_package_to_run_code>

# Run code!  (With parameters)
python3 my_script.py <parameters>

# Finally, remove temporary directory
rm /state/partition1/user/$TMPFILE

Hope this helps! Please feel free to reach out to me if you encounter issues with these changes made.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment