instaseis icon indicating copy to clipboard operation
instaseis copied to clipboard

Installation issue with instaseis: missing Fortran module

Open HasanAwad-Polito opened this issue 1 year ago • 3 comments

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

HasanAwad-Polito avatar Jun 20 '23 11:06 HasanAwad-Polito

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 avatar Jul 25 '23 02:07 acarapetis

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

acarapetis avatar Jul 25 '23 02:07 acarapetis

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..

HamishB avatar Aug 07 '23 03:08 HamishB