记录 | 安装地平线工具链install_ai_toolchain.sh出现cython版本问题报错解决
安装地平线工具链 install_ai_toolchain.sh
:
cd ddk/package/host/ai_toolchain
bash install_ai_toolchain.sh
出现报错:
Requirement already satisfied: packaging>=20.0 in /root/.local/lib/python3.8/site-packages (from matplotlib>=2.1.0->pycocotools==2.0.3->horizon-tc-ui==1.17.4) (21.3)
Building wheels for collected packages: pycocotoolsBuilding wheel for pycocotools (setup.py) ... errorerror: subprocess-exited-with-error× python setup.py bdist_wheel did not run successfully.│ exit code: 1╰─> [43 lines of output]/tmp/pip-install-usyyw9sm/pycocotools_4bac52cd9bd64fc28e2f32053854883e/setup.py:12: _DeprecatedInstaller: setuptools.installer and fetch_build_eggs are deprecated.!!********************************************************************************Requirements should be satisfied by a PEP 517 installer.If you are using pip, you can try `pip install --use-pep517`.********************************************************************************!!dist.Distribution().fetch_build_eggs(setup_requires)/root/anaconda3/envs/oe_py38/lib/python3.8/site-packages/setuptools/__init__.py:84: _DeprecatedInstaller: setuptools.installer and fetch_build_eggs are deprecated.!!********************************************************************************Requirements should be satisfied by a PEP 517 installer.If you are using pip, you can try `pip install --use-pep517`.********************************************************************************!!dist.fetch_build_eggs(dist.setup_requires)running bdist_wheelrunning buildrunning build_pycreating buildcreating build/lib.linux-x86_64-cpython-38creating build/lib.linux-x86_64-cpython-38/pycocotoolscopying pycocotools/coco.py -> build/lib.linux-x86_64-cpython-38/pycocotoolscopying pycocotools/cocoeval.py -> build/lib.linux-x86_64-cpython-38/pycocotoolscopying pycocotools/mask.py -> build/lib.linux-x86_64-cpython-38/pycocotoolscopying pycocotools/__init__.py -> build/lib.linux-x86_64-cpython-38/pycocotoolsrunning build_extCompiling pycocotools/_mask.pyx because it changed.[1/1] Cythonizing pycocotools/_mask.pyx/tmp/pip-install-usyyw9sm/pycocotools_4bac52cd9bd64fc28e2f32053854883e/.eggs/Cython-3.0.2-py3.8-linux-x86_64.egg/Cython/Compiler/Main.py:384: FutureWarning: Cython directive 'language_level' not set, using '3str' for now (Py3). This has changed from earlier releases! File: /tmp/pip-install-usyyw9sm/pycocotools_4bac52cd9bd64fc28e2f32053854883e/pycocotools/_mask.pyxtree = Parsing.p_module(s, pxd, full_module_name)building 'pycocotools._mask' extensioncreating build/commoncreating build/temp.linux-x86_64-cpython-38creating build/temp.linux-x86_64-cpython-38/commoncreating build/temp.linux-x86_64-cpython-38/pycocotoolsgcc -pthread -B /root/anaconda3/envs/oe_py38/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/root/.local/lib/python3.8/site-packages/numpy/core/include -I./common -I/root/anaconda3/envs/oe_py38/include/python3.8 -c ../common/maskApi.c -o build/temp.linux-x86_64-cpython-38/../common/maskApi.o -Wno-cpp -Wno-unused-function -std=c99gcc: error: ../common/maskApi.c: No such file or directoryerror: command '/usr/bin/gcc' failed with exit code 1[end of output]note: This error originates from a subprocess, and is likely not a problem with pip.ERROR: Failed building wheel for pycocotoolsRunning setup.py clean for pycocotools
Failed to build pycocotools
ERROR: Could not build wheels for pycocotools, which is required to install pyproject.toml-based projects
解决办法:
安装 cpython,而且是一定要安装较低版本的 cpython:
pip install cython==0.29.36
然后重新安装即可。