Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Got ERROR: Failed building wheel for pytorch3d #1830

Open
charcoalny opened this issue Jul 3, 2024 · 2 comments
Open

Got ERROR: Failed building wheel for pytorch3d #1830

charcoalny opened this issue Jul 3, 2024 · 2 comments

Comments

@charcoalny
Copy link

I am doing this on Google colab

My code is

conda install pytorch==2.3.0 torchvision===0.18.0 torchaudio==2.3.0 cudatoolkit=11.3 -c pytorch -c nvidia
conda install -c fvcore -c iopath -c conda-forge fvcore iopath
conda install -c bottler nvidiacub
pip install --no-index --no-cache-dir pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/py38_cu113_pyt1110/download.html
FORCE_CUDA=1 pip install install git+https://github.com/facebookresearch/pytorch3d.git@stable -v

At first I didn't add FORCE_CUDA=1, it can be install but I got Not compiled with GPU support error later
So I add FORCE_CUDA=1 and now I get this

Collecting git+https://github.com/facebookresearch/pytorch3d.git@stable
  Cloning https://github.com/facebookresearch/pytorch3d.git (to revision stable) to /tmp/pip-req-build-kjknf5bq
  Running command git version
  git version 2.34.1
  Running command git clone --filter=blob:none https://github.com/facebookresearch/pytorch3d.git /tmp/pip-req-build-kjknf5bq
  Cloning into '/tmp/pip-req-build-kjknf5bq'...
  Updating files:   0% (2/1062)
  Updating files: 100% (1062/1062)
  Updating files: 100% (1062/1062), done.
  Running command git show-ref stable
  89653419d0973396f3eff1a381ba09a07fffc2ed refs/tags/stable
  Running command git rev-parse HEAD
  51fd114d8b8eed19226870ee7fd12dba1e25d550
  Running command git checkout -q 89653419d0973396f3eff1a381ba09a07fffc2ed
  Resolved https://github.com/facebookresearch/pytorch3d.git to commit 89653419d0973396f3eff1a381ba09a07fffc2ed
  Running command git rev-parse HEAD
  89653419d0973396f3eff1a381ba09a07fffc2ed
  Running command python setup.py egg_info
  running egg_info
  creating /tmp/pip-pip-egg-info-txaysmtf/pytorch3d.egg-info
  writing /tmp/pip-pip-egg-info-txaysmtf/pytorch3d.egg-info/PKG-INFO
  writing dependency_links to /tmp/pip-pip-egg-info-txaysmtf/pytorch3d.egg-info/dependency_links.txt
  writing entry points to /tmp/pip-pip-egg-info-txaysmtf/pytorch3d.egg-info/entry_points.txt
  writing requirements to /tmp/pip-pip-egg-info-txaysmtf/pytorch3d.egg-info/requires.txt
  writing top-level names to /tmp/pip-pip-egg-info-txaysmtf/pytorch3d.egg-info/top_level.txt
  writing manifest file '/tmp/pip-pip-egg-info-txaysmtf/pytorch3d.egg-info/SOURCES.txt'
  reading manifest file '/tmp/pip-pip-egg-info-txaysmtf/pytorch3d.egg-info/SOURCES.txt'
  adding license file 'LICENSE'
  adding license file 'LICENSE-3RD-PARTY'
  writing manifest file '/tmp/pip-pip-egg-info-txaysmtf/pytorch3d.egg-info/SOURCES.txt'
  /usr/local/envs/hybrik/lib/python3.8/site-packages/torch/utils/cpp_extension.py:499: 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.'))
  Preparing metadata (setup.py) ... done
Collecting install
  Obtaining dependency information for install from https://files.pythonhosted.org/packages/4d/c8/8cbca135f9e167810756ea2bc34b028501936675fcbd7dadccf752fa4622/install-1.3.5-py3-none-any.whl.metadata
  Using cached install-1.3.5-py3-none-any.whl.metadata (925 bytes)
Requirement already satisfied: fvcore in /usr/local/envs/hybrik/lib/python3.8/site-packages (from pytorch3d==0.7.7) (0.1.5.post20210915)
Requirement already satisfied: iopath in /usr/local/envs/hybrik/lib/python3.8/site-packages (from pytorch3d==0.7.7) (0.1.9)
Requirement already satisfied: numpy in /usr/local/envs/hybrik/lib/python3.8/site-packages (from fvcore->pytorch3d==0.7.7) (1.24.4)
Requirement already satisfied: yacs>=0.1.6 in /usr/local/envs/hybrik/lib/python3.8/site-packages (from fvcore->pytorch3d==0.7.7) (0.1.8)
Requirement already satisfied: pyyaml>=5.1 in /usr/local/envs/hybrik/lib/python3.8/site-packages (from fvcore->pytorch3d==0.7.7) (6.0.1)
Requirement already satisfied: tqdm in /usr/local/envs/hybrik/lib/python3.8/site-packages (from fvcore->pytorch3d==0.7.7) (4.66.4)
Requirement already satisfied: termcolor>=1.1 in /usr/local/envs/hybrik/lib/python3.8/site-packages (from fvcore->pytorch3d==0.7.7) (2.4.0)
Requirement already satisfied: Pillow in /usr/local/envs/hybrik/lib/python3.8/site-packages (from fvcore->pytorch3d==0.7.7) (10.4.0)
Requirement already satisfied: tabulate in /usr/local/envs/hybrik/lib/python3.8/site-packages (from fvcore->pytorch3d==0.7.7) (0.9.0)
Requirement already satisfied: portalocker in /usr/local/envs/hybrik/lib/python3.8/site-packages (from iopath->pytorch3d==0.7.7) (2.10.0)
Using cached install-1.3.5-py3-none-any.whl (3.2 kB)
Building wheels for collected packages: pytorch3d
  Running command git rev-parse HEAD
  89653419d0973396f3eff1a381ba09a07fffc2ed
  Running command python setup.py bdist_wheel
  running bdist_wheel
  /usr/local/envs/hybrik/lib/python3.8/site-packages/torch/utils/cpp_extension.py:499: 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.'))
  running build
  running build_py
  creating build
  creating build/lib.linux-x86_64-cpython-38
  creating build/lib.linux-x86_64-cpython-38/projects
  copying projects/__init__.py -> build/lib.linux-x86_64-cpython-38/projects
  creating build/lib.linux-x86_64-cpython-38/pytorch3d
  copying pytorch3d/__init__.py -> build/lib.linux-x86_64-cpython-38/pytorch3d
  creating build/lib.linux-x86_64-cpython-38/pytorch3d/datasets
  copying pytorch3d/datasets/utils.py -> build/lib.linux-x86_64-cpython-38/pytorch3d/datasets
skip some file copying
  creating build/temp.linux-x86_64-cpython-38/tmp/pip-req-build-kjknf5bq/pytorch3d/csrc/sample_pdf
  /usr/local/envs/hybrik/lib/python3.8/site-packages/torch/utils/cpp_extension.py:1967: UserWarning: TORCH_CUDA_ARCH_LIST is not set, all archs for visible cards are included for compilation.
  If this is not desired, please set os.environ['TORCH_CUDA_ARCH_LIST'].
    warnings.warn(
  /usr/local/cuda/bin/nvcc -DWITH_CUDA -DTHRUST_IGNORE_CUB_VERSION_CHECK -I/tmp/pip-req-build-kjknf5bq/pytorch3d/csrc -I/usr/local/envs/hybrik/include -I/usr/local/envs/hybrik/lib/python3.8/site-packages/torch/include -I/usr/local/envs/hybrik/lib/python3.8/site-packages/torch/include/torch/csrc/api/include -I/usr/local/envs/hybrik/lib/python3.8/site-packages/torch/include/TH -I/usr/local/envs/hybrik/lib/python3.8/site-packages/torch/include/THC -I/usr/local/cuda/include -I/usr/local/envs/hybrik/include/python3.8 -c /tmp/pip-req-build-kjknf5bq/pytorch3d/csrc/ball_query/ball_query.cu -o build/temp.linux-x86_64-cpython-38/tmp/pip-req-build-kjknf5bq/pytorch3d/csrc/ball_query/ball_query.o -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_BFLOAT16_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr --compiler-options '-fPIC' -DCUDA_HAS_FP16=1 -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ -std=c++17 -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE=\"_gcc\" -DPYBIND11_STDLIB=\"_libstdcpp\" -DPYBIND11_BUILD_ABI=\"_cxxabi1011\" -DTORCH_EXTENSION_NAME=_C -D_GLIBCXX_USE_CXX11_ABI=0 -gencode=arch=compute_75,code=compute_75 -gencode=arch=compute_75,code=sm_75
  /usr/local/cuda/include/cub/detail/detect_cuda_runtime.cuh(40): error: this declaration has no storage class or type specifier
    CUB_NAMESPACE_BEGIN
    ^

  /usr/local/cuda/include/cub/detail/detect_cuda_runtime.cuh(41): error: expected a ";"
    namespace detail
    ^

  /usr/local/cuda/include/thrust/detail/execute_with_dependencies.h(128): warning #12-D: parsing restarts here after previous syntax error
    };
     ^

  Remark: The warnings can be suppressed with "-diag-suppress <warning-number>"

  /usr/local/cuda/include/thrust/detail/execute_with_dependencies.h(153): error: remove_cvref_t is not a template
        std::tuple<remove_cvref_t<Dependencies>...> dependencies;
                   ^

  /usr/local/cuda/include/thrust/detail/execute_with_dependencies.h(185): error: remove_cvref_t is not a template
        std::tuple<remove_cvref_t<Dependencies>...>
                   ^

  /usr/local/cuda/include/thrust/detail/execute_with_dependencies.h(227): error: remove_cvref_t is not a template
    std::tuple<remove_cvref_t<Dependencies>...>
               ^

  /usr/local/cuda/include/thrust/detail/execute_with_dependencies.h(226): warning #1835-D: attribute "__host__" does not apply here
    __attribute__((host))
                   ^

  /usr/local/cuda/include/thrust/detail/execute_with_dependencies.h(228): error: namespace "thrust::detail" has no member "execute_with_dependencies"
    extract_dependencies(thrust::detail::execute_with_dependencies<BaseSystem, Dependencies...>&& system)
                                         ^

  /usr/local/cuda/include/thrust/detail/execute_with_dependencies.h(228): error: argument list for template template parameter "BaseSystem" is missing
    extract_dependencies(thrust::detail::execute_with_dependencies<BaseSystem, Dependencies...>&& system)
                                                                   ^

  /usr/local/cuda/include/thrust/detail/execute_with_dependencies.h(228): error: type name is not allowed
    extract_dependencies(thrust::detail::execute_with_dependencies<BaseSystem, Dependencies...>&& system)
                                                                               ^

  /usr/local/cuda/include/thrust/detail/execute_with_dependencies.h(228): error: expected a ")"
    extract_dependencies(thrust::detail::execute_with_dependencies<BaseSystem, Dependencies...>&& system)
                                                                                              ^

  /usr/local/cuda/include/thrust/detail/execute_with_dependencies.h(229): error: expected a ";"
    {
    ^

  /usr/local/cuda/include/thrust/detail/execute_with_allocator_fwd.h(47): error: this pragma must immediately precede a declaration
    #pragma nv_exec_check_disable
            ^

  /usr/local/cuda/include/thrust/type_traits/is_trivially_relocatable.h(343): error: proclaim_trivially_relocatable is not a template
     namespace thrust { template <> struct proclaim_trivially_relocatable<__half> : ::thrust::true_type {}; }
                                           ^

  /usr/local/cuda/include/thrust/type_traits/is_trivially_relocatable.h(344): error: proclaim_trivially_relocatable is not a template
     namespace thrust { template <> struct proclaim_trivially_relocatable<__half2> : ::thrust::true_type {}; }
                                           ^

  /usr/local/cuda/include/thrust/type_traits/is_trivially_relocatable.h(346): error: proclaim_trivially_relocatable is not a template
     namespace thrust { template <> struct proclaim_trivially_relocatable<float1> : ::thrust::true_type {}; }
                                           ^

  /usr/local/cuda/include/thrust/type_traits/is_trivially_relocatable.h(347): error: proclaim_trivially_relocatable is not a template
     namespace thrust { template <> struct proclaim_trivially_relocatable<float2> : ::thrust::true_type {}; }
                                           ^

  /usr/local/cuda/include/thrust/type_traits/is_trivially_relocatable.h(348): error: proclaim_trivially_relocatable is not a template
     namespace thrust { template <> struct proclaim_trivially_relocatable<float3> : ::thrust::true_type {}; }
                                           ^

  /usr/local/cuda/include/thrust/type_traits/is_trivially_relocatable.h(349): error: proclaim_trivially_relocatable is not a template
     namespace thrust { template <> struct proclaim_trivially_relocatable<float4> : ::thrust::true_type {}; }
                                           ^

  /usr/local/cuda/include/thrust/type_traits/is_trivially_relocatable.h(350): error: proclaim_trivially_relocatable is not a template
     namespace thrust { template <> struct proclaim_trivially_relocatable<double1> : ::thrust::true_type {}; }
                                           ^

  /usr/local/cuda/include/thrust/type_traits/is_trivially_relocatable.h(351): error: proclaim_trivially_relocatable is not a template
     namespace thrust { template <> struct proclaim_trivially_relocatable<double2> : ::thrust::true_type {}; }
                                           ^

  /usr/local/cuda/include/thrust/type_traits/is_trivially_relocatable.h(352): error: proclaim_trivially_relocatable is not a template
     namespace thrust { template <> struct proclaim_trivially_relocatable<double3> : ::thrust::true_type {}; }
                                           ^

  /usr/local/cuda/include/thrust/type_traits/is_trivially_relocatable.h(353): error: proclaim_trivially_relocatable is not a template
     namespace thrust { template <> struct proclaim_trivially_relocatable<double4> : ::thrust::true_type {}; }
                                           ^

  /usr/local/cuda/include/thrust/detail/complex/complex.inl(333): error: a template argument list is not allowed in a declaration of a primary template
    struct proclaim_trivially_relocatable<complex<T> > : thrust::true_type {};
           ^

  22 errors detected in the compilation of "/tmp/pip-req-build-kjknf5bq/pytorch3d/csrc/ball_query/ball_query.cu".
  error: command '/usr/local/cuda/bin/nvcc' failed with exit code 2
  error: subprocess-exited-with-error
  
  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> See above for output.
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  full command: /usr/local/envs/hybrik/bin/python3.8 -u -c '
  exec(compile('"'"''"'"''"'"'
  # This is <pip-setuptools-caller> -- a caller that pip uses to run setup.py
  #
  # - It imports setuptools before invoking setup.py, to enable projects that directly
  #   import from `distutils.core` to work with newer packaging standards.
  # - It provides a clear error message when setuptools is not installed.
  # - It sets `sys.argv[0]` to the underlying `setup.py`, when invoking `setup.py` so
  #   setuptools doesn'"'"'t think the script is `-c`. This avoids the following warning:
  #     manifest_maker: standard file '"'"'-c'"'"' not found".
  # - It generates a shim setup.py, for handling setup.cfg-only projects.
  import os, sys, tokenize
  
  try:
      import setuptools
  except ImportError as error:
      print(
          "ERROR: Can not execute `setup.py` since setuptools is not available in "
          "the build environment.",
          file=sys.stderr,
      )
      sys.exit(1)
  
  __file__ = %r
  sys.argv[0] = __file__
  
  if os.path.exists(__file__):
      filename = __file__
      with tokenize.open(__file__) as f:
          setup_py_code = f.read()
  else:
      filename = "<auto-generated setuptools caller>"
      setup_py_code = "from setuptools import setup; setup()"
  
  exec(compile(setup_py_code, filename, "exec"))
  '"'"''"'"''"'"' % ('"'"'/tmp/pip-req-build-kjknf5bq/setup.py'"'"',), "<pip-setuptools-caller>", "exec"))' bdist_wheel -d /tmp/pip-wheel-ywwrsmje
  cwd: /tmp/pip-req-build-kjknf5bq/
  Building wheel for pytorch3d (setup.py) ... error
  ERROR: Failed building wheel for pytorch3d
  Running setup.py clean for pytorch3d
  Running command python setup.py clean
  running clean
  removing 'build/temp.linux-x86_64-cpython-38' (and everything under it)
  removing 'build/lib.linux-x86_64-cpython-38' (and everything under it)
  'build/bdist.linux-x86_64' does not exist -- can't clean it
  'build/scripts-3.8' does not exist -- can't clean it
  removing 'build'
Failed to build pytorch3d
ERROR: Could not build wheels for pytorch3d, which is required to install pyproject.toml-based projects

Anyone have any idea?

@charcoalny
Copy link
Author

it can be install after I remove/ not installing nvidiacub

@bottler
Copy link
Contributor

bottler commented Jul 11, 2024

I see /usr/local/cuda/include/cub/ which suggests it is not using the version of cub you downloaded from conda. I think it would be good to check that the environment variable CUB_HOME is not set, and that you can see files in $CONDA_PREFIX/include/cub.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants