Detectron2: subprocess.CalledProcessError: Command '['which', 'g++']' returned non-zero exit status 1.

Created on 10 Jan 2020  路  4Comments  路  Source: facebookresearch/detectron2

Installing detectron2 on GCP VM(Debian)(without GPU) and I am getting this error.
Following the exact instructions from Tutorial Notebook.

  1. Logs:
    writing dependency_links to detectron2.egg-info/dependency_links.txt
    writing requirements to detectron2.egg-info/requires.txt
    writing top-level names to detectron2.egg-info/top_level.txt
    reading manifest file 'detectron2.egg-info/SOURCES.txt'
    writing manifest file 'detectron2.egg-info/SOURCES.txt'
    running build_ext
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/mnt/disks/cv/detectron2_repo2/setup.py", line 141, in <module>
        cmdclass={"build_ext": torch.utils.cpp_extension.BuildExtension},
      File "/mnt/disks/cv/anaconda3/envs/cvmodel/lib/python3.6/site-packages/setuptools/__init__.py", line 145, in setup
        return distutils.core.setup(**attrs)
      File "/mnt/disks/cv/anaconda3/envs/cvmodel/lib/python3.6/distutils/core.py", line 148, in setup
        dist.run_commands()
      File "/mnt/disks/cv/anaconda3/envs/cvmodel/lib/python3.6/distutils/dist.py", line 955, in run_commands
        self.run_command(cmd)
      File "/mnt/disks/cv/anaconda3/envs/cvmodel/lib/python3.6/distutils/dist.py", line 974, in run_command
        cmd_obj.run()
      File "/mnt/disks/cv/anaconda3/envs/cvmodel/lib/python3.6/site-packages/setuptools/command/develop.py", line 38, in run
        self.install_for_development()
      File "/mnt/disks/cv/anaconda3/envs/cvmodel/lib/python3.6/site-packages/setuptools/command/develop.py", line 140, in install_for_development
        self.run_command('build_ext')
      File "/mnt/disks/cv/anaconda3/envs/cvmodel/lib/python3.6/distutils/cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "/mnt/disks/cv/anaconda3/envs/cvmodel/lib/python3.6/distutils/dist.py", line 974, in run_command
        cmd_obj.run()
      File "/mnt/disks/cv/anaconda3/envs/cvmodel/lib/python3.6/site-packages/setuptools/command/build_ext.py", line 84, in run
        _build_ext.run(self)
      File "/mnt/disks/cv/anaconda3/envs/cvmodel/lib/python3.6/site-packages/Cython/Distutils/old_build_ext.py", line 186, in run
        _build_ext.build_ext.run(self)
      File "/mnt/disks/cv/anaconda3/envs/cvmodel/lib/python3.6/distutils/command/build_ext.py", line 339, in run
        self.build_extensions()
      File "/mnt/disks/cv/anaconda3/envs/cvmodel/lib/python3.6/site-packages/torch/utils/cpp_extension.py", line 238, in build_extensions
        self._check_abi()
      File "/mnt/disks/cv/anaconda3/envs/cvmodel/lib/python3.6/site-packages/torch/utils/cpp_extension.py", line 380, in _check_abi
        check_compiler_abi_compatibility(compiler)
      File "/mnt/disks/cv/anaconda3/envs/cvmodel/lib/python3.6/site-packages/torch/utils/cpp_extension.py", line 168, in check_compiler_abi_compatibility
        if not check_compiler_ok_for_platform(compiler):
      File "/mnt/disks/cv/anaconda3/envs/cvmodel/lib/python3.6/site-packages/torch/utils/cpp_extension.py", line 144, in check_compiler_ok_for_platform
        which = subprocess.check_output(['which', compiler], stderr=subprocess.STDOUT)
      File "/mnt/disks/cv/anaconda3/envs/cvmodel/lib/python3.6/subprocess.py", line 356, in check_output
        **kwargs).stdout
      File "/mnt/disks/cv/anaconda3/envs/cvmodel/lib/python3.6/subprocess.py", line 438, in run
        output=stdout, stderr=stderr)
    subprocess.CalledProcessError: Command '['which', 'g++']' returned non-zero exit status 1.
    ----------------------------------------
ERROR: Command errored out with exit status 1: /mnt/disks/cv/anaconda3/envs/cvmodel/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/mnt/disks/cv/detectron2_repo2/setup.py'"'"'
; __file__='"'"'/mnt/disks/cv/detectron2_repo2/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __
file__, '"'"'exec'"'"'))' develop --no-deps Check the logs for full command output.
installation / environment

Most helpful comment

Any chance you have gcc but not g++? Normally they should come together though.

All 4 comments

As INSTALL.md says you need gcc>=4.9.

I have gcc >= 4.9

gcc (Debian 6.3.0-18+deb9u1) 6.3.0 20170516

Still getting the error.

Any chance you have gcc but not g++? Normally they should come together though.

Yeah, g++ wasn't installed.
It worked.

Was this page helpful?
0 / 5 - 0 ratings