teddykoker / torchsort

Fast, differentiable sorting and ranking in PyTorch
https://pypi.org/project/torchsort/
Apache License 2.0
765 stars 33 forks source link

Build Errors When Upgrading to 1.7 #32

Closed ashkan-leo closed 2 years ago

ashkan-leo commented 3 years ago

I tried to upgrade to 1.7 from 1.6. I get the following build errors in Ubuntu:

  • Updating torchsort (0.1.6 -> 0.1.7): Failed

  EnvCommandError

  Command ['/home/jkk/w/N9MER/.venv/bin/pip', 'install', '--no-deps', '-U', 'file:///home/jkk/.cache/pypoetry/artifacts/dd/3b/ee/bd011dc524042d73babfc5cb3551973002870652949f15af2cd67740a4/torchsort-0.1.7.tar.gz'] errored with the following return code 1, and output:
  Processing /home/jkk/.cache/pypoetry/artifacts/dd/3b/ee/bd011dc524042d73babfc5cb3551973002870652949f15af2cd67740a4/torchsort-0.1.7.tar.gz
  Building wheels for collected packages: torchsort
    Building wheel for torchsort (setup.py): started
    Building wheel for torchsort (setup.py): finished with status 'error'
    ERROR: Command errored out with exit status 1:
     command: /home/jkk/w/N9MER/.venv/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-req-build-n22hcjuz/setup.py'"'"'; __file__='"'"'/tmp/pip-req-build-n22hcjuz/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-k64ka9oe
         cwd: /tmp/pip-req-build-n22hcjuz/
    Complete output (37 lines):
    running bdist_wheel
    /home/jkk/w/N9MER/.venv/lib/python3.9/site-packages/torch/utils/cpp_extension.py:370: 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-3.9
    creating build/lib.linux-x86_64-3.9/torchsort
    copying torchsort/__init__.py -> build/lib.linux-x86_64-3.9/torchsort
    copying torchsort/ops.py -> build/lib.linux-x86_64-3.9/torchsort
    running egg_info
    writing torchsort.egg-info/PKG-INFO
    writing dependency_links to torchsort.egg-info/dependency_links.txt
    writing requirements to torchsort.egg-info/requires.txt
    writing top-level names to torchsort.egg-info/top_level.txt
    reading manifest file 'torchsort.egg-info/SOURCES.txt'
    reading manifest template 'MANIFEST.in'
    writing manifest file 'torchsort.egg-info/SOURCES.txt'
    copying torchsort/isotonic_cpu.cpp -> build/lib.linux-x86_64-3.9/torchsort
    copying torchsort/isotonic_cuda.cu -> build/lib.linux-x86_64-3.9/torchsort
    running build_ext
    building 'torchsort.isotonic_cpu' extension
    creating build/temp.linux-x86_64-3.9
    creating build/temp.linux-x86_64-3.9/torchsort
    gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/home/jkk/w/N9MER/.venv/lib/python3.9/site-packages/torch/include -I/home/jkk/w/N9MER/.venv/lib/python3.9/site-packages/torch/include/torch/csrc/api/include -I/home/jkk/w/N9MER/.venv/lib/python3.9/site-packages/torch/include/TH -I/home/jkk/w/N9MER/.venv/lib/python3.9/site-packages/torch/include/THC -I/home/jkk/w/N9MER/.venv/include -I/home/jkk/.pyenv/versions/3.9.4/include/python3.9 -c torchsort/isotonic_cpu.cpp -o build/temp.linux-x86_64-3.9/torchsort/isotonic_cpu.o -fopenmp -ffast-math -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE="_gcc" -DPYBIND11_STDLIB="_libstdcpp" -DPYBIND11_BUILD_ABI="_cxxabi1011" -DTORCH_EXTENSION_NAME=isotonic_cpu -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++14
    g++ -pthread -shared -L/home/jkk/.pyenv/versions/3.9.4/lib -L/home/jkk/.pyenv/versions/3.9.4/lib build/temp.linux-x86_64-3.9/torchsort/isotonic_cpu.o -L/home/jkk/w/N9MER/.venv/lib/python3.9/site-packages/torch/lib -lc10 -ltorch -ltorch_cpu -ltorch_python -o build/lib.linux-x86_64-3.9/torchsort/isotonic_cpu.cpython-39-x86_64-linux-gnu.so
    building 'torchsort.isotonic_cuda' extension
    /usr/bin/nvcc -I/home/jkk/w/N9MER/.venv/lib/python3.9/site-packages/torch/include -I/home/jkk/w/N9MER/.venv/lib/python3.9/site-packages/torch/include/torch/csrc/api/include -I/home/jkk/w/N9MER/.venv/lib/python3.9/site-packages/torch/include/TH -I/home/jkk/w/N9MER/.venv/lib/python3.9/site-packages/torch/include/THC -I/home/jkk/w/N9MER/.venv/include -I/home/jkk/.pyenv/versions/3.9.4/include/python3.9 -c torchsort/isotonic_cuda.cu -o build/temp.linux-x86_64-3.9/torchsort/isotonic_cuda.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' -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE="_gcc" -DPYBIND11_STDLIB="_libstdcpp" -DPYBIND11_BUILD_ABI="_cxxabi1011" -DTORCH_EXTENSION_NAME=isotonic_cuda -D_GLIBCXX_USE_CXX11_ABI=0 -gencode=arch=compute_61,code=compute_61 -gencode=arch=compute_61,code=sm_61 -std=c++14
    /usr/include/c++/10/chrono: In substitution of ‘template<class _Rep, class _Period> template<class _Period2> using __is_harmonic = std::__bool_constant<(std::ratio<((_Period2::num / std::chrono::duration<_Rep, _Period>::_S_gcd(_Period2::num, _Period::num)) * (_Period::den / std::chrono::duration<_Rep, _Period>::_S_gcd(_Period2::den, _Period::den))), ((_Period2::den / std::chrono::duration<_Rep, _Period>::_S_gcd(_Period2::den, _Period::den)) * (_Period::num / std::chrono::duration<_Rep, _Period>::_S_gcd(_Period2::num, _Period::num)))>::den == 1)> [with _Period2 = _Period2; _Rep = _Rep; _Period = _Period]’:
    /usr/include/c++/10/chrono:473:154:   required from here
    /usr/include/c++/10/chrono:428:27: internal compiler error: Segmentation fault
      428 |  _S_gcd(intmax_t __m, intmax_t __n) noexcept
          |                           ^~~~~~
    Please submit a full bug report,
    with preprocessed source if appropriate.
    See <file:///usr/share/doc/gcc-10/README.Bugs> for instructions.
    error: command '/usr/bin/nvcc' failed with exit code 1
    ----------------------------------------
    ERROR: Failed building wheel for torchsort
    Running setup.py clean for torchsort
  Failed to build torchsort
  Installing collected packages: torchsort
    Attempting uninstall: torchsort
      Found existing installation: torchsort 0.1.6
      Uninstalling torchsort-0.1.6:
        Successfully uninstalled torchsort-0.1.6
      Running setup.py install for torchsort: started
      Running setup.py install for torchsort: finished with status 'error'
      ERROR: Command errored out with exit status 1:
       command: /home/jkk/w/N9MER/.venv/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-req-build-n22hcjuz/setup.py'"'"'; __file__='"'"'/tmp/pip-req-build-n22hcjuz/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-87f187fd/install-record.txt --single-version-externally-managed --compile --install-headers /home/jkk/w/N9MER/.venv/include/site/python3.9/torchsort
           cwd: /tmp/pip-req-build-n22hcjuz/
      Complete output (37 lines):
      running install
      running build
      running build_py
      creating build
      creating build/lib.linux-x86_64-3.9
      creating build/lib.linux-x86_64-3.9/torchsort
      copying torchsort/__init__.py -> build/lib.linux-x86_64-3.9/torchsort
      copying torchsort/ops.py -> build/lib.linux-x86_64-3.9/torchsort
      running egg_info
      writing torchsort.egg-info/PKG-INFO
      writing dependency_links to torchsort.egg-info/dependency_links.txt
      writing requirements to torchsort.egg-info/requires.txt
      writing top-level names to torchsort.egg-info/top_level.txt
      /home/jkk/w/N9MER/.venv/lib/python3.9/site-packages/torch/utils/cpp_extension.py:370: 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 'torchsort.egg-info/SOURCES.txt'
      reading manifest template 'MANIFEST.in'
      writing manifest file 'torchsort.egg-info/SOURCES.txt'
      copying torchsort/isotonic_cpu.cpp -> build/lib.linux-x86_64-3.9/torchsort
      copying torchsort/isotonic_cuda.cu -> build/lib.linux-x86_64-3.9/torchsort
      running build_ext
      building 'torchsort.isotonic_cpu' extension
      creating build/temp.linux-x86_64-3.9
      creating build/temp.linux-x86_64-3.9/torchsort
      gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/home/jkk/w/N9MER/.venv/lib/python3.9/site-packages/torch/include -I/home/jkk/w/N9MER/.venv/lib/python3.9/site-packages/torch/include/torch/csrc/api/include -I/home/jkk/w/N9MER/.venv/lib/python3.9/site-packages/torch/include/TH -I/home/jkk/w/N9MER/.venv/lib/python3.9/site-packages/torch/include/THC -I/home/jkk/w/N9MER/.venv/include -I/home/jkk/.pyenv/versions/3.9.4/include/python3.9 -c torchsort/isotonic_cpu.cpp -o build/temp.linux-x86_64-3.9/torchsort/isotonic_cpu.o -fopenmp -ffast-math -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE="_gcc" -DPYBIND11_STDLIB="_libstdcpp" -DPYBIND11_BUILD_ABI="_cxxabi1011" -DTORCH_EXTENSION_NAME=isotonic_cpu -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++14
      g++ -pthread -shared -L/home/jkk/.pyenv/versions/3.9.4/lib -L/home/jkk/.pyenv/versions/3.9.4/lib build/temp.linux-x86_64-3.9/torchsort/isotonic_cpu.o -L/home/jkk/w/N9MER/.venv/lib/python3.9/site-packages/torch/lib -lc10 -ltorch -ltorch_cpu -ltorch_python -o build/lib.linux-x86_64-3.9/torchsort/isotonic_cpu.cpython-39-x86_64-linux-gnu.so
      building 'torchsort.isotonic_cuda' extension
      /usr/bin/nvcc -I/home/jkk/w/N9MER/.venv/lib/python3.9/site-packages/torch/include -I/home/jkk/w/N9MER/.venv/lib/python3.9/site-packages/torch/include/torch/csrc/api/include -I/home/jkk/w/N9MER/.venv/lib/python3.9/site-packages/torch/include/TH -I/home/jkk/w/N9MER/.venv/lib/python3.9/site-packages/torch/include/THC -I/home/jkk/w/N9MER/.venv/include -I/home/jkk/.pyenv/versions/3.9.4/include/python3.9 -c torchsort/isotonic_cuda.cu -o build/temp.linux-x86_64-3.9/torchsort/isotonic_cuda.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' -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE="_gcc" -DPYBIND11_STDLIB="_libstdcpp" -DPYBIND11_BUILD_ABI="_cxxabi1011" -DTORCH_EXTENSION_NAME=isotonic_cuda -D_GLIBCXX_USE_CXX11_ABI=0 -gencode=arch=compute_61,code=compute_61 -gencode=arch=compute_61,code=sm_61 -std=c++14
      /usr/include/c++/10/chrono: In substitution of ‘template<class _Rep, class _Period> template<class _Period2> using __is_harmonic = std::__bool_constant<(std::ratio<((_Period2::num / std::chrono::duration<_Rep, _Period>::_S_gcd(_Period2::num, _Period::num)) * (_Period::den / std::chrono::duration<_Rep, _Period>::_S_gcd(_Period2::den, _Period::den))), ((_Period2::den / std::chrono::duration<_Rep, _Period>::_S_gcd(_Period2::den, _Period::den)) * (_Period::num / std::chrono::duration<_Rep, _Period>::_S_gcd(_Period2::num, _Period::num)))>::den == 1)> [with _Period2 = _Period2; _Rep = _Rep; _Period = _Period]’:
      /usr/include/c++/10/chrono:473:154:   required from here
      /usr/include/c++/10/chrono:428:27: internal compiler error: Segmentation fault
        428 |  _S_gcd(intmax_t __m, intmax_t __n) noexcept
            |                           ^~~~~~
      Please submit a full bug report,
      with preprocessed source if appropriate.
      See <file:///usr/share/doc/gcc-10/README.Bugs> for instructions.
      error: command '/usr/bin/nvcc' failed with exit code 1
      ----------------------------------------
    Rolling back uninstall of torchsort
    Moving to /home/jkk/w/N9MER/.venv/lib/python3.9/site-packages/torchsort-0.1.6.dist-info/
     from /home/jkk/w/N9MER/.venv/lib/python3.9/site-packages/~orchsort-0.1.6.dist-info
    Moving to /home/jkk/w/N9MER/.venv/lib/python3.9/site-packages/torchsort/
     from /home/jkk/w/N9MER/.venv/lib/python3.9/site-packages/~-rchsort
  ERROR: Command errored out with exit status 1: /home/jkk/w/N9MER/.venv/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-req-build-n22hcjuz/setup.py'"'"'; __file__='"'"'/tmp/pip-req-build-n22hcjuz/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-87f187fd/install-record.txt --single-version-externally-managed --compile --install-headers /home/jkk/w/N9MER/.venv/include/site/python3.9/torchsort Check the logs for full command output.

I have the following nvcc --version:

nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2021 NVIDIA Corporation
Built on Sun_Feb_14_21:12:58_PST_2021
Cuda compilation tools, release 11.2, V11.2.152
Build cuda_11.2.r11.2/compiler.29618528_0

Any help is appreciated!

teddykoker commented 3 years ago

Are you able to install 1.6 alright? What happens if you remove both and try to install 1.7?

teddykoker commented 2 years ago

Closing due to lack of activity and I am unable to reproduce