「已解决」mujoco py install error - fatal error: GL/osmesa.h: No such file or directory

用户在安装mujoco相关库时遇到编译错误,因GL/osmesa.h文件未找到。解决方法是通过`sudoapt-getinstalllibosmesa6-dev`来安装所需的开发库。

问题描述

安装mujoco200和mujoco-py时遇到报错

/tmp/pip-install-17okd8wq/mujoco-py_12b8907c86c0458dab4f02eedf9b2ad1/mujoco_py/gl/osmesashim.c:1:10: fatal error: GL/osmesa.h: No such file or directory
        1 | #include <GL/osmesa.h>
          |          ^~~~~~~~~~~~~
    compilation terminated.
    error: command '/usr/bin/gcc' failed with exit code 1

解决办法

sudo apt-get install libosmesa6-dev
DEPRECATION: Building 'aitodpycocotools' using the legacy setup.py bdist_wheel mechanism, which will be removed in a future version. pip 25.3 will enforce this behaviour change. A possible replacement is to use the standardized build interface by setting the `--use-pep517` option, (possibly combined with `--no-build-isolation`), or adding a `pyproject.toml` file to the source tree of 'aitodpycocotools'. Discussion can be found at https://github.com/pypa/pip/issues/6334 Building wheel for aitodpycocotools (setup.py) ... error error: subprocess-exited-with-error × python setup.py bdist_wheel did not run successfully. │ exit code: 1 ╰─> [19 lines of output] running bdist_wheel running build running build_py creating build\lib.win-amd64-cpython-39\aitodpycocotools copying aitodpycocotools\coco.py -> build\lib.win-amd64-cpython-39\aitodpycocotools copying aitodpycocotools\cocoeval.py -> build\lib.win-amd64-cpython-39\aitodpycocotools copying aitodpycocotools\mask.py -> build\lib.win-amd64-cpython-39\aitodpycocotools copying aitodpycocotools\__init__.py -> build\lib.win-amd64-cpython-39\aitodpycocotools running build_ext Compiling aitodpycocotools/_mask.pyx because it changed. [1/1] Cythonizing aitodpycocotools/_mask.pyx building 'aitodpycocotools._mask' extension creating build\temp.win-amd64-cpython-39\Release\..\common creating build\temp.win-amd64-cpython-39\Release\aitodpycocotools creating build\temp.win-amd64-cpython-39\Release\common "D:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.44.35207\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -ID:\anaconda3\envs\env1\lib\site-packages\numpy\_core\include -Icommon -ID:\anaconda3\envs\env1\include -ID:\anaconda3\envs\env1\Include "-ID:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.44.35207\include" "-ID:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.26100.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.26100.0\\um" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.26100.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.26100.0\\winrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.26100.0\\cppwinrt" /Tc../common/maskApi.c /Fobuild\temp.win-amd64-cpython-39\Release\..\common\maskApi.obj maskApi.c c1: fatal error C1083: 无法打开源文件:../common/maskApi.c”: No such file or directory error: command 'D:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Tools\\MSVC\\14.44.35207\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2 [end of output] note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for aitodpycocotools Running setup.py clean for aitodpycocotools Failed to build aitodpycocotools error: failed-wheel-build-for-install × Failed to build installable wheels for some pyproject.toml based projects ╰─> aitodpycocotools
最新发布
09-16
在使用 `pip` 构建 `aitodpycocotools` 的 wheel 包时出现 `无法打开源文件:../common/maskApi.c”: No such file or directory` 和 `subprocess-exited-with-error` 的问题,可能是由以下原因导致的,以下是对应的解决办法: #### 文件缺失 `maskApi.c` 文件确实不存在于指定路径,可能是代码仓库克隆不完整。可以尝试重新克隆仓库,确保所有文件都被正确下载: ```bash git clone https://github.com/jwwangchn/cocoapi-aitod.git cd cocoapi-aitod/PythonAPI ``` #### 路径问题 代码中指定的相对路径可能不正确。可以检查 `setup.py` 文件中引用 `maskApi.c` 文件的部分,确保路径无误。例如,若 `setup.py` 中有类似如下代码: ```python from setuptools import setup, Extension import numpy as np mask_api = Extension( 'pycocotools._mask', sources=['../common/maskApi.c', 'pycocotools/mask.pyx'], include_dirs=[np.get_include(), '../common'] ) setup( name='pycocotools', packages=['pycocotools'], ext_modules=[mask_api] ) ``` 要保证 `../common/maskApi.c` 路径能正确指向文件。 #### 权限问题 当前用户可能没有足够的权限访问 `maskApi.c` 文件。可以检查文件权限,并确保当前用户有读取和执行权限: ```bash chmod +r ../common/maskApi.c ``` #### 依赖问题 构建过程可能依赖于一些系统库或工具,缺少这些依赖可能导致构建失败。可以确保安装了必要的编译工具和依赖库,例如在 Ubuntu 系统上: ```bash sudo apt-get install build-essential python3-dev ```
评论 2
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值