Opened 17 months ago

Closed 17 months ago

Last modified 17 months ago

#66304 closed defect (fixed)

py-setuptools 65.6.0_0 breaks py-numpy builds

Reported by: michaelld (Michael Dickens) Owned by: michaelld (Michael Dickens)
Priority: Normal Milestone:
Component: ports Version:
Keywords: Cc:
Port: setuptools

Description

setuptools 65.6.0 changes the log API such that all NumPy builds from source fail (the code causing the error predates the earliest version of NumPy used in MacPorts right now [1.16]). While this -is- a NumPy problem from a certain perspective, we need to fixup -all- NumPy uses of log to work again; luckily all of the NumPy code looks the be virtually identical. I hope this (ab)use of the log API is limited to NumPy!

:debug:build system:  cd "/opt/local/var/macports/build/_opt_sources_MacPorts_ports_github_macports_python_py-numpy/py310-numpy/work/numpy-1.23.4" && /opt/local/Library/Frameworks/Python.framework/Versions/3.10/bin/python3.10 setup.py --no-user-cfg build -j8 
:info:build Running from numpy source directory.
:info:build Traceback (most recent call last):
:info:build   File "/opt/local/var/macports/build/_opt_sources_MacPorts_ports_github_macports_python_py-numpy/py310-numpy/work/numpy-1.23.4/setup.py", line 86, in <module>
:info:build     import numpy.distutils.command.sdist
:info:build   File "/opt/local/var/macports/build/_opt_sources_MacPorts_ports_github_macports_python_py-numpy/py310-numpy/work/numpy-1.23.4/numpy/distutils/__init__.py", line 26, in <module>
:info:build     from . import ccompiler
:info:build   File "/opt/local/var/macports/build/_opt_sources_MacPorts_ports_github_macports_python_py-numpy/py310-numpy/work/numpy-1.23.4/numpy/distutils/ccompiler.py", line 20, in <module>
:info:build     from numpy.distutils import log
:info:build   File "/opt/local/var/macports/build/_opt_sources_MacPorts_ports_github_macports_python_py-numpy/py310-numpy/work/numpy-1.23.4/numpy/distutils/log.py", line 4, in <module>
:info:build     from distutils.log import Log as old_Log
:info:build ImportError: cannot import name 'Log' from 'distutils.log' (/opt/local/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/_distutils/log.py)
:info:build Command failed:  cd "/opt/local/var/macports/build/_opt_sources_MacPorts_ports_github_macports_python_py-numpy/py310-numpy/work/numpy-1.23.4" && /opt/local/Library/Frameworks/Python.framework/Versions/3.10/bin/python3.10 setup.py --no-user-cfg build -j8 

Here's the NumPy code that fails: https://github.com/numpy/numpy/blob/maintenance/1.23.x/numpy/distutils/log.py#L4

Here's the setuptools change that causes the issue: https://github.com/pypa/setuptools/commit/9b8a6ef60b2b490bcf60b9dd7f0d43d46f49e489#diff-f4970eee1e6aebcf5dd5528890fbf7ddce06a8929dd9649b16b94f04277eb85b

Here's an older version of the setuptools code that works: https://github.com/pypa/setuptools/blob/bb9fb1fcfe37c1ef1e29e1e6d1fc4e483c743380/setuptools/_distutils/log.py . Note the class Log that is required by NumPy, which was removed for this latest release.

Here is the NumPy issue: https://github.com/numpy/numpy/issues/22623 . NumPy folks say to not use this setuptools, and they won't be fixing the issue; if someone wants to fix it & it doesn't break anything, they will consider merging it.

Change History (6)

comment:1 Changed 17 months ago by jmroot (Joshua Root)

Does setting SETUPTOOLS_USE_DISTUTILS=stdlib in the environment help with this?

comment:2 Changed 17 months ago by michaelld (Michael Dickens)

hmmm ... yes that setting gets the build moving ... fails locally for some other reason ... let me see what I can do here ... thx!

comment:3 Changed 17 months ago by michaelld (Michael Dickens)

Yes that works ... need both build and destroot, but that's pretty simple. Where did you find this?

comment:4 Changed 17 months ago by michaelld (Michael Dickens)

Owner: set to michaelld
Resolution: fixed
Status: newclosed

In 600d6fb2df765961adb191b237745591f7d786a2/macports-ports (master):

py-numpy: fix building with setuptools 65.6.0

Closes: #66304

comment:5 in reply to:  3 Changed 17 months ago by jmroot (Joshua Root)

Replying to michaelld:

Where did you find this?

It's been mentioned in the setuptools changelogs a few times as a transitional aid. The python ports actually set it to avoid problems with building the stdlib.

Python 3.12 will be dropping distutils from the stdlib, so I hope numpy gets things worked out by the time it's released.

comment:6 Changed 17 months ago by michaelld (Michael Dickens)

Cool; thx & yes I hope so too!

Note: See TracTickets for help on using tickets.