I'm using f2py
to compile a Fortran subroutine to be called in a Python script.
I have compiled the Fortran source on Mac #1, running Mojave 10.14
. I compiled it using:
f2py -c -m <ModuleName> <SourceName.f90>
This works. I get a .so
file that I can them import in Python using:
import <ModuleName> as m
The issue comes when I try to run it on another Mac.
On Mac #2, also running Mojave 10.14, when I try and use the pre-compiled module:
>>> import <ModuleName> as m
Traceback (most recent call last):
File "Stats_Wizard.py", line 20, in <module>
import <ModuleName> as sf
ImportError: dlopen(/path/to/<ModuleName>.so, 2): Library not loaded: /usr/local/opt/gcc/lib/gcc/9/libgfortran.5.dylib
Referenced from: /path/to/<ModuleName>.so
Reason: image not found
I checked the hash of the .so
files on each computer and they matched. Which means there's an issue with using the .so
between computers.
Is there a reason why I would not be able to use the same pre-compiled version on each computer?
EDIT: A point of note that differs between Mac #1 and Mac #2: Mac #1 has gfortran
installed, Mac #2 does NOT. However, I feel that this should not make a difference because the module is already compiled.