PyRaysum icon indicating copy to clipboard operation
PyRaysum copied to clipboard

distutils DeprecationWarning

Open wasjabloch opened this issue 3 years ago • 3 comments

When building pyraysum in python 3.11, a DeprecationWarning is issued:

setup.py:4: DeprecationWarning: 

  `numpy.distutils` is deprecated since NumPy 1.23.0, as a result
  of the deprecation of `distutils` itself. It will be removed for
  Python >= 3.12. For older Python versions it will remain present.
  It is recommended to use `setuptools < 60.0` for those Python versions.
  For more details, see:
    https://numpy.org/devdocs/reference/distutils_status_migration.html 

setup.py should be migrated following the instructions here: https://numpy.org/devdocs/reference/distutils_status_migration.html

The site mentions:

It is not necessary to migrate immediately - the release date for Python 3.12 is October 2023.

wasjabloch avatar Jan 04 '23 19:01 wasjabloch

We should move to scikit-buil-core:

https://scikit-build-core.readthedocs.io/en/stable

wasjabloch avatar Dec 02 '24 15:12 wasjabloch

This has just bitten me: Following the installation instructions I got

(prs) ~/apps/pyraysum 43> pip install pyraysum
Collecting pyraysum
  Using cached pyraysum-1.0.0.tar.gz (1.4 MB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [23 lines of output]
      /tmp/pip-install-l7wo99jd/pyraysum_74ab29a50ca2476fa236ecca8b8ed908/setup.py:4: DeprecationWarning:
      
        `numpy.distutils` is deprecated since NumPy 1.23.0, as a result
        of the deprecation of `distutils` itself. It will be removed for
        Python >= 3.12. For older Python versions it will remain present.
        It is recommended to use `setuptools < 60.0` for those Python versions.
        For more details, see:
          https://numpy.org/devdocs/reference/distutils_status_migration.html
      
      
        from numpy.distutils.core import setup, Extension
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/tmp/pip-install-l7wo99jd/pyraysum_74ab29a50ca2476fa236ecca8b8ed908/setup.py", line 4, in <module>
          from numpy.distutils.core import setup, Extension
        File "/home/tilmann/miniconda3/envs/prs/lib/python3.8/site-packages/numpy/distutils/core.py", line 24, in <module>
          from numpy.distutils.command import config, config_compiler, \
        File "/home/tilmann/miniconda3/envs/prs/lib/python3.8/site-packages/numpy/distutils/command/config.py", line 19, in <module>
          from numpy.distutils.mingw32ccompiler import generate_manifest
        File "/home/tilmann/miniconda3/envs/prs/lib/python3.8/site-packages/numpy/distutils/mingw32ccompiler.py", line 28, in <module>
          from distutils.msvccompiler import get_build_version as get_build_msvc_version
      ModuleNotFoundError: No module named 'distutils.msvccompiler'
      [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.

I could get it to work by first installing older version of setuptools:

conda install 'setuptools=60'
pip install pyraysum

though this looks more like a work-around then a fix.

ftilmann avatar Feb 04 '25 17:02 ftilmann

@ftilmann , thanks for insisting. setuptools<=60 was flagged as having security issues.

Now is better than never.

I changed the build system to scikit-build-core.

Could you please try to install from the dev branch an let me know of any success or failure?

In your PyRaysum directory, this should do:

conda create -n prs python
git pull
git checkout dev
pip install .

wasjabloch avatar Feb 05 '25 10:02 wasjabloch