Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Setup compatibility with Python 3.12+ due to deprecated ConfigParser API #900

Open
Kozmosa opened this issue Feb 25, 2025 · 0 comments
Open
Labels

Comments

@Kozmosa
Copy link

Kozmosa commented Feb 25, 2025

Describe the bug
Environment: Python 3.12.2 with miniconda, pip 25.0.1

When typing pip install pyradiomics in terminal, it turned to be like that:

(base) kozumi@YangPC:/mnt/e/Projects/dev/codespace/pyradiomics-fix-configparser$ python -V
Python 3.12.2
(base) kozumi@YangPC:/mnt/e/Projects/dev/codespace/pyradiomics-fix-configparser$ pip -V
pip 25.0.1 from /home/kozumi/miniconda3/lib/python3.12/site-packages/pip (python 3.12)
(base) kozumi@YangPC:/mnt/e/Projects/dev/codespace/pyradiomics-fix-configparser$ pip install pyradiomics
DEPRECATION: Loading egg at /home/kozumi/miniconda3/lib/python3.12/site-packages/pykwalify-1.8.0-py3.12.egg is deprecated. pip 25.1 will enforce this behaviour change. A possible replacement is to use pip for package installation. Discussion can be found at https://github.com/pypa/pip/issues/12330
Looking in indexes: https://mirrors.ustc.edu.cn/pypi/simple
Collecting pyradiomics
  Using cached https://mirrors.ustc.edu.cn/pypi/packages/03/c1/20fc2c50ab1e3304da36d866042a1905a2b05a1431ece35448ab6b4578f2/pyradiomics-3.1.0.tar.gz (34.5 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Discarding https://mirrors.ustc.edu.cn/pypi/packages/03/c1/20fc2c50ab1e3304da36d866042a1905a2b05a1431ece35448ab6b4578f2/pyradiomics-3.1.0.tar.gz (from https://mirrors.ustc.edu.cn/pypi/simple/pyradiomics/): Requested pyradiomics from https://mirrors.ustc.edu.cn/pypi/packages/03/c1/20fc2c50ab1e3304da36d866042a1905a2b05a1431ece35448ab6b4578f2/pyradiomics-3.1.0.tar.gz has inconsistent version: expected '3.1.0', but metadata has '3.0.1a1'
  Using cached https://mirrors.ustc.edu.cn/pypi/packages/1b/35/c7f7fb7affd302fd8107dcee6b6e7aaf3708b75ad69d5f9a3dfcadb73eaa/pyradiomics-3.0.1.tar.gz (34.5 MB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [30 lines of output]
      /tmp/pip-install-0ok43xo6/pyradiomics_6aace162de3b4468b8a2375bfb89205e/setup.py:9: SetuptoolsDeprecationWarning: The test command is disabled and references to it are deprecated.
      !!

              ********************************************************************************
              Please remove any references to `setuptools.command.test` in all supported versions of the affected package.

              This deprecation is overdue, please update your project and remove deprecated
              calls to avoid build errors in the future.
              ********************************************************************************

      !!
        from setuptools.command.test import test as TestCommand
      /tmp/pip-install-0ok43xo6/pyradiomics_6aace162de3b4468b8a2375bfb89205e/versioneer.py:418: SyntaxWarning: invalid escape sequence '\s'
        LONG_VERSION_PY['git'] = '''
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/tmp/pip-install-0ok43xo6/pyradiomics_6aace162de3b4468b8a2375bfb89205e/setup.py", line 79, in <module>
          version=versioneer.get_version(),
                  ^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-install-0ok43xo6/pyradiomics_6aace162de3b4468b8a2375bfb89205e/versioneer.py", line 1476, in get_version
          return get_versions()["version"]
                 ^^^^^^^^^^^^^^
        File "/tmp/pip-install-0ok43xo6/pyradiomics_6aace162de3b4468b8a2375bfb89205e/versioneer.py", line 1408, in get_versions
          cfg = get_config_from_root(root)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-install-0ok43xo6/pyradiomics_6aace162de3b4468b8a2375bfb89205e/versioneer.py", line 342, in get_config_from_root
          parser = configparser.SafeConfigParser()
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      AttributeError: module 'configparser' has no attribute 'SafeConfigParser'. Did you mean: 'RawConfigParser'?
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

According to the information provided by pip, it could be the configparser.SafeConfigParser() has been completely deprecated in Python 3.12+. Meanwhile, I found that version of versioneer.py is 0.17( latest version is 0.09). So, I tried simply updated the versioneer to latest version and it seemed that everything worked well.

PyRadiomics configuration
nothing

PyRadiomics log file
nothing

To Reproduce
Just run pip install pyradiomics in Python 3.12+ env.

Expected behavior
The pip worked well and the package is installed as normal.

Version (please complete the following information):

  • OS: Ubuntu 24.04
  • Python version: 3.12.2
  • PyRadiomics version: 3.1.0

Additional context
nothing

@Kozmosa Kozmosa added the bug label Feb 25, 2025
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant