Notice
Recent Posts
Recent Comments
Link
«   2025/04   »
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30
Archives
Today
Total
관리 메뉴

말랑코딩

[yolox 에러 해결] subprocess.CalledProcessError: Command '['which', 'g++']' returned non-zero exit status 1. 본문

에러노트

[yolox 에러 해결] subprocess.CalledProcessError: Command '['which', 'g++']' returned non-zero exit status 1.

코랑이 2022. 2. 9. 15:09

python setup.py develop 으로 실행 환경 설정을 하려고 했는데

아래와 같은 g++ 에러가 떴다.

(torch_new) root@35156265a412:/app/YOLOX# python setup.py develop
running develop
running egg_info
writing yolox.egg-info/PKG-INFO
writing dependency_links to yolox.egg-info/dependency_links.txt
writing requirements to yolox.egg-info/requires.txt
writing top-level names to yolox.egg-info/top_level.txt
/opt/conda/envs/torch_new/lib/python3.7/site-packages/torch/utils/cpp_extension.py:369: UserWarning: Attempted to use ninja as the BuildExtension backend but we could not find ninja.. Falling back to using the slow distutils backend.
  warnings.warn(msg.format('we could not find ninja.'))
reading manifest file 'yolox.egg-info/SOURCES.txt'
adding license file 'LICENSE'
writing manifest file 'yolox.egg-info/SOURCES.txt'
running build_ext
Traceback (most recent call last):
  File "setup.py", line 90, in <module>
    "Tracker": "https://github.com/Megvii-BaseDetection/YOLOX/issues",
  File "/opt/conda/envs/torch_new/lib/python3.7/site-packages/setuptools/__init__.py", line 153, in setup
    return distutils.core.setup(**attrs)
  File "/opt/conda/envs/torch_new/lib/python3.7/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/opt/conda/envs/torch_new/lib/python3.7/distutils/dist.py", line 966, in run_commands
    self.run_command(cmd)
  File "/opt/conda/envs/torch_new/lib/python3.7/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File "/opt/conda/envs/torch_new/lib/python3.7/site-packages/setuptools/command/develop.py", line 34, in run
    self.install_for_development()
  File "/opt/conda/envs/torch_new/lib/python3.7/site-packages/setuptools/command/develop.py", line 114, in install_for_development
    self.run_command('build_ext')
  File "/opt/conda/envs/torch_new/lib/python3.7/distutils/cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "/opt/conda/envs/torch_new/lib/python3.7/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File "/opt/conda/envs/torch_new/lib/python3.7/site-packages/setuptools/command/build_ext.py", line 79, in run
    _build_ext.run(self)
  File "/opt/conda/envs/torch_new/lib/python3.7/distutils/command/build_ext.py", line 340, in run
    self.build_extensions()
  File "/opt/conda/envs/torch_new/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 378, in build_extensions
    self._check_abi()
  File "/opt/conda/envs/torch_new/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 734, in _check_abi
    check_compiler_abi_compatibility(compiler)
  File "/opt/conda/envs/torch_new/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 282, in check_compiler_abi_compatibility
    if not check_compiler_ok_for_platform(compiler):
  File "/opt/conda/envs/torch_new/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 242, in check_compiler_ok_for_platform
    which = subprocess.check_output(['which', compiler], stderr=subprocess.STDOUT)
  File "/opt/conda/envs/torch_new/lib/python3.7/subprocess.py", line 411, in check_output
    **kwargs).stdout
  File "/opt/conda/envs/torch_new/lib/python3.7/subprocess.py", line 512, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['which', 'g++']' returned non-zero exit status 1.

 

docker 에서 실행 시 위와 같은 에러가 나는데, cuda, cudnn 등이 설치돼있지 않아서 생긴 문제이다.

이미지 중에 cuda,cnn 기반으로 된 이미지에서 실행시키면 에러 해결됨.

 

아래는 내가 사용한 이미지를 불러오는 명령어다.

 

docker pull torch:cuda11.1_cu8

 

 

 

Comments