-
-
Notifications
You must be signed in to change notification settings - Fork 11.7k
Description
Describe the issue:
The colon separator in f2py -h xxx.pyf --include-paths dir1:dir2 doesn't properly work on Windows. Only the first list item is parsed whereas the other ones throw errors.
Prepare the following pieces for reproduction:
dirs:
--incldir1/inc/
--incldir2
files:
fincl.f:
SUBROUTINE DEMO
IMPLICIT NONE
INCLUDE 'inc/inclme'
A = 1
B = 2
WRITE (6,*) 'Hello World.', A, B
END SUBROUTINE
file incldir1/inc/inclme:
INTEGER A, B
COMMON /MYCOMMON/ A, B
Reproduce the code example:
Run in Powershell or cmd:
python -m numpy.f2py -h fincl.pyf fincl.f --include-paths "incdir2":"incdir1"Error message:
python -m numpy.f2py -h fincl.pyf fincl.f --include-paths "incdir2":"incdir1" --overwrite-signature
OSError: [Errno 2] No such file or directory: ':incdir1'. Skipping file ":incdir1".
Reading fortran codes...
Reading file 'fincl.f' (format:fix,strict)
Line #5 in fincl.f:" INCLUDE 'inc/inclme'"
readfortrancode: could not find include file 'inc/inclme' in ;incdir2. Ignoring.
Post-processing...
Block: demo
Applying post-processing hooks...
character_backward_compatibility_hook
Post-processing (stage 2)...
Saving signatures to file ".\fincl.pyf"Runtime information:
>>> import sys, numpy; print(numpy.__version__); print(sys.version)
1.25.2
3.11.4 | packaged by conda-forge | (main, Jun 10 2023, 17:59:51) [MSC v.1935 64 bit (AMD64)]
>>> print(numpy.show_runtime())
WARNING: `threadpoolctl` not found in system! Install it by `pip install threadpoolctl`. Once installed, try `np.show_runtime` again for more detailed build information
[{'numpy_version': '1.25.2',
'python': '3.11.4 | packaged by conda-forge | (main, Jun 10 2023, 17:59:51) '
'[MSC v.1935 64 bit (AMD64)]',
'uname': uname_result(system='Windows', node='tapc604', release='10', version='10.0.22621', machine='AMD64')},
{'simd_extensions': {'baseline': ['SSE', 'SSE2', 'SSE3'],
'found': ['SSSE3',
'SSE41',
'POPCNT',
'SSE42',
'AVX',
'F16C',
'FMA3',
'AVX2'],
'not_found': ['AVX512F',
'AVX512CD',
'AVX512_SKX',
'AVX512_CLX',
'AVX512_CNL',
'AVX512_ICL']}}]
None
Also occurs on "all" versions >= 1.19.5
Context for the issue:
We have a multiplatform code - chromo - with substantial fortran codebase and faced problems with f2py versions distributed in numpy >=1.20. Therefore, we cached the f2py signature files generated with 1.19.5 on linux and made them part of the repo. This approach masked this bug in Windows until the general f2py bug has been fixed in #22657 by @HaoZeke.
Since #22657 has been merged, we will remove our caching with the next numpy release. Until this problem shown above persists, we will have to stop distributing Windows binaries and suspend supporting it until the present bug is resolved. It doesn't appear very challenging to solve but the interface may need to accept other separators which are not colons on Windows.