AIM-Harvard / pyradiomics

Open-source python package for the extraction of Radiomics features from 2D and 3D images and binary masks. Support: https://discourse.slicer.org/c/community/radiomics
http://pyradiomics.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
1.11k stars 485 forks source link

[BUG] #886

Open hmpaverd opened 1 week ago

hmpaverd commented 1 week ago

Describe the bug Installing from source fails because of what appears to be an issue with Versioneer (possible incompatibility with Python 3.12).

PyRadiomics log file After cloning the git repo and running python3 setup.py install, I get the following error:

/Users/user/Work/pyradiomics/versioneer.py:418: SyntaxWarning: invalid escape sequence '\s' LONG_VERSION_PY['git'] = ''' Traceback (most recent call last): File "/Users/user/Work/pyradiomics/setup.py", line 24, in version=versioneer.get_version(), ^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/user/Work/pyradiomics/versioneer.py", line 1476, in get_version return get_versions()["version"] ^^^^^^^^^^^^^^ File "/Users/user/Work/pyradiomics/versioneer.py", line 1408, in get_versions cfg = get_config_from_root(root) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/user/Work/pyradiomics/versioneer.py", line 342, in get_config_from_root parser = configparser.SafeConfigParser() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: module 'configparser' has no attribute 'SafeConfigParser'. Did you mean: 'RawConfigParser'?

Version (please complete the following information):

TK-A369 commented 5 days ago

I also had trouble with installing pyradiomics. I'm on Windows 10. I have Python 3.12.3 installed. Firstly I tried to install it via pip, and I got same error as you. Then I attempted to use older Python version (3.7.17, compiled from source on Windows) or Anaconda, but I still had some issues with (if I remember correctly) NumPy or Jupyter lab. Finally, same as you, I cloned pyradiomics repo and tried to install it from source. I got same error as you, and same as when using pip. I modified setup.py file by commenting out versioneer related stuff:

#!/usr/bin/env python

from distutils import sysconfig
import platform

import numpy
from setuptools import Extension, setup
# import versioneer

if platform.architecture()[0].startswith('32'):
  raise Exception('PyRadiomics requires 64 bits python')

# commands = versioneer.get_cmdclass()
incDirs = [sysconfig.get_python_inc(), numpy.get_include()]

ext = [Extension("radiomics._cmatrices", ["radiomics/src/_cmatrices.c", "radiomics/src/cmatrices.c"],
                 include_dirs=incDirs),
       Extension("radiomics._cshape", ["radiomics/src/_cshape.c", "radiomics/src/cshape.c"],
                 include_dirs=incDirs)]

setup(
  name='pyradiomics',

  # version=versioneer.get_version(),
  # cmdclass=commands,

  packages=['radiomics', 'radiomics.scripts'],
  ext_modules=ext,
  zip_safe=False
)

After this, I was able to succesfully install pyradiomics. And apparently it works. Yes, I know, this is ugly workaround.