Last active
April 5, 2022 17:49
-
-
Save johannah/9266e8d5c7698e53af5f193057e3cfd7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# to get mujoco-py to install with headless rendering without sudo access | |
############################## | |
# 1) first download and install mujoco according to instructions from https://github.com/deepmind/mujoco/ | |
############################## | |
# 2) add environment variables to your bashrc | |
# importantly, this should be done before installing mujoco-py | |
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/$USER/.mujoco/mujoco210/bin | |
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/nvidia | |
# egl allows for headless rendering on linux | |
export MUJOCO_GL="egl" | |
############################## | |
# 3) Create and activate conda environment. For this doc, I've named it "mujoco_env" | |
conda create -n mujoco_env python=3.9 | |
# install several rendering requirements to get around apt-get install requirements | |
conda install -c conda-forge glew | |
conda install -c conda-forge patchelf | |
conda install -c menpo glfw3 | |
############################## | |
# 4) clone and install mujoco-py from source | |
git clone https://github.com/openai/mujoco-py | |
cd mujoco-py | |
python setup.py install | |
############################## | |
# 5) Mujoco-py will compile the first time it is imported after being installed. | |
# You need to ensure when this compilation happens, mujoco-py will have access to | |
# the rendering libraries we've installed with conda. The most reliable way I've found | |
# to do this is to ensure this process occurs within your conda environments include directory. | |
# You should also be able to add this include path to your environment path so that mujoco-py | |
# can find it during compilation, but I haven't managed to get that to work yet. | |
cd ~/anaconda3/envs/mujoco_env/include | |
python | |
>> import mujoco_py | |
# mujoco will compile for several minutes | |
# now type "mujoco_py.cymj" and ensure "linuxgpuextensionbuilder" is included in the printout. Mine is: <module 'cymj' from | |
# '/home/user/anaconda3/envs/mujoco_env/lib/python3.8/site-packages/mujoco_py-2.1.2.14-py3.8.egg/mujoco_py/generated/cymj_2.1.2.14_38_linuxgpuextensionbuilder_38.so'> | |
>> mujoco_py.cymj | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment