【Reinforcement Learning】Ubuntu中mujoco210 mujoco_py D4RL安装及错误解决

本文主要是介绍【Reinforcement Learning】Ubuntu中mujoco210 mujoco_py D4RL安装及错误解决,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

Ubuntu中mujoco210 mujoco_py D4RL安装及错误解决

本文根据一篇知乎文章链接在此进行配置,记录在配置过程中遇到的一些问题,原文作者的教程很详细,在此对原作者表示感谢~

  1. 直接进行知乎原文的第2.2 有效安装过程(避坑)
    在这里插入图片描述

2.注意上文中各行代码的作用
原文作者的代码有一点点小问题,我在注释中指出,要注意甄别

**注意/.mujoco是隐藏文件夹,在界面中可以打开显示隐藏文件的开关**
# 下载地址 https://github.com/deepmind/mujoco/releases/tag/2.1.0
cd ~/Downloads/
wget https://github.com/deepmind/mujoco/releases/download/2.1.0/mujoco210-linux-x86_64.tar.gz
mv mujoco210-linux-x86_64.tar.gz mujoco210 #这里相当于重命名
tar -zxvf mujoco210-linux-x86_64.tar.gz #这里有问题 应解压重命名后的文件
mkdir ~/mujoco  #这里应改为 mkdir ~/.mujoco 
cp -r mujoco210 ~/.mujoco #复制到~/.mujoco中 
# 添加环境变量
sudo gedit ~/.bashrc
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HOME/.mujoco/mujoco210/bin
export MUJOCO_KEY_PATH=~/.mujoco${MUJOCO_KEY_PATH}
source ~/.bashrc# 测试
cd ~/.mujoco/mujoco210/bin/
./simulate ../model/humanoid.xml

其余按照原作者的内容进行安装
3.在安装mujoco_py时,我首先遇到作者未出现的报错

anaconda3/envs/myRL/lib/python3.9/site-packages/mujoco_py/cymj.pyx:127:21: Cannot assign type 'void (const char *) except * nogil' to 'void (*)(const char *) noexcept nogil'. Exception values are incompatible. Suggest adding 'noexcept' to type 'void (const char *) except * nogil'.
Traceback (most recent call last):File "<stdin>", line 1, in <module>File "/home/yangsen/anaconda3/envs/myRL/lib/python3.9/site-packages/mujoco_py/__init__.py", line 2, in <module>from mujoco_py.builder import cymj, ignore_mujoco_warnings, functions, MujocoExceptionFile "/home/yangsen/anaconda3/envs/myRL/lib/python3.9/site-packages/mujoco_py/builder.py", line 504, in <module>cymj = load_cython_ext(mujoco_path)File "/home/yangsen/anaconda3/envs/myRL/lib/python3.9/site-packages/mujoco_py/builder.py", line 110, in load_cython_extcext_so_path = builder.build()File "/home/yangsen/anaconda3/envs/myRL/lib/python3.9/site-packages/mujoco_py/builder.py", line 226, in buildbuilt_so_file_path = self._build_impl()File "/home/yangsen/anaconda3/envs/myRL/lib/python3.9/site-packages/mujoco_py/builder.py", line 296, in _build_implso_file_path = super()._build_impl()File "/home/yangsen/anaconda3/envs/myRL/lib/python3.9/site-packages/mujoco_py/builder.py", line 239, in _build_impldist.ext_modules = cythonize([self.extension])File "/home/yangsen/anaconda3/envs/myRL/lib/python3.9/site-packages/Cython/Build/Dependencies.py", line 1154, in cythonizecythonize_one(*args)File "/home/yangsen/anaconda3/envs/myRL/lib/python3.9/site-packages/Cython/Build/Dependencies.py", line 1321, in cythonize_oneraise CompileError(None, pyx_file)
Cython.Compiler.Errors.CompileError: /home/yangsen/anaconda3/envs/myRL/lib/python3.9/site-packages/mujoco_py/cymj.pyx
>>> import mujoco_py
Compiling /home/yangsen/anaconda3/envs/myRL/lib/python3.9/site-packages/mujoco_py/cymj.pyx because it changed.
[1/1] Cythonizing /home/yangsen/anaconda3/envs/myRL/lib/python3.9/site-packages/mujoco_py/cymj.pyx
performance hint: anaconda3/envs/myRL/lib/python3.9/site-packages/mujoco_py/cymj.pyx:67:5: Exception check on 'c_warning_callback' will always require the GIL to be acquired.
Possible solutions:1. Declare the function as 'noexcept' if you control the definition and you're sure you don't want the function to raise exceptions.2. Use an 'int' return type on the function to allow an error code to be returned.
performance hint: anaconda3/envs/myRL/lib/python3.9/site-packages/mujoco_py/cymj.pyx:104:5: Exception check on 'c_error_callback' will always require the GIL to be acquired.
Possible solutions:1. Declare the function as 'noexcept' if you control the definition and you're sure you don't want the function to raise exceptions.2. Use an 'int' return type on the function to allow an error code to be returned.Error compiling Cython file:
------------------------------------------------------------
...See c_warning_callback, which is the C wrapper to the user defined function'''global py_warning_callbackglobal mju_user_warningpy_warning_callback = warnmju_user_warning = c_warning_callback^
------------------------------------------------------------anaconda3/envs/myRL/lib/python3.9/site-packages/mujoco_py/cymj.pyx:92:23: Cannot assign type 'void (const char *) except * nogil' to 'void (*)(const char *) noexcept nogil'. Exception values are incompatible. Suggest adding 'noexcept' to type 'void (const char *) except * nogil'.Error compiling Cython file:
------------------------------------------------------------
...See c_warning_callback, which is the C wrapper to the user defined function'''global py_error_callbackglobal mju_user_errorpy_error_callback = err_callbackmju_user_error = c_error_callback^
------------------------------------------------------------anaconda3/envs/myRL/lib/python3.9/site-packages/mujoco_py/cymj.pyx:127:21: Cannot assign type 'void (const char *) except * nogil' to 'void (*)(const char *) noexcept nogil'. Exception values are incompatible. Suggest adding 'noexcept' to type 'void (const char *) except * nogil'.
Traceback (most recent call last):File "<stdin>", line 1, in <module>File "/home/yangsen/anaconda3/envs/myRL/lib/python3.9/site-packages/mujoco_py/__init__.py", line 2, in <module>from mujoco_py.builder import cymj, ignore_mujoco_warnings, functions, MujocoExceptionFile "/home/yangsen/anaconda3/envs/myRL/lib/python3.9/site-packages/mujoco_py/builder.py", line 504, in <module>cymj = load_cython_ext(mujoco_path)File "/home/yangsen/anaconda3/envs/myRL/lib/python3.9/site-packages/mujoco_py/builder.py", line 110, in load_cython_extcext_so_path = builder.build()File "/home/yangsen/anaconda3/envs/myRL/lib/python3.9/site-packages/mujoco_py/builder.py", line 226, in buildbuilt_so_file_path = self._build_impl()File "/home/yangsen/anaconda3/envs/myRL/lib/python3.9/site-packages/mujoco_py/builder.py", line 296, in _build_implso_file_path = super()._build_impl()File "/home/yangsen/anaconda3/envs/myRL/lib/python3.9/site-packages/mujoco_py/builder.py", line 239, in _build_impldist.ext_modules = cythonize([self.extension])File "/home/yangsen/anaconda3/envs/myRL/lib/python3.9/site-packages/Cython/Build/Dependencies.py", line 1154, in cythonizecythonize_one(*args)File "/home/yangsen/anaconda3/envs/myRL/lib/python3.9/site-packages/Cython/Build/Dependencies.py", line 1321, in cythonize_oneraise CompileError(None, pyx_file)
Cython.Compiler.Errors.CompileError: /home/yangsen/anaconda3/envs/myRL/lib/python3.9/site-packages/mujoco_py/cymj.pyx

解决方法:更换Cython版本
参考文章

pip install Cython==3.0.0a10

更换版本后继续 import mojoco_py出现知乎文章中提及的问题,按照原文作者的方法可以解决

4.祝安装成功!

这篇关于【Reinforcement Learning】Ubuntu中mujoco210 mujoco_py D4RL安装及错误解决的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/250326

相关文章

Zookeeper安装和配置说明

一、Zookeeper的搭建方式 Zookeeper安装方式有三种,单机模式和集群模式以及伪集群模式。 ■ 单机模式:Zookeeper只运行在一台服务器上,适合测试环境; ■ 伪集群模式:就是在一台物理机上运行多个Zookeeper 实例; ■ 集群模式:Zookeeper运行于一个集群上,适合生产环境,这个计算机集群被称为一个“集合体”(ensemble) Zookeeper通过复制来实现

CentOS7安装配置mysql5.7 tar免安装版

一、CentOS7.4系统自带mariadb # 查看系统自带的Mariadb[root@localhost~]# rpm -qa|grep mariadbmariadb-libs-5.5.44-2.el7.centos.x86_64# 卸载系统自带的Mariadb[root@localhost ~]# rpm -e --nodeps mariadb-libs-5.5.44-2.el7

Centos7安装Mongodb4

1、下载源码包 curl -O https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel70-4.2.1.tgz 2、解压 放到 /usr/local/ 目录下 tar -zxvf mongodb-linux-x86_64-rhel70-4.2.1.tgzmv mongodb-linux-x86_64-rhel70-4.2.1/

python: 多模块(.py)中全局变量的导入

文章目录 global关键字可变类型和不可变类型数据的内存地址单模块(单个py文件)的全局变量示例总结 多模块(多个py文件)的全局变量from x import x导入全局变量示例 import x导入全局变量示例 总结 global关键字 global 的作用范围是模块(.py)级别: 当你在一个模块(文件)中使用 global 声明变量时,这个变量只在该模块的全局命名空

Centos7安装JDK1.8保姆版

工欲善其事,必先利其器。这句话同样适用于学习Java编程。在开始Java的学习旅程之前,我们必须首先配置好适合的开发环境。 通过事先准备好这些工具和配置,我们可以避免在学习过程中遇到因环境问题导致的代码异常或错误。一个稳定、高效的开发环境能够让我们更加专注于代码的学习和编写,提升学习效率,减少不必要的困扰和挫折感。因此,在学习Java之初,投入一些时间和精力来配置好开发环境是非常值得的。这将为我

如何解决线上平台抽佣高 线下门店客流少的痛点!

目前,许多传统零售店铺正遭遇客源下降的难题。尽管广告推广能带来一定的客流,但其费用昂贵。鉴于此,众多零售商纷纷选择加入像美团、饿了么和抖音这样的大型在线平台,但这些平台的高佣金率导致了利润的大幅缩水。在这样的市场环境下,商家之间的合作网络逐渐成为一种有效的解决方案,通过资源和客户基础的共享,实现共同的利益增长。 以最近在上海兴起的一个跨行业合作平台为例,该平台融合了环保消费积分系统,在短

安装nodejs环境

本文介绍了如何通过nvm(NodeVersionManager)安装和管理Node.js及npm的不同版本,包括下载安装脚本、检查版本并安装特定版本的方法。 1、安装nvm curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash 2、查看nvm版本 nvm --version 3、安装

计算机毕业设计 大学志愿填报系统 Java+SpringBoot+Vue 前后端分离 文档报告 代码讲解 安装调试

🍊作者:计算机编程-吉哥 🍊简介:专业从事JavaWeb程序开发,微信小程序开发,定制化项目、 源码、代码讲解、文档撰写、ppt制作。做自己喜欢的事,生活就是快乐的。 🍊心愿:点赞 👍 收藏 ⭐评论 📝 🍅 文末获取源码联系 👇🏻 精彩专栏推荐订阅 👇🏻 不然下次找不到哟~Java毕业设计项目~热门选题推荐《1000套》 目录 1.技术选型 2.开发工具 3.功能

SWAP作物生长模型安装教程、数据制备、敏感性分析、气候变化影响、R模型敏感性分析与贝叶斯优化、Fortran源代码分析、气候数据降尺度与变化影响分析

查看原文>>>全流程SWAP农业模型数据制备、敏感性分析及气候变化影响实践技术应用 SWAP模型是由荷兰瓦赫宁根大学开发的先进农作物模型,它综合考虑了土壤-水分-大气以及植被间的相互作用;是一种描述作物生长过程的一种机理性作物生长模型。它不但运用Richard方程,使其能够精确的模拟土壤中水分的运动,而且耦合了WOFOST作物模型使作物的生长描述更为科学。 本文让更多的科研人员和农业工作者

K8S(Kubernetes)开源的容器编排平台安装步骤详解

K8S(Kubernetes)是一个开源的容器编排平台,用于自动化部署、扩展和管理容器化应用程序。以下是K8S容器编排平台的安装步骤、使用方式及特点的概述: 安装步骤: 安装Docker:K8S需要基于Docker来运行容器化应用程序。首先要在所有节点上安装Docker引擎。 安装Kubernetes Master:在集群中选择一台主机作为Master节点,安装K8S的控制平面组件,如AP