Simple-Robotics / cosypose

Code for "CosyPose: Consistent multi-view multi-object 6D pose estimation", ECCV 2020.
MIT License
70 stars 15 forks source link

setup.py install error when building pytorch extensions #17

Open EtienneAr opened 1 year ago

EtienneAr commented 1 year ago

Hello,

I got the following error while running python setup.py install on a Mac Studio Ultra :

/Users/<username>/micromamba/envs/ros_cosypose/lib/python3.8/site-packages/setuptools/_distutils/extension.py:134: UserWarning: Unknown Extension options: 'verbose'
  warnings.warn(msg)
running install
/Users/<username>/micromamba/envs/ros_cosypose/lib/python3.8/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
  warnings.warn(
/Users/<username>/micromamba/envs/ros_cosypose/lib/python3.8/site-packages/setuptools/command/easy_install.py:144: EasyInstallDeprecationWarning: easy_install command is deprecated. Use build and pip and other standards-based tools.
  warnings.warn(
running bdist_egg
running egg_info
writing cosypose.egg-info/PKG-INFO
writing dependency_links to cosypose.egg-info/dependency_links.txt
writing top-level names to cosypose.egg-info/top_level.txt
/Users/<username>/micromamba/envs/ros_cosypose/lib/python3.8/site-packages/torch/utils/cpp_extension.py:478: 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 'cosypose.egg-info/SOURCES.txt'
adding license file 'LICENSE'
writing manifest file 'cosypose.egg-info/SOURCES.txt'
installing library code to build/bdist.macosx-11.0-arm64/egg
running install_lib
running build_py
running build_ext
Traceback (most recent call last):
  File "setup.py", line 11, in <module>
    setup(
  File "/Users/<username>/micromamba/envs/ros_cosypose/lib/python3.8/site-packages/setuptools/__init__.py", line 108, in setup
    return distutils.core.setup(**attrs)
  File "/Users/<username>/micromamba/envs/ros_cosypose/lib/python3.8/site-packages/setuptools/_distutils/core.py", line 185, in setup
    return run_commands(dist)
  File "/Users/<username>/micromamba/envs/ros_cosypose/lib/python3.8/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
    dist.run_commands()
  File "/Users/<username>/micromamba/envs/ros_cosypose/lib/python3.8/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands
    self.run_command(cmd)
  File "/Users/<username>/micromamba/envs/ros_cosypose/lib/python3.8/site-packages/setuptools/dist.py", line 1221, in run_command
    super().run_command(command)
  File "/Users/<username>/micromamba/envs/ros_cosypose/lib/python3.8/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
    cmd_obj.run()
  File "/Users/<username>/micromamba/envs/ros_cosypose/lib/python3.8/site-packages/setuptools/command/install.py", line 74, in run
    self.do_egg_install()
  File "/Users/<username>/micromamba/envs/ros_cosypose/lib/python3.8/site-packages/setuptools/command/install.py", line 123, in do_egg_install
    self.run_command('bdist_egg')
  File "/Users/<username>/micromamba/envs/ros_cosypose/lib/python3.8/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
    self.distribution.run_command(command)
  File "/Users/<username>/micromamba/envs/ros_cosypose/lib/python3.8/site-packages/setuptools/dist.py", line 1221, in run_command
    super().run_command(command)
  File "/Users/<username>/micromamba/envs/ros_cosypose/lib/python3.8/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
    cmd_obj.run()
  File "/Users/<username>/micromamba/envs/ros_cosypose/lib/python3.8/site-packages/setuptools/command/bdist_egg.py", line 164, in run
    cmd = self.call_command('install_lib', warn_dir=0)
  File "/Users/<username>/micromamba/envs/ros_cosypose/lib/python3.8/site-packages/setuptools/command/bdist_egg.py", line 150, in call_command
    self.run_command(cmdname)
  File "/Users/<username>/micromamba/envs/ros_cosypose/lib/python3.8/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
    self.distribution.run_command(command)
  File "/Users/<username>/micromamba/envs/ros_cosypose/lib/python3.8/site-packages/setuptools/dist.py", line 1221, in run_command
    super().run_command(command)
  File "/Users/<username>/micromamba/envs/ros_cosypose/lib/python3.8/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
    cmd_obj.run()
  File "/Users/<username>/micromamba/envs/ros_cosypose/lib/python3.8/site-packages/setuptools/command/install_lib.py", line 11, in run
    self.build()
  File "/Users/<username>/micromamba/envs/ros_cosypose/lib/python3.8/site-packages/setuptools/_distutils/command/install_lib.py", line 111, in build
    self.run_command('build_ext')
  File "/Users/<username>/micromamba/envs/ros_cosypose/lib/python3.8/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
    self.distribution.run_command(command)
  File "/Users/<username>/micromamba/envs/ros_cosypose/lib/python3.8/site-packages/setuptools/dist.py", line 1221, in run_command
    super().run_command(command)
  File "/Users/<username>/micromamba/envs/ros_cosypose/lib/python3.8/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
    cmd_obj.run()
  File "/Users/<username>/micromamba/envs/ros_cosypose/lib/python3.8/site-packages/setuptools/command/build_ext.py", line 84, in run
    _build_ext.run(self)
  File "/Users/<username>/micromamba/envs/ros_cosypose/lib/python3.8/site-packages/Cython/Distutils/old_build_ext.py", line 186, in run
    _build_ext.build_ext.run(self)
  File "/Users/<username>/micromamba/envs/ros_cosypose/lib/python3.8/site-packages/setuptools/_distutils/command/build_ext.py", line 345, in run
    self.build_extensions()
  File "/Users/<username>/micromamba/envs/ros_cosypose/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 487, in build_extensions
    compiler_name, compiler_version = self._check_abi()
  File "/Users/<username>/micromamba/envs/ros_cosypose/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 868, in _check_abi
    compiler = self.compiler.compiler_cxx[0]
IndexError: list index out of range

I managed to solve it by commenting this line in the setup.py file :

# Use correct conda compiler used to build pytorch
os.environ['CXX'] = os.environ.get('GXX', '')

I am not sure if this error is specific to my environment or if I should open a PR.

What's your opinion ?

tensarflow commented 1 year ago

I'm on Ubuntu 22.04.3 LTS, had the same issue and the solution you provided worked also for me. Thanks @EtienneAr !