It is possible to run MuJoCo on WSL2 as well.
Please refer to the separate article that summarizes the difficult points regarding the introduction of WSL2 and GUI. Introduction of WSL2 and construction of GUI environment
We will proceed on the assumption that Python has already been installed when you want to run mujoco-py.
Download MuJoCo from https://www.roboti.us/index.html in any way you like and unzip it to ~ / .mujoco / mujoco200
. For example
wget https://www.roboti.us/download/mujoco200_linux.zip
unzip mujoco.zip -d /home/{username}/.mujoco
mv /home/{username}/.mujoco/mujoco200_linux /home/{username}/.mujoco/mujoco200
rm mujoco.zip
Also, prepare the license key in ~ / .mujoco / mjkey.txt
.
In addition, to ~ / .bashrc
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/{username}/.mujoco/mujoco200/bin
To add.
I'll put in some necessary things.
sudo apt update
sudo apt install gcc
sudo apt install libosmesa6-dev
At this point, you can do pip install mujoco-py
!!
As a preparation
sudo apt install libgl1-mesa-dev xorg-dev
I will do it.
For GUI, please refer to Installing WSL2 and building GUI environment.
$ cd ~/.mujoco/mujoco200/bin
$ ./simulate ../model/humanoid.xml
MuJoCo Pro version 2.00
ERROR: could not initialize GLFW
Press Enter to exit ...
If appears, uncheck wsl in the public domain protected network connection from the properties of the Windows Defender firewall in the firewall.
However, if you keep the defaults introduced here (or those introduced on various sites),
MuJoCo Pro version 2.00
libGL error: No matching fbConfigs or visuals found
libGL error: failed to load driver: swrast
ERROR: OpenGL version 1.5 or higher required
Press Enter to exit ...
It will become. The version of OpenGL seems to be too low. Only one in the world? There was a site that came up with an answer. https://superuser.com/questions/1487555/how-to-troubleshoot-opengl-on-ubuntu-under-windows-10-wsl
in short,
LIBGL_ALWAYS_INDIRECT
in ~ .bashrc
LIBGL_ALWAYS_INDIRECT
variable-wgl
option.For 1 and 2, LIBGL_ALWAYS_INDIRECT
is originally defined in \ etc \ profile.d \ wsl-integration.sh
(this is a symbolic link and is really /usr/share/wslu/wsl-integration.sh
).
Therefore, in ~ / .bashrc
unset LIBGL_ALWAYS_INDIRECT
You can delete the variable by writing. Now you can do ./simulate ../model/humanoid.xml
, and you can also draw using mujoco-py or OpenAI gym.
Recommended Posts