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

Running setup.py install for mesh-mesh-intersection ... error #36

Closed
tillen1001 opened this issue Jan 8, 2024 · 6 comments
Closed

Running setup.py install for mesh-mesh-intersection ... error #36

tillen1001 opened this issue Jan 8, 2024 · 6 comments

Comments

@tillen1001
Copy link

tillen1001 commented Jan 8, 2024

The code released by the author can be run on google Colab, but because my device is relatively new, I want to installed the same environment as colab on the local side (ubuntu version, cuda, and torch are all the same as colab)
There will be an error during the last step of installation: pip install .

It seems to be a problem with the torch or cuda version?
I want to know why mesh-mesh-interseection can be installed on colab, but there are errors on the local side.

`  × Running setup.py install for mesh-mesh-intersection did not run successfully.
  │ exit code: 1
  ╰─> [91 lines of output]
      running install
      /home/widelab/miao/shapy/.venv/shapy/lib/python3.10/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
        warnings.warn(
      running build
      running build_py
      creating build
      creating build/lib.linux-x86_64-3.10
      creating build/lib.linux-x86_64-3.10/body_measurements
      copying body_measurements/__init__.py -> build/lib.linux-x86_64-3.10/body_measurements
      copying body_measurements/cwh_measurements.py -> build/lib.linux-x86_64-3.10/body_measurements
      copying body_measurements/body_measurements.py -> build/lib.linux-x86_64-3.10/body_measurements
      creating build/lib.linux-x86_64-3.10/mesh_mesh_intersection
      copying mesh_mesh_intersection/loss.py -> build/lib.linux-x86_64-3.10/mesh_mesh_intersection
      copying mesh_mesh_intersection/__init__.py -> build/lib.linux-x86_64-3.10/mesh_mesh_intersection
      copying mesh_mesh_intersection/mesh_mesh_intersection.py -> build/lib.linux-x86_64-3.10/mesh_mesh_intersection
      running build_ext
      /home/widelab/miao/shapy/.venv/shapy/lib/python3.10/site-packages/torch/utils/cpp_extension.py:414: UserWarning: The detected CUDA version (12.2) has a minor version mismatch with the version that was used to compile PyTorch (12.1). Most likely this shouldn't be a problem.
        warnings.warn(CUDA_MISMATCH_WARN.format(cuda_str_version, torch.version.cuda))
      /home/widelab/miao/shapy/.venv/shapy/lib/python3.10/site-packages/torch/utils/cpp_extension.py:424: UserWarning: There are no x86_64-linux-gnu-g++ version bounds defined for CUDA version 12.2
        warnings.warn(f'There are no {compiler_name} version bounds defined for CUDA version {cuda_str_version}')
      building 'mesh_mesh_intersect_cuda' extension
      creating /home/widelab/miao/shapy/mesh-mesh-intersection/build/temp.linux-x86_64-3.10
      creating /home/widelab/miao/shapy/mesh-mesh-intersection/build/temp.linux-x86_64-3.10/src
      Emitting ninja build file /home/widelab/miao/shapy/mesh-mesh-intersection/build/temp.linux-x86_64-3.10/build.ninja...
      Compiling objects...
      Allowing ninja to set a default number of workers... (overridable by setting the environment variable MAX_JOBS=N)
      [1/2] /usr/bin/nvcc  -I/home/widelab/miao/shapy/.venv/shapy/lib/python3.10/site-packages/torch/include -I/home/widelab/miao/shapy/.venv/shapy/lib/python3.10/site-packages/torch/include/torch/csrc/api/include -I/home/widelab/miao/shapy/.venv/shapy/lib/python3.10/site-packages/torch/include/TH -I/home/widelab/miao/shapy/.venv/shapy/lib/python3.10/site-packages/torch/include/THC -I/home/widelab/miao/shapy/mesh-mesh-intersection/include -I/home/widelab/miao/shapy/mesh-mesh-intersection/include -I/home/widelab/miao/shapy/.venv/shapy/lib/python3.10/site-packages/torch/include -I/home/widelab/miao/shapy/.venv/shapy/lib/python3.10/site-packages/torch/include/torch/csrc/api/include -I/home/widelab/miao/shapy/.venv/shapy/lib/python3.10/site-packages/torch/include/TH -I/home/widelab/miao/shapy/.venv/shapy/lib/python3.10/site-packages/torch/include/THC -I/home/widelab/miao/shapy/.venv/shapy/include -I/usr/include/python3.10 -c -c /home/widelab/miao/shapy/mesh-mesh-intersection/src/mesh_mesh_intersect_cuda_op.cu -o /home/widelab/miao/shapy/mesh-mesh-intersection/build/temp.linux-x86_64-3.10/src/mesh_mesh_intersect_cuda_op.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'"'"'' -DPRINT_TIMINGS=0 -DDEBUG_PRINT=0 -DERROR_CHECKING=1 -DCOLLISION_ORDERING=1 -DTORCH_API_INCLUDE_EXTENSION_H '-DPYBIND11_COMPILER_TYPE="_gcc"' '-DPYBIND11_STDLIB="_libstdcpp"' '-DPYBIND11_BUILD_ABI="_cxxabi1011"' -DTORCH_EXTENSION_NAME=mesh_mesh_intersect_cuda -D_GLIBCXX_USE_CXX11_ABI=0 -gencode=arch=compute_89,code=compute_89 -gencode=arch=compute_89,code=sm_89 -std=c++17
      FAILED: /home/widelab/miao/shapy/mesh-mesh-intersection/build/temp.linux-x86_64-3.10/src/mesh_mesh_intersect_cuda_op.o
      /usr/bin/nvcc  -I/home/widelab/miao/shapy/.venv/shapy/lib/python3.10/site-packages/torch/include -I/home/widelab/miao/shapy/.venv/shapy/lib/python3.10/site-packages/torch/include/torch/csrc/api/include -I/home/widelab/miao/shapy/.venv/shapy/lib/python3.10/site-packages/torch/include/TH -I/home/widelab/miao/shapy/.venv/shapy/lib/python3.10/site-packages/torch/include/THC -I/home/widelab/miao/shapy/mesh-mesh-intersection/include -I/home/widelab/miao/shapy/mesh-mesh-intersection/include -I/home/widelab/miao/shapy/.venv/shapy/lib/python3.10/site-packages/torch/include -I/home/widelab/miao/shapy/.venv/shapy/lib/python3.10/site-packages/torch/include/torch/csrc/api/include -I/home/widelab/miao/shapy/.venv/shapy/lib/python3.10/site-packages/torch/include/TH -I/home/widelab/miao/shapy/.venv/shapy/lib/python3.10/site-packages/torch/include/THC -I/home/widelab/miao/shapy/.venv/shapy/include -I/usr/include/python3.10 -c -c /home/widelab/miao/shapy/mesh-mesh-intersection/src/mesh_mesh_intersect_cuda_op.cu -o /home/widelab/miao/shapy/mesh-mesh-intersection/build/temp.linux-x86_64-3.10/src/mesh_mesh_intersect_cuda_op.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'"'"'' -DPRINT_TIMINGS=0 -DDEBUG_PRINT=0 -DERROR_CHECKING=1 -DCOLLISION_ORDERING=1 -DTORCH_API_INCLUDE_EXTENSION_H '-DPYBIND11_COMPILER_TYPE="_gcc"' '-DPYBIND11_STDLIB="_libstdcpp"' '-DPYBIND11_BUILD_ABI="_cxxabi1011"' -DTORCH_EXTENSION_NAME=mesh_mesh_intersect_cuda -D_GLIBCXX_USE_CXX11_ABI=0 -gencode=arch=compute_89,code=compute_89 -gencode=arch=compute_89,code=sm_89 -std=c++17
      /usr/include/cub/detail/device_synchronize.cuh(53): error: identifier "__cudaDeviceSynchronizeDeprecationAvoidance" is undefined
      
      1 error detected in the compilation of "/home/widelab/miao/shapy/mesh-mesh-intersection/src/mesh_mesh_intersect_cuda_op.cu".
      [2/2] c++ -MMD -MF /home/widelab/miao/shapy/mesh-mesh-intersection/build/temp.linux-x86_64-3.10/src/mesh_mesh_intersect.o.d -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/home/widelab/miao/shapy/.venv/shapy/lib/python3.10/site-packages/torch/include -I/home/widelab/miao/shapy/.venv/shapy/lib/python3.10/site-packages/torch/include/torch/csrc/api/include -I/home/widelab/miao/shapy/.venv/shapy/lib/python3.10/site-packages/torch/include/TH -I/home/widelab/miao/shapy/.venv/shapy/lib/python3.10/site-packages/torch/include/THC -I/home/widelab/miao/shapy/mesh-mesh-intersection/include -I/home/widelab/miao/shapy/mesh-mesh-intersection/include -I/home/widelab/miao/shapy/.venv/shapy/lib/python3.10/site-packages/torch/include -I/home/widelab/miao/shapy/.venv/shapy/lib/python3.10/site-packages/torch/include/torch/csrc/api/include -I/home/widelab/miao/shapy/.venv/shapy/lib/python3.10/site-packages/torch/include/TH -I/home/widelab/miao/shapy/.venv/shapy/lib/python3.10/site-packages/torch/include/THC -I/home/widelab/miao/shapy/.venv/shapy/include -I/usr/include/python3.10 -c -c /home/widelab/miao/shapy/mesh-mesh-intersection/src/mesh_mesh_intersect.cpp -o /home/widelab/miao/shapy/mesh-mesh-intersection/build/temp.linux-x86_64-3.10/src/mesh_mesh_intersect.o -DTORCH_API_INCLUDE_EXTENSION_H '-DPYBIND11_COMPILER_TYPE="_gcc"' '-DPYBIND11_STDLIB="_libstdcpp"' '-DPYBIND11_BUILD_ABI="_cxxabi1011"' -DTORCH_EXTENSION_NAME=mesh_mesh_intersect_cuda -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++17
      ninja: build stopped: subcommand failed.
      Traceback (most recent call last):
        File "/home/widelab/miao/shapy/.venv/shapy/lib/python3.10/site-packages/torch/utils/cpp_extension.py", line 2100, in _run_ninja_build
          subprocess.run(
        File "/usr/lib/python3.10/subprocess.py", line 526, in run
          raise CalledProcessError(retcode, process.args,
      subprocess.CalledProcessError: Command '['ninja', '-v']' returned non-zero exit status 1.
      
      The above exception was the direct cause of the following exception:
      
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/home/widelab/miao/shapy/mesh-mesh-intersection/setup.py", line 76, in <module>
          setup(name=NAME,
        File "/home/widelab/miao/shapy/.venv/shapy/lib/python3.10/site-packages/setuptools/__init__.py", line 153, in setup
          return distutils.core.setup(**attrs)
        File "/usr/lib/python3.10/distutils/core.py", line 148, in setup
          dist.run_commands()
        File "/usr/lib/python3.10/distutils/dist.py", line 966, in run_commands
          self.run_command(cmd)
        File "/usr/lib/python3.10/distutils/dist.py", line 985, in run_command
          cmd_obj.run()
        File "/home/widelab/miao/shapy/.venv/shapy/lib/python3.10/site-packages/setuptools/command/install.py", line 68, in run
          return orig.install.run(self)
        File "/usr/lib/python3.10/distutils/command/install.py", line 619, in run
          self.run_command('build')
        File "/usr/lib/python3.10/distutils/cmd.py", line 313, in run_command
          self.distribution.run_command(command)
        File "/usr/lib/python3.10/distutils/dist.py", line 985, in run_command
          cmd_obj.run()
        File "/usr/lib/python3.10/distutils/command/build.py", line 135, in run
          self.run_command(cmd_name)
        File "/usr/lib/python3.10/distutils/cmd.py", line 313, in run_command
          self.distribution.run_command(command)
        File "/usr/lib/python3.10/distutils/dist.py", line 985, in run_command
          cmd_obj.run()
        File "/home/widelab/miao/shapy/.venv/shapy/lib/python3.10/site-packages/setuptools/command/build_ext.py", line 79, in run
          _build_ext.run(self)
        File "/usr/lib/python3.10/distutils/command/build_ext.py", line 340, in run
          self.build_extensions()
        File "/home/widelab/miao/shapy/.venv/shapy/lib/python3.10/site-packages/torch/utils/cpp_extension.py", line 873, in build_extensions
          build_ext.build_extensions(self)
        File "/usr/lib/python3.10/distutils/command/build_ext.py", line 449, in build_extensions
          self._build_extensions_serial()
        File "/usr/lib/python3.10/distutils/command/build_ext.py", line 474, in _build_extensions_serial
          self.build_extension(ext)
        File "/home/widelab/miao/shapy/.venv/shapy/lib/python3.10/site-packages/setuptools/command/build_ext.py", line 202, in build_extension
          _build_ext.build_extension(self, ext)
        File "/usr/lib/python3.10/distutils/command/build_ext.py", line 529, in build_extension
          objects = self.compiler.compile(sources,
        File "/home/widelab/miao/shapy/.venv/shapy/lib/python3.10/site-packages/torch/utils/cpp_extension.py", line 686, in unix_wrap_ninja_compile
          _write_ninja_file_and_compile_objects(
        File "/home/widelab/miao/shapy/.venv/shapy/lib/python3.10/site-packages/torch/utils/cpp_extension.py", line 1774, in _write_ninja_file_and_compile_objects
          _run_ninja_build(
        File "/home/widelab/miao/shapy/.venv/shapy/lib/python3.10/site-packages/torch/utils/cpp_extension.py", line 2116, in _run_ninja_build
          raise RuntimeError(message) from e
      RuntimeError: Error compiling objects for extension
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> mesh-mesh-intersection`
@TheChildishMillennial
Copy link

Ive been stuck on this same issue for the last week. Ive seemingly tried everything. I will share the solution if/when I get it to install.

@TheChildishMillennial
Copy link

I was able to successfully build the package on Windows 11, Python 3.10.11 and CUDA 11.8 by following these steps:

  1. For any CUDA version after 11.6, CUDA Samples ARE NOT included in the CUDA Toolkit download. So you must download CUDA Samples from https://github.com/NVIDIA/cuda-samples. Make sure to download the right branch for your CUDA version i.e. 11.8 etc.

  2. The CUDA_SAMPLES_INC must point to the folder that contains "helper_math.h". In the 11.8 samples, it is located in the Common folder

NOTE if you are running windows and follow the given install instructions:
unix shell => export CUDA_SAMPLES_INC=$(pwd)/include
windows cmd => set CUDA_SAMPLES_INC= path/to/helper_math.h

I myself got frustrated and hard coded it into line 58 of setup.py like this:

cuda_samples_inc = r'C:/Program Files/NVIDIA Corporation/CUDA Samples/v11.8/Common' mesh_mesh_intersect_src_files = [ 'src/mesh_mesh_intersect.cpp', 'src/mesh_mesh_intersect_cuda_op.cu'] mesh_mesh_intersect_include_dirs = torch.utils.cpp_extension.include_paths() + [ osp.abspath('include'), cuda_samples_inc]

  1. open mesh-mesh-intersection/include/aabb.hpp and at line 34 delete __align__(32)

  2. open mesh-mesh-intersection/include/triangle.hpp and at line 33 delete __align__(48)

  • credit to chatgpt for deducing the __align__ command is causing flag errors
  1. open mesh-mesh-intersection/src/mesh_mesh_intersect_cuda_op.cu
    here you will search out every instance of "long" and replace it with “int64_t”
    I recommend ctrl+f and search "long"
    NOTE do NOT change "long2" in line 133 and 135!!!

*credit to VictoryCoorg for the "long" fix https://forums.developer.nvidia.com/t/strange-link-error-seen-by-multiple-people-while-building-pytorch-cpp-cuda-extensions/145261/2

If my instructions are hard to follow, I will make a video showing the steps and update back.

@tillen1001
Copy link
Author

tillen1001 commented Jan 10, 2024

@TheChildishMillennial Thank you for your reply. I also successfully ran SHAPY, but I finally build the Package on Ubuntu22.04, Python3.10.12, CUDA11.8.
I also tried it on Windows at first, but I encountered the problem you answered above and didn’t know how to solve it, so I converted to Linux. Thank you very much for answering the question! This will definitely help many people.

@CumaOzavci
Copy link

@tillen1001 can you share your library versions for your setup. I could not install due to library conflicts in same setup.

@tillen1001
Copy link
Author

tillen1001 commented Jan 23, 2024

@tillen1001 can you share your library versions for your setup. I could not install due to library conflicts in same setup.

Package Version

absl-py 2.0.0
addict 2.4.0
aiohttp 3.9.1
aiosignal 1.3.1
ansi2html 1.9.1
asttokens 2.4.1
async-timeout 4.0.3
attrs 23.2.0
blinker 1.7.0
cachetools 5.3.2
certifi 2023.11.17
cffi 1.16.0
charset-normalizer 3.3.2
chumpy 0.70
click 8.1.7
comm 0.2.1
ConfigArgParse 1.7
contourpy 1.2.0
cycler 0.12.1
dash 2.14.2
dash-core-components 2.0.0
dash-html-components 2.0.0
dash-table 5.0.0
decorator 5.1.1
exceptiongroup 1.2.0
executing 2.0.1
fastjsonschema 2.19.1
filelock 3.13.1
Flask 3.0.0
fonttools 4.47.0
freetype-py 2.4.0
frozenlist 1.4.1
fsspec 2023.12.2
fvcore 0.1.5.post20221221
google-auth 2.26.1
google-auth-oauthlib 1.2.0
grpcio 1.60.0
idna 3.6
imageio 2.33.1
importlib-metadata 7.0.1
iopath 0.1.10
ipython 8.20.0
ipywidgets 8.1.1
itsdangerous 2.1.2
jedi 0.19.1
Jinja2 3.1.2
joblib 1.3.2
jpeg4py 0.1.4
jsonschema 4.20.0
jsonschema-specifications 2023.12.1
jupyter_core 5.7.1
jupyterlab-widgets 3.0.9
kiwisolver 1.4.5
kornia 0.7.1
lazy_loader 0.3
lightning-utilities 0.10.0
loguru 0.7.2
Markdown 3.5.1
MarkupSafe 2.1.3
matplotlib 3.8.2
matplotlib-inline 0.1.6
mesh-mesh-intersection 0.2.0
mpmath 1.3.0
multidict 6.0.4
nbformat 5.9.2
nest-asyncio 1.5.8
networkx 3.2.1
nflows 0.14
numpy 1.21.5
nvidia-cublas-cu12 12.1.3.1
nvidia-cuda-cupti-cu12 12.1.105
nvidia-cuda-nvrtc-cu12 12.1.105
nvidia-cuda-runtime-cu12 12.1.105
nvidia-cudnn-cu12 8.9.2.26
nvidia-cufft-cu12 11.0.2.54
nvidia-curand-cu12 10.3.2.106
nvidia-cusolver-cu12 11.4.5.107
nvidia-cusparse-cu12 12.1.0.106
nvidia-nccl-cu12 2.18.1
nvidia-nvjitlink-cu12 12.3.101
nvidia-nvtx-cu12 12.1.105
oauthlib 3.2.2
omegaconf 2.0.6
open3d 0.18.0
opencv-python 4.9.0.80
packaging 23.2
pandas 2.0.3
parso 0.8.3
pexpect 4.9.0
pillow 10.2.0
pip 22.0.2
platformdirs 4.1.0
plotly 5.18.0
portalocker 2.8.2
prompt-toolkit 3.0.43
protobuf 4.23.4
ptyprocess 0.7.0
pure-eval 0.2.2
pyasn1 0.5.1
pyasn1-modules 0.3.0
pycparser 2.21
pyglet 2.0.10
Pygments 2.17.2
PyOpenGL 3.1.0
pyparsing 3.1.1
pyquaternion 0.9.9
pyrender 0.1.45
python-dateutil 2.8.2
pytorch-lightning 2.1.3
pytz 2023.3.post1
PyWavelets 1.4.1
PyYAML 6.0.1
referencing 0.32.1
requests 2.31.0
requests-oauthlib 1.3.1
retrying 1.3.4
rpds-py 0.16.2
rsa 4.9
scikit-image 0.21.0
scikit-learn 1.3.2
scipy 1.10.1
setuptools 59.6.0
shape-attributes 0.2.0
six 1.16.0
smplx 0.1.28
stack-data 0.6.3
sympy 1.12
tabulate 0.9.0
tenacity 8.2.3
tensorboard 2.15.1
tensorboard-data-server 0.7.2
termcolor 2.4.0
threadpoolctl 3.2.0
tifffile 2023.12.9
torch 2.1.0+cu118
torchaudio 2.1.0+cu118
torchmetrics 1.2.1
torchvision 0.16.0+cu118
tqdm 4.66.1
traitlets 5.14.1
trimesh 4.0.8
triton 2.1.0
typing_extensions 4.9.0
tzdata 2023.4
urllib3 2.1.0
wcwidth 0.2.13
Werkzeug 3.0.1
widgetsnbextension 4.0.9
yacs 0.1.8
yarl 1.9.4
zipp 3.17.0

@tillen1001
Copy link
Author

@CumaOzavci The packages I installed are almost the latest releases, except for numpy and omegaconf.
This is my requirements.txt:

chumpy
imageio
jpeg4py
joblib
kornia
loguru
matplotlib
numpy==1.21.5
omegaconf==2.0.6
open3d
Pillow
PyOpenGL
pyrender
scikit-image
scikit-learn
scipy
smplx
tqdm
trimesh
yacs
fvcore
nflows
PyYAML

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

3 participants