pyradiomics icon indicating copy to clipboard operation
pyradiomics copied to clipboard

[BUG] missing `itk` dependency in requirements.txt

Open kudhru opened this issue 1 year ago • 3 comments

Describe the bug I tried building the pyradiomics from source. python setup.py install command was failing due to the below reason:

radiomics/src/_cmatrices.c:6:10: fatal error: 'cmatrices.h' file not found
#include "cmatrices.h"
         ^~~~~~~~~~~~~
1 error generated.
error: Setup script exited with error: command '/usr/bin/clang' failed with exit code 1

I then used ChatGPT and Google Bard. Google Bard suggested that this error is due to missing itk dependency. I then installed using itk using pip install itk and then the python setup.py install command ran successfully.

PyRadiomics configuration NA

PyRadiomics log file NA

To Reproduce Steps to reproduce the behavior: gh repo clone AIM-Harvard/pyradiomics cd pyradiomics pip install -r requirements.txt python setup.py install

Expected behavior Expected it to install but it failed due to the above mentioned reason.

Version (please complete the following information):

  • OS: macOS 12.6.4 (Apple M1)
  • Python version: 3.9
  • PyRadiomics version 3.1.0

Additional context NA

kudhru avatar May 24 '23 04:05 kudhru

I am having the same issue here on an M2 Macbook – anyone who found a solution?

FroeMic avatar Jun 02 '24 17:06 FroeMic

I am having the same issue when trying to poetry (or uv) add pyradiomics to my project:

% cd myrepo                                                                                                                                                   ~ voyager2
% uv init                                                                                                                                              ~/myrepo voyager2
Initialized project `myrepo`
% uv add pyradiomics==3.1.0                                                                                                                            ~/myrepo voyager2
Using Python 3.12.3 interpreter at: /usr/bin/python3
Creating virtualenv at: .venv
Resolved 11 packages in 1.08s
  Built myrepo @ file:///home/stathis/myrepo
  Built docopt==0.6.2
error: Failed to prepare distributions
 Caused by: Failed to fetch wheel: pyradiomics==3.1.0
 Caused by: Build backend failed to build wheel through `build_wheel()` with exit status: 1
--- stdout:
Failed to load config from /home/stathis/.cache/uv/built-wheels-v3/index/b2a7eb67d4c26b82/pyradiomics/3.1.0/Nd2iatVSJoepR52QoWrn7/pyradiomics-3.1.0.tar.gz/pyproject.toml: 'tool'
Try to load it from setup.cfg
running bdist_wheel
running build
running build_py
Failed to load config from /home/stathis/.cache/uv/built-wheels-v3/index/b2a7eb67d4c26b82/pyradiomics/3.1.0/Nd2iatVSJoepR52QoWrn7/pyradiomics-3.1.0.tar.gz/pyproject.toml: 'tool'
Try to load it from setup.cfg
Failed to load config from /home/stathis/.cache/uv/built-wheels-v3/index/b2a7eb67d4c26b82/pyradiomics/3.1.0/Nd2iatVSJoepR52QoWrn7/pyradiomics-3.1.0.tar.gz/pyproject.toml: 'tool'
Try to load it from setup.cfg
creating build
creating build/lib.linux-x86_64-cpython-312
creating build/lib.linux-x86_64-cpython-312/radiomics
copying radiomics/imageoperations.py -> build/lib.linux-x86_64-cpython-312/radiomics
copying radiomics/featureextractor.py -> build/lib.linux-x86_64-cpython-312/radiomics
copying radiomics/_version.py -> build/lib.linux-x86_64-cpython-312/radiomics
copying radiomics/glcm.py -> build/lib.linux-x86_64-cpython-312/radiomics
copying radiomics/firstorder.py -> build/lib.linux-x86_64-cpython-312/radiomics
copying radiomics/glrlm.py -> build/lib.linux-x86_64-cpython-312/radiomics
copying radiomics/base.py -> build/lib.linux-x86_64-cpython-312/radiomics
copying radiomics/shape.py -> build/lib.linux-x86_64-cpython-312/radiomics
copying radiomics/glszm.py -> build/lib.linux-x86_64-cpython-312/radiomics
copying radiomics/__init__.py -> build/lib.linux-x86_64-cpython-312/radiomics
copying radiomics/ngtdm.py -> build/lib.linux-x86_64-cpython-312/radiomics
copying radiomics/shape2D.py -> build/lib.linux-x86_64-cpython-312/radiomics
copying radiomics/generalinfo.py -> build/lib.linux-x86_64-cpython-312/radiomics
copying radiomics/gldm.py -> build/lib.linux-x86_64-cpython-312/radiomics
creating build/lib.linux-x86_64-cpython-312/radiomics/scripts
copying radiomics/scripts/segment.py -> build/lib.linux-x86_64-cpython-312/radiomics/scripts
copying radiomics/scripts/voxel.py -> build/lib.linux-x86_64-cpython-312/radiomics/scripts
copying radiomics/scripts/__init__.py -> build/lib.linux-x86_64-cpython-312/radiomics/scripts
creating build/lib.linux-x86_64-cpython-312/radiomics/schemas
copying radiomics/schemas/paramSchema.yaml -> build/lib.linux-x86_64-cpython-312/radiomics/schemas
copying radiomics/schemas/schemaFuncs.py -> build/lib.linux-x86_64-cpython-312/radiomics/schemas
UPDATING build/lib.linux-x86_64-cpython-312/radiomics/_version.py
set build/lib.linux-x86_64-cpython-312/radiomics/_version.py to 'v3.1.0'
running build_ext
Failed to load config from /home/stathis/.cache/uv/built-wheels-v3/index/b2a7eb67d4c26b82/pyradiomics/3.1.0/Nd2iatVSJoepR52QoWrn7/pyradiomics-3.1.0.tar.gz/pyproject.toml: 'tool'
Try to load it from setup.cfg
Failed to load config from /home/stathis/.cache/uv/built-wheels-v3/index/b2a7eb67d4c26b82/pyradiomics/3.1.0/Nd2iatVSJoepR52QoWrn7/pyradiomics-3.1.0.tar.gz/pyproject.toml: 'tool'
Try to load it from setup.cfg
building 'radiomics._cmatrices' extension
creating build/temp.linux-x86_64-cpython-312
creating build/temp.linux-x86_64-cpython-312/radiomics
creating build/temp.linux-x86_64-cpython-312/radiomics/src
x86_64-linux-gnu-gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O2 -Wall -fPIC -I/usr/include/python3.12 -I/home/stathis/.cache/uv/builds-v0/.tmp98ljr4/lib/python3.12/site-packages/numpy/_core/include -I/home/stathis/.cache/uv/builds-v0/.tmp98ljr4/include -I/usr/include/python3.12 -c radiomics/src/_cmatrices.c -o build/temp.linux-x86_64-cpython-312/radiomics/src/_cmatrices.o
--- stderr:
/home/stathis/.cache/uv/builds-v0/.tmp98ljr4/lib/python3.12/site-packages/setuptools/dist.py:292: InformationOnly: Normalizing 'v3.1.0' to '3.1.0'
 self.metadata.version = self._normalize_version(self.metadata.version)
/home/stathis/.cache/uv/builds-v0/.tmp98ljr4/lib/python3.12/site-packages/setuptools/config/_apply_pyprojecttoml.py:76: SetuptoolsWarning: `install_requires` overwritten in `pyproject.toml` (dependencies)
 corresp(dist, value, root_dir)
radiomics/src/_cmatrices.c:6:10: fatal error: cmatrices.h: No such file or directory
   6 | #include "cmatrices.h"
     |          ^~~~~~~~~~~~~
compilation terminated.
error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1
---
 Caused by: This error likely indicates that you need to install a library that provides "cmatrices.h" for pyradiomics==3.1.0
% uname -a                                                                                                                                             ~/myrepo voyager2
Linux voyager2 6.8.0-41-generic #41-Ubuntu SMP PREEMPT_DYNAMIC Fri Aug  2 20:41:06 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux

ekamperi avatar Aug 24 '24 22:08 ekamperi

@ekamperi try installing itk dependency before running the python setup.py install for pyradiomics. Steps to follow

  1. pip install itk
  2. python setup.py install

This fixed the bug for me. Hopefully, it should do the same for you as well!

kudhru avatar Aug 25 '24 03:08 kudhru