一、ubuntu 上安装mujoco
$ sudo apt-get install libglfw3 libglew2.0 libgl1-mesa-glx libosmesa6
然后pip install mujoco_py
二、centos没有apt install所对应的库
2.1 尝试解决centos8上安装mujoco环境依赖问题
- 执行
python -c "import mujoco_py"
时,会报下面文件缺少的错误/home/$USER/mujoco-py/mujoco_py/gl/osmesashim.c:1:23: fatal error: GL/osmesa.h: No such file or directory #include <GL/osmesa.h> ... During handling of the above exception, another exception occurred: File "/home/$USER/miniconda3/envs/phiTrain/lib/python3.7/distutils/unixccompiler.py", line 120, in _compile raise CompileError(msg) distutils.errors.CompileError: command 'gcc' failed with exit status 1
-
centos7上好像可以解决此问题
Hello, there! I got the same issues on CentOS 7. I tried this: conda install -c menpo osmesa C_INCLUDE_PATH=:$HOME/.conda/envs/<env-name>/include python -c "import mujoco_py" , then I got an error like "No such file or directory: 'patchelf'". According to #652, I installed sudo yum install patchelf ,and re-installed mujoco-py with python setup.py install . After that, everything goes right magically. 有两人认同这种方法
-
pytorchRL好像也隐含的提到了这个问题
- 使用conda安装所需依赖包
$ conda activate mujoco_env $ conda install -c conda-forge glew $ conda install -c conda-forge mesalib $ conda install -c anaconda mesa-libgl-cos6-x86_64 $ conda install -c menpo glfw3
- 在centos8上不能解决问题
- 使用conda安装所需依赖包
2.2 解决centos8上安装mujoco环境依赖问题
- 另外一个链接解决了我的问题,无权限安装时如何处理GL/osmesa.h: No such file or directory 问题,合并另外一个有帮助的文档How to install mujoco-py in a server without root privileges?,结果整理如下
Then add your conda environment include to CPATH (put this in your .bashrc to make it permanent):conda install -c conda-forge glew conda install -c conda-forge mesalib conda install -c menpo glfw3 C_INCLUDE_PATH=:$HOME/.conda/envs/<env-name>/include python -c "import mujoco_py"
Finally, 缺少patchelf包,install patchelf withexport CPATH=$CONDA_PREFIX/include
pip install patchelf
我这里还出现了ImportError: libgcrypt.so.11: cannot open shared object file: No such file or directory
问题,需要继续安装包sudo yum -y install libgcrypt11.rpm
因为不太清楚是安装本地的还是资源库的,如果报错的话,则加上rpm下载的操作curl -o libgcrypt11.rpm ftp://ftp.pbone.net/mirror/ftp5.gwdg.de/pub/opensuse/repositories/home:/bosconovic:/branches:/home:/elimat:/lsi/openSUSE_Leap_15.1/x86_64/libgcrypt11-1.5.4-lp151.23.29.x86_64.rpm
至此,在centos8上安装mujoco完成了。文章来源地址https://www.toymoban.com/news/detail-708078.html
2.3 另外一条路线:docker(慢慢更新中……)
- centos上安装docker会遇到另外一个问题,具体看centos8 安装docker解决:Failed to start docker.service
- 然后会有包安装不成功,but none of the providers can be installed yum install提供了一些方法,不过我只能借助他的方法安装一个依赖包。
- 鉴于此,需要重新搞一个安装方法,不然一直有问题。尝试下来这个可以使用Centos8安装Docker 全过程及报错解决
文章来源:https://www.toymoban.com/news/detail-708078.html
到了这里,关于centos8 install mujoco的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!