krischer / instaseis

Instant high-frequency seismograms from an AxiSEM database
http://instaseis.net
Other
52 stars 23 forks source link

Installation issue with instaseis: missing Fortran module #85

Open HasanAwad-Polito opened 1 year ago

HasanAwad-Polito commented 1 year ago

Dear Instaseis team,

I am writing to you because I encountered an issue when trying to install the instaseis package on my system. My system details are as follows:

My PC in windows 11 pro and I am using on it WSL - Windows Subsystem for Linux Python Version: [3.10.11] gfortran Version: GNU Fortran (Ubuntu 11.3.0-1ubuntu1~22.04.1) 11.3.0 Here's the sequence of steps I took:

Cloned the instaseis repository from GitHub. 1)Moved into the cloned directory and tried to install the package using pip install . 2)However, during the installation process, it failed with the following error: instaseis/src/finite_elem_mapping.f90:49:9:

 49 |     use global_parameters, only            : sp, dp, pi
    |         1

Fatal Error: Cannot open module file ‘global_parameters.mod’ for reading at (1): No such file or directory compilation terminated. error: command '/usr/bin/gcc' failed with exit code 1

Would you kindly assist? It seems that the Fortran source file finite_elem_mapping.f90 cannot find a module file `global_parameters

Best, Hasan

acarapetis commented 1 year ago

Same issue here. Looks like the problem is that the fortran modules are being compiled in the wrong order - finite_elem_mapping.f90 is being compiled before global_parameters.f90. Might be due to a change in the way setuptools/distutils builds C extensions?

acarapetis commented 1 year ago

Hmm, not exactly "recent" but yeah: https://github.com/pypa/distutils/commit/3665ddcf056ef72aa6e8e92aee81684d146d5dde https://github.com/pypa/setuptools/commit/3665ddcf056ef72aa6e8e92aee81684d146d5dde

HamishB commented 1 year ago

To clarify for others with this problem, the build tool-chain is helpfully sorting the fortran files alphabetically, but for instaseis the original build order matters. (see comment about it in instaseis/setup.py line 147)

One very dumb untested workaround local solution might be to rename the fortran files with a b c or 1 2 3 giving the correct order, and adjust setup.py to match, but that doesn't help with people installing using pip.

thanks..