当前位置: 首页 > article >正文

Text2Reward学习笔记

1. 环境配置

1.1 安装 PyTorch-1.13.1

pip install torch==1.13.1+cu116 torchvision==0.14.1+cu116 \
torchaudio==0.13.1 --extra-index-url https://download.pytorch.org/whl/cu116

1.2 安装工具库

pip install stable-baselines3==1.8.0 wandb tensorboard \
-i https://pypi.tuna.tsinghua.edu.cn/simple
pip install langchain chromadb==0.4.0 \
-i https://pypi.tuna.tsinghua.edu.cn/simple

2. Troubleshooting

(1)出现错误“mujoco_py/gl/eglshim.c:4:10: fatal error: GL/glew.h: 没有那个文件或目录 4 | #include <GL/glew.h>”

错误信息如下:

>>> import mujoco_py
~/anaconda3/envs/text2reward/lib/python3.7/site-packages/mujoco_py/gl/eglshim.c:4:10: fatal error: GL/glew.h: 没有那个文件或目录
    4 | #include <GL/glew.h>
      |          ^~~~~~~~~~~
compilation terminated.
Traceback (most recent call last):
  File "~/anaconda3/envs/text2reward/lib/python3.7/site-packages/setuptools/_distutils/unixccompiler.py", line 186, in _compile
    self.spawn(compiler_so + cc_args + [src, '-o', obj] + extra_postargs)
  File "~/anaconda3/envs/text2reward/lib/python3.7/site-packages/setuptools/_distutils/ccompiler.py", line 1007, in spawn
    spawn(cmd, dry_run=self.dry_run, **kwargs)
  File "~/anaconda3/envs/text2reward/lib/python3.7/site-packages/setuptools/_distutils/spawn.py", line 71, in spawn
    "command {!r} failed with exit code {}".format(cmd, exitcode)
distutils.errors.DistutilsExecError: command '/usr/bin/gcc' failed with exit code 1

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "~/anaconda3/envs/text2reward/lib/python3.7/site-packages/mujoco_py/__init__.py", line 2, in <module>
    from mujoco_py.builder import cymj, ignore_mujoco_warnings, functions, MujocoException
  ... # 中间代码省略
  File "~/anaconda3/envs/text2reward/lib/python3.7/site-packages/setuptools/_distutils/unixccompiler.py", line 188, in _compile
    raise CompileError(msg)
distutils.errors.CompileError: command '/usr/bin/gcc' failed with exit code 1

由错误信息可以看出,这里其实是缺少GL工具,安装一下即可;

Gemini 2.0 Flash:GLEW(OpenGL Extension Wrangler Library)是一个OpenGL扩展管理库,用来管理和使用 OpenGL的新功能。

Note:glew可以尝试用conda安装。

可以参考官方命令;
也可以尝试使用以下命令安装:

sudo apt-get install libglew-dev libosmesa6-dev

(2)出现错误“FileNotFoundError: [Errno 2] No such file or directory: ‘patchelf’: ‘patchelf’”

错误信息如下:

>>> import mujoco_py
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "~/anaconda3/envs/myenv/lib/python3.7/site-packages/mujoco_py/__init__.py", line 2, in <module>
    from mujoco_py.builder import cymj, ignore_mujoco_warnings, functions, MujocoException
  File "~/anaconda3/envs/myenv/lib/python3.7/site-packages/mujoco_py/builder.py", line 504, in <module>
    cymj = load_cython_ext(mujoco_path)
  File "~/anaconda3/envs/myenv/lib/python3.7/site-packages/mujoco_py/builder.py", line 110, in load_cython_ext
    cext_so_path = builder.build()
  File "~/anaconda3/envs/myenv/lib/python3.7/site-packages/mujoco_py/builder.py", line 226, in build
    built_so_file_path = self._build_impl()
  File "~/anaconda3/envs/myenv/lib/python3.7/site-packages/mujoco_py/builder.py", line 297, in _build_impl
    fix_shared_library(so_file_path, 'libOpenGL.so', 'libOpenGL.so.0')
  File "~/anaconda3/envs/myenv/lib/python3.7/site-packages/mujoco_py/builder.py", line 154, in fix_shared_library
    subprocess.check_call(['patchelf', '--remove-rpath', so_file])
  File "~/anaconda3/envs/myenv/lib/python3.7/subprocess.py", line 358, in check_call
    retcode = call(*popenargs, **kwargs)
  File "~/anaconda3/envs/myenv/lib/python3.7/subprocess.py", line 339, in call
    with Popen(*popenargs, **kwargs) as p:
  File "~/anaconda3/envs/myenv/lib/python3.7/subprocess.py", line 800, in __init__
    restore_signals, start_new_session)
  File "~/anaconda3/envs/myenv/lib/python3.7/subprocess.py", line 1551, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'patchelf': 'patchelf'

这里其实就是提示缺少patchelf工具,安装一下即可;

Note: patchelf可以用conda来安装。

海螺AI: 在这里,patchelf 是一个用于修改 ELF 可执行文件和库的实用工具。在你的错误信息中,MuJoCo在构建时使用patchelf来修改共享库(主要是动态链接库 .so文件)的运行时路径(rpath)。


http://www.kler.cn/a/451622.html

相关文章:

  • MySQL最左匹配原则是什么
  • 追风赶月莫停留,平芜尽处是春山—记一次备考经历(下)
  • 极狐GitLab 17.7正式发布,可从 GitLab 丝滑迁移至极狐GitLab【一】
  • MarkItDown的使用(将Word、Excel、PDF等转换为Markdown格式)
  • 007-spring-bean的相关配置(重要)
  • Vue零基础必学教程(16) 计算属性
  • 消息队列(二)消息队列的高可用原理
  • 面试场景题系列:设计一致性哈希系统
  • vue实现2048小游戏
  • DP83848以太网移植流程,可以TCP通信
  • element-puls封装表单验证
  • python中使用selenium执行组合快捷键ctrl+v不生效问题
  • C++ 的大括号的用法合集
  • Hive与HBase的区别有哪些
  • 商城小程序开发有哪些流程?传统商家如何抓住小程序的流量!
  • 【Python 图片下载器】一款专门为爬虫制作的图片下载器,多线程下载,速度快,支持续传/图片缩放/图片压缩/图片转换
  • 项目练习:element-ui的valid表单验证功能用法
  • 常见API
  • 【Rust自学】6.2. Option枚举
  • Log4j1.27配置日志输出级别不起效
  • 《C++设计模式》工厂模式
  • 抖音视频下载去水印工具推荐
  • DATAHUB FRONTEND 开发测试:
  • WebGIS实战开源项目:智慧机场三维可视化(学习笔记)
  • “开启智能新时代”——机器连接与边缘计算
  • 微信小程序:解决顶部被遮挡的问题