I want to start playing with training deep reinforcement learning agents, and OpenAI’s “Spinning Up in Deep RL” guide seems like a good place to start. But I was a bit worried about the age of this guide, parts of which has become out of date. One example is that it still says MuJoCo requires a paid license but actually MuJoCo has since become free to use.
Despite this, I decided it’s worth my time to try its software installation guide on my computer running Ubuntu. OpenAI’s recommended procedure uses Anaconda, meaning I’ll have a Python environment dedicated to this adventure and largely isolated from everything else. Starting from Python version (3.6, instead of the latest 3.10) and on down to all the dependent libraries. The good news is that all the Python-based infrastructure seemed to work without problems. But MuJoCo is not Python and thus not under Anaconda isolation, so all my problems came from trying to install
mujoco_py. (A Python library to bridge MuJoCo.)
The first problem was apparently expected by the project’s authors, as I got a prompt to set my
LD_LIBRARY_PATH environment variable. The script that gave me this prompt even gave me its best guess on the solution:
That looked reasonable to me, so I tried it and it successfully allowed me to see the second and third problems. Both were Ubuntu packages that were not explicitly named in the instructions, but I had to install them before things could move on. I did a web search for the first error, which returned the suggestion to run “
sudo apt install libosmesa6-dev libgl1-mesa-glx libglfw3” and that seemed to have resolved this message:
/home/roger/anaconda3/envs/spinningup/lib/python3.6/site-packages/mujoco_py/gl/osmesashim.c:1:10: fatal error: GL/osmesa.h: No such file or directory
The second missing package error was straightforward to fix, running “
sudo apt install patchelf” to resolve this message:
FileNotFoundError: [Errno 2] No such file or directory: 'patchelf': 'patchelf'
The final step was to install dependencies for MuJoCo-based Gym environments. The instruction page said to run
pip install gym[mujoco,robotics] but when I did so, I was distressed to see my work to install
mujoco-py was removed. (!!)
Attempting uninstall: mujoco-py Found existing installation: mujoco-py 220.127.116.11 Uninstalling mujoco-py-18.104.22.168: Successfully uninstalled mujoco-py-22.214.171.124
The reason pip wanted to do this was because the gym packages said they want
mujoco_py version greater than or equal to 1.5 but less than 2.0.
Collecting mujoco-py<2.0,>=1.50 Downloading mujoco-py-126.96.36.199.tar.gz (120 kB)
Fortunately(?) this attempt to install 188.8.131.52 failed and pip rolled everything back, restoring 184.108.40.206 that I had already installed. Leaving me in a limbo state.
Well, when in doubt, try the easy thing first. I decided to be optimistic and moved on to “check that things are working” command to run Walker2d-v2 environment. I saw a lot of numbers and words flashed by. I only marginally understood them, but I didn’t see anything I recognized as error messages. So while I see a few potential problems ahead, right now it appears this mishmash of old and new components will work well enough for a beginner.