Thanks for passing on the link referenced below. I'm presently testing the mod, and so far it works. The question I have at present is, if this turns out to be a viable fix, what are the next steps? Sam Dupree On Tue, 06 Jan 2026 10:10:29 -0800, Bill Ross <[email protected]> wrote: Here it is - the diffs are reached by clicking on the hex-coded links ("Long time I fell ..." --Gandalf). https://github.com/numpy/numpy/pull/27406/commits/1cc02cc6710384c52e1082a33d1617504eaed296 --- -- Phobrain.com On 2026-01-06 09:37, Bill Ross wrote: I'm out of my depth, but I'd try that location first, however maybe like this: if name == "meson": from ._meson import MesonBackend return MesonBackend elif name == "distutils": print("HACK skipping distutils for buggy downstream import") return None # from ._distutils import DistutilsBackend # return DistutilsBackend else: raise ValueError(f"Unknown backend: {name}") If it runs great, if not, it appears DistUtilsBackend would need to skip loading that specific compiler. I don't understand how to find the actual patch/diff that the bug link is about. > Might try using the patch in https://github.com/numpy/numpy/pull/27406. --- -- Phobrain.com On 2026-01-06 09:23, Samuel H Dupree Jr wrote: Are you saying that I should try modifying ~/opt/anaconda3/lib/python3.11/site-packages/numpy/f2py/_backends/-init_.py, as follows: def f2py_build_generator(name): if name == "meson": from ._meson import MesonBackend return MesonBackend #elif name == "distutils": # from ._distutils import DistutilsBackend # return DistutilsBackend else: raise ValueError(f"Unknown backend: {name}") appears to be where the "key" is chosen, furthermore, Please advise. Sam Dupree. On Tue, 06 Jan 2026 09:14:47 -0800, Bill Ross <[email protected]> wrote: > So, what do you think the best way is to fix my problem? Per Charles Harris, stub out the missing OS, which distutils seems to try to load by default (i.e. the key is 'distutils' not the unwanted OS so my idea wasn't fruitful): > Might try using the patch in https://github.com/numpy/numpy/pull/27406. Bill Ross -- Phobrain.com On 2026-01-06 08:49, Samuel H Dupree Jr wrote: The source member, ~/opt/anaconda3/lib/python3.11/site-packages/numpy/f2py/_backends/-init_.py, def f2py_build_generator(name): if name == "meson": from ._meson import MesonBackend return MesonBackend elif name == "distutils": from ._distutils import DistutilsBackend return DistutilsBackend else: raise ValueError(f"Unknown backend: {name}") appears to be where the "key" is chosen, furthermore, in f2p2e.py sets the background_key and invokes 2py_build_generator. To my knowledge, I'm not running meson. So, what do you think the best way is to fix my problem? Please advise, Sam Dupree On Sun, 04 Jan 2026 18:23:22 -0800, Bill Ross <[email protected]> wrote: Uninformed debugging: > build_backend = f2py_build_generator(backend_key) Can you inspect that backend_key? It seems like it could be 'key' to choosing the wrong back end. Bill -- Phobrain.com On 2026-01-04 17:18, Samuel H Dupree Jr wrote: I am resurrecting a Python program I wrote a few years under Python 3.9. I'm presently: Running Python 3.11 under Mac OSX Sequoia (ver. 15.7.1) Using NumPy version 1.26.4 Running on an Intel (x86-64) Mac Pro Desktop (2019) The program uses a Fortran 77 subroutine that was wrapped using f2py when I running Python 3.9. However, when I attempt to wrap that same subroutine (the source code is attached to this note) using f2py in Python 3.11, I get the following error message. (base) user@Mac-Pro accgravityfiled_builder_f2py % f2py -c accgravityfield.f -m accgravityfield Traceback (most recent call last): File "/Users/user/opt/anaconda3/bin/f2py", line 8, in <module> sys.exit(main()) ^^^^^^ File "/Users/user/opt/anaconda3/lib/python3.11/site-packages/numpy/f2py/f2py2e.py", line 766, in main run_compile() File "/Users/user/opt/anaconda3/lib/python3.11/site-packages/numpy/f2py/f2py2e.py", line 594, in run_compile build_backend = f2py_build_generator(backend_key) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/user/opt/anaconda3/lib/python3.11/site-packages/numpy/f2py/_backends/__init__.py", line 6, in f2py_build_generator from ._distutils import DistutilsBackend File "/Users/user/opt/anaconda3/lib/python3.11/site-packages/numpy/f2py/_backends/_distutils.py", line 3, in <module> from numpy.distutils.core import setup, Extension File "/Users/user/opt/anaconda3/lib/python3.11/site-packages/numpy/distutils/core.py", line 24, in <module> from numpy.distutils.command import config, config_compiler, \ File "/Users/user/opt/anaconda3/lib/python3.11/site-packages/numpy/distutils/command/config.py", line 19, in <module> from numpy.distutils.mingw32ccompiler import generate_manifest File "/Users/user/opt/anaconda3/lib/python3.11/site-packages/numpy/distutils/mingw32ccompiler.py", line 27, in <module> from distutils.msvccompiler import get_build_version as get_build_msvc_version ModuleNotFoundError: No module named 'distutils.msvccompiler' (base) user@Mac-Pro accgravityfiled_builder_f2py % As for gfortran is concerned: (base) user@Mac-Pro accgravityfiled_builder_f2py % gfortran -v Using built-in specs. COLLECT_GCC=gfortran COLLECT_LTO_WRAPPER=/usr/local/Cellar/gcc/15.2.0/bin/../libexec/gcc/x86_64-apple-darwin24/15/lto-wrapper Target: x86_64-apple-darwin24 Configured with: ../configure --prefix=/usr/local/opt/gcc --libdir=/usr/local/opt/gcc/lib/gcc/current --disable-nls --enable-checking=release --with-gcc-major-version-only --enable-languages=c,c++,objc,obj-c++,fortran --program-suffix=-15 --with-gmp=/usr/local/opt/gmp --with-mpfr=/usr/local/opt/mpfr --with-mpc=/usr/local/opt/libmpc --with-isl=/usr/local/opt/isl --with-zstd=/usr/local/opt/zstd --with-pkgversion='Homebrew GCC 15.2.0' --with-bugurl=https://github.com/Homebrew/homebrew-core/issues --with-system-zlib --build=x86_64-apple-darwin24 --with-sysroot=/Library/Developer/CommandLineTools/SDKs/MacOSX15.sdk Thread model: posix Supported LTO compression algorithms: zlib zstd gcc version 15.2.0 (Homebrew GCC 15.2.0) (base) user@Mac-Pro accgravityfiled_builder_f2py % I have two questions: Why is f2py in a Mac OSX Intel based environment attempting to import 'distutils.msvccompiler' that is required for Windows' environment only? What do I need to do to eliminate this problem? Any thoughts? Sam Dupree _______________________________________________ NumPy-Discussion mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3//lists/numpy-discussion.python.org Member address: [email protected] _______________________________________________ NumPy-Discussion mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3//lists/numpy-discussion.python.org Member address: [email protected] _______________________________________________ NumPy-Discussion mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3//lists/numpy-discussion.python.org Member address: [email protected] _______________________________________________ NumPy-Discussion mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3//lists/numpy-discussion.python.org Member address: [email protected] _______________________________________________ NumPy-Discussion mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3//lists/numpy-discussion.python.org Member address: [email protected] _______________________________________________ NumPy-Discussion mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3//lists/numpy-discussion.python.org Member address: [email protected] _______________________________________________ NumPy-Discussion mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3//lists/numpy-discussion.python.org Member address: [email protected]
_______________________________________________ NumPy-Discussion mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3//lists/numpy-discussion.python.org Member address: [email protected]
