Skip to content

f2py use is broken under Python 3.12 #371

@mathomp4

Description

@mathomp4

GEOSpyD recently moved to Python 3.12. Unfortunately, this breaks our use of f2py as the scripts here assume distutils (or at least work with it). My first test shows a failure much like that in numpy/numpy#24874:

Traceback (most recent call last):
  File "/ford1/share/gmao_SIteam/GEOSpyD/24.1.2-0_py3.12/2024-04-11/bin/f2py", line 10, in <module>
    sys.exit(main())
             ^^^^^^
  File "/ford1/share/gmao_SIteam/GEOSpyD/24.1.2-0_py3.12/2024-04-11/lib/python3.12/site-packages/numpy/f2py/f2py2e.py", line 766, in main
    run_compile()
  File "/ford1/share/gmao_SIteam/GEOSpyD/24.1.2-0_py3.12/2024-04-11/lib/python3.12/site-packages/numpy/f2py/f2py2e.py", line 738, in run_compile
    builder.compile()
  File "/ford1/share/gmao_SIteam/GEOSpyD/24.1.2-0_py3.12/2024-04-11/lib/python3.12/site-packages/numpy/f2py/_backends/_meson.py", line 176, in compile
    self.sources = _prepare_sources(self.modulename, self.sources, self.build_dir)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/ford1/share/gmao_SIteam/GEOSpyD/24.1.2-0_py3.12/2024-04-11/lib/python3.12/site-packages/numpy/f2py/_backends/_meson.py", line 188, in _prepare_sources
    shutil.copy(source, bdir)
  File "/ford1/share/gmao_SIteam/GEOSpyD/24.1.2-0_py3.12/2024-04-11/lib/python3.12/shutil.py", line 435, in copy
    copyfile(src, dst, follow_symlinks=follow_symlinks)
  File "/ford1/share/gmao_SIteam/GEOSpyD/24.1.2-0_py3.12/2024-04-11/lib/python3.12/shutil.py", line 240, in copyfile
    raise SameFileError("{!r} and {!r} are the same file".format(src, dst))
shutil.SameFileError: '/home/mathomp4/Models/MAPL2-IFX-2024.1/MAPL/build-Debug/MAPL_cfio_r4/f2py3-ShaveMantissa_/ShaveMantissa_.pyf' and '/home/mathomp4/Models/MAPL2-IFX-2024.1/MAPL/build-Debug/MAPL_cfio_r4/f2py3-ShaveMantissa_/ShaveMantissa_.pyf' are the same file

I'm not sure how to fix this yet. I know some flags aren't in the meson style of f2py, see https://numpy.org/devdocs/f2py/buildtools/distutils-to-meson.html

My hope is that I can follow around @HaoZeke on the numpy repo and figure out the fix...

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions