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