CERN / TIGRE

TIGRE: Tomographic Iterative GPU-based Reconstruction Toolbox
BSD 3-Clause "New" or "Revised" License
529 stars 180 forks source link

ERROR: Could not build wheels for pytigre, which is required to install pyproject.toml-based projects #500

Closed 6ABCD0 closed 8 months ago

6ABCD0 commented 8 months ago

Expected Behavior

When I try to run:pip install .

it appears:

  error: subprocess-exited-with-error

  × Building wheel for pytigre (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [37 lines of output]
      which: no nvcc in (/tmp/pip-build-env-sf042_vp/overlay/bin:/tmp/pip-build-env-sf042_vp/normal/bin:/users/psi/wxie/anaconda3/envs/NeRP/bin:/users/psi/wxie/anaconda3/condabin:/users/psi/wxie/anaconda3/bin:/users/psi/wxie/.vscode-server/bin/b3e4e68a0bc097f0ae7907b217c1119af9e03435/bin/remote-cli:/users/psi/wxie/anaconda3/bin:/users/psi/wxie/anaconda3/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/freeware/bin/gnu-tools:/freeware/bin:/software/bin)
      running bdist_wheel
      running build
      running build_py
      file tigre/py.py (for module tigre.py) not found
      running egg_info
      writing pytigre.egg-info/PKG-INFO
      writing dependency_links to pytigre.egg-info/dependency_links.txt
      writing requirements to pytigre.egg-info/requires.txt
      writing top-level names to pytigre.egg-info/top_level.txt
      file tigre/py.py (for module tigre.py) not found
      reading manifest file 'pytigre.egg-info/SOURCES.txt'
      reading manifest template 'MANIFEST.in'
      warning: no files found matching '*.ipynb' under directory 'tigre/demos'
      warning: no files found matching '*.mat' under directory 'tigre/demos'
      adding license file 'LICENSE'
      writing manifest file 'pytigre.egg-info/SOURCES.txt'
      file tigre/py.py (for module tigre.py) not found
      running build_ext
      Compiling tigre/utilities/cuda_interface/_Ax.pyx because it depends on /tmp/pip-build-env-sf042_vp/overlay/lib/python3.7/site-packages/Cython/Includes/libc/string.pxd.
      [1/1] Cythonizing tigre/utilities/cuda_interface/_Ax.pyx
      building '_Ax' extension
      gcc -pthread -B /users/psi/wxie/anaconda3/envs/NeRP/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DIS_FOR_PYTIGRE -I/tmp/pip-build-env-sf042_vp/overlay/lib/python3.7/site-packages/numpy/core/include -I/usr/local/cuda/include -I../Common/CUDA/ -I/users/psi/wxie/anaconda3/envs/NeRP/include/python3.7m -c ../Common/CUDA/GpuIds.cpp -o build/temp.linux-x86_64-cpython-37/../Common/CUDA/GpuIds.o -std=c++11
      cc1plus: warning: command-line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
      ../Common/CUDA/GpuIds.cpp: In member function ‘void GpuIds::SetAllGpus(int)’:
      ../Common/CUDA/GpuIds.cpp:44:21: warning: ignoring return value of ‘void* malloc(size_t)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
         44 |         (int*)malloc(iTotalDeviceCount*sizeof(int));
            |               ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      /usr/local/cuda/bin/nvcc -DIS_FOR_PYTIGRE -I/tmp/pip-build-env-sf042_vp/overlay/lib/python3.7/site-packages/numpy/core/include -I/usr/local/cuda/include -I../Common/CUDA/ -I/users/psi/wxie/anaconda3/envs/NeRP/include/python3.7m -c ../Common/CUDA/Siddon_projection.cu -o build/temp.linux-x86_64-cpython-37/../Common/CUDA/Siddon_projection.o -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr --compiler-options '-fPIC' -gencode=arch=compute_90,code=sm_90 -gencode=arch=compute_87,code=sm_87 -gencode=arch=compute_86,code=sm_86 -gencode=arch=compute_80,code=sm_80 -gencode=arch=compute_75,code=sm_75 -gencode=arch=compute_70,code=sm_70 -gencode=arch=compute_61,code=sm_61 -gencode=arch=compute_60,code=sm_60 -gencode=arch=compute_52,code=sm_52 -gencode=arch=compute_70,code=compute_70 --ptxas-options=-v -c --default-stream=per-thread -std=c++11
      In file included from /usr/local/cuda/include/cuda_runtime.h:82,
                       from <command-line>:
      /usr/local/cuda/include/crt/host_config.h:143:2: error: #error -- unsupported GNU version! gcc versions later than 12 are not supported! The nvcc flag '-allow-unsupported-compiler' can be used to override this version check; however, using an unsupported host compiler may cause compilation failure or incorrect run time execution. Use at your own risk.
        143 | #error -- unsupported GNU version! gcc versions later than 12 are not supported! The nvcc flag '-allow-unsupported-compiler' can be used to override this version check; however, using an unsupported host compiler may cause compilation failure or incorrect run time execution. Use at your own risk.
            |  ^~~~~
      /tmp/pip-build-env-sf042_vp/overlay/lib/python3.7/site-packages/Cython/Compiler/Main.py:381: FutureWarning: Cython directive 'language_level' not set, using '3str' for now (Py3). This has changed from earlier releases! File: /esat/vauxite/wxie/naf_cbct/TIGRE/Python/tigre/utilities/cuda_interface/_Ax.pyx
        tree = Parsing.p_module(s, pxd, full_module_name)
      error: command '/usr/local/cuda/bin/nvcc' failed with exit code 1
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for pytigre
Failed to build pytigre
ERROR: Could not build wheels for pytigre, which is required to install pyproject.toml-based projects

Specifications

AnderBiguri commented 8 months ago

It appears that your installed CUDA version is incompatible with your installed GCC version, as the error message suggests:

error: #error -- unsupported GNU version! gcc versions later than 12 are not supported! The nvcc flag '-allow-unsupported-compiler' can be used to override this version check; however, using an unsupported host compiler may cause compilation failure or incorrect run time execution. Use at your own risk.

You need to find a gcc that is compatible with your CUDA version, otherwise you won't be able to compile anything CUDA. This is unfortunately not something we can control from TIGRE, NVIDIA keeps changing which GCCs they accept in every version, its hard to keep track.

6ABCD0 commented 8 months ago

Thanks so much for your help! I changed a machine and I fix it! The example.py and d01_CreateGeometry.py was run smoothly. But when I try to run d02_SampleData.py. I appears:

/users/psi/wxie/anaconda3/envs/NeRP/lib/python3.7/site-packages/matplotlib/animation.py:888: UserWarning: Animation was deleted without rendering anything. This is most likely not intended. To prevent deletion, assign the Animation to a variable, e.g. anim, that exists until you have outputted the Animation using plt.show() or anim.save(). 'Animation was deleted without rendering anything. This is ' Traceback (most recent call last): File "/users/psi/wxie/anaconda3/envs/NeRP/lib/python3.7/site-packages/scipy/io/matlab/mio.py", line 39, in _open_file return open(file_like, mode), True FileNotFoundError: [Errno 2] No such file or directory: '/users/psi/wxie/anaconda3/envs/NeRP/lib/python3.7/site-packages/tigre/utilities/./../../data/head.mat'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "d02_SampleData.py", line 64, in head = sample_loader.load_head_phantom(geo.nVoxel) File "/users/psi/wxie/anaconda3/envs/NeRP/lib/python3.7/site-packages/tigre/utilities/sample_loader.py", line 16, in load_head_phantom test_data = scipy.io.loadmat(dirname) File "/users/psi/wxie/anaconda3/envs/NeRP/lib/python3.7/site-packages/scipy/io/matlab/mio.py", line 224, in loadmat with _open_file_context(file_name, appendmat) as f: File "/users/psi/wxie/anaconda3/envs/NeRP/lib/python3.7/contextlib.py", line 112, in enter return next(self.gen) File "/users/psi/wxie/anaconda3/envs/NeRP/lib/python3.7/site-packages/scipy/io/matlab/mio.py", line 17, in _open_file_context f, opened = _open_file(file_like, appendmat, mode) File "/users/psi/wxie/anaconda3/envs/NeRP/lib/python3.7/site-packages/scipy/io/matlab/mio.py", line 45, in _open_file return open(file_like, mode), True FileNotFoundError: [Errno 2] No such file or directory: '/users/psi/wxie/anaconda3/envs/NeRP/lib/python3.7/site-packages/tigre/utilities/./../../data/head.mat'

I don't know how can I find the'/users/psi/wxie/anaconda3/envs/NeRP/lib/python3.7/site-packages/tigre/utilities/./../../data/head.mat'?

AnderBiguri commented 8 months ago

@Window-Duo This error is on us (#493), still trying to solve it, but it has an easy solution:

take the file https://github.com/CERN/TIGRE/tree/master/Common/data/head.mat and then copy it in /users/psi/wxie/anaconda3/envs/NeRP/lib/python3.7/site-packages/tigre/utilities/./../../data/head.mat

you can do it with the mv command in command line.

AnderBiguri commented 8 months ago

@Window-Duo I just updated the master branch to fix this, if you can pull again and try installing again, that would be great.

6ABCD0 commented 8 months ago

Hi AnderBiguri, thanks so much! It's fine now. But when I run d04_SimpleReconstruction.py, it shows:

(NeRP) [wxie@fasso demos]$ python d04_SimpleReconstruction.py OSSART algorithm in progress. Estimated time until completion : 00:00:48 /users/psi/wxie/anaconda3/envs/NeRP/lib/python3.7/site-packages/matplotlib/animation.py:888: UserWarning: Animation was deleted without rendering anything. This is most likely not intended. To prevent deletion, assign the Animation to a variable, e.g. anim, that exists until you have outputted the Animation using plt.show() or anim.save(). 'Animation was deleted without rendering anything. This is '

And When I run d03_generateData.py ,it shows:

(NeRP) [wxie@fasso demos]$ python d03_generateData.py /users/psi/wxie/anaconda3/envs/NeRP/lib/python3.7/site-packages/matplotlib/animation.py:888: UserWarning: Animation was deleted without rendering anything. This is most likely not intended. To prevent deletion, assign the Animation to a variable, e.g. anim, that exists until you have outputted the Animation using plt.show() or anim.save(). 'Animation was deleted without rendering anything. This is

I know it's just a Warning I can ignore. But I still want to double check if it's okay and if this warning will cause some bad things when I use it in the future?

AnderBiguri commented 8 months ago

@Window-Duo It seems that you are using an older version of python + matplotlib, so some displaying stuff may not work for you, but it should not stop the code from working.

6ABCD0 commented 8 months ago

I got it. Thanks so much! AnderBiguri.