alphaparrot / ExoPlaSim

Exoplanet Planet Simulator (PlaSim extended for different planet types (including tidally-locked) and evolution on geological timescales--glaciers and carbon cycle)
GNU General Public License v2.0
65 stars 12 forks source link

Version 3.3.0 Not Working - Error "No module name 'exoplasim.pyfft'" #15

Closed robmod closed 5 months ago

robmod commented 9 months ago

I just updated exoplasim for the first time in a year. I tried running an old case, and I very quickly get the following error:

[...] Writing to /Users/[user]/Desktop/test_runs/earth_test2_run/earth_test2.cfg.... No module named 'exoplasim.pyfft' No module named 'exoplasim.pyfft' Error writing output to MOST.00000.nc; log written to postprocess.log Going to stop here just in case...... [...]

If it helps, my machine is running Ventura on a Macbook Pro.

robmod commented 9 months ago

I tried what brianthomas-washburn suggested, and ran ./configure.sh from the exoplasim directory, followed by running my case (from a different directory in this instance) but the error didn't resolve.

Running ./configure.sh I got output that looks suspicious:

Found C compiler              at: /usr/bin/gcc
Found C++ compiler            at: /usr/bin/c++
Found MPI FORTRAN-90 compiler at: /usr/local/bin/mpif90
Found MPI C compiler          at: /usr/local/bin/mpicc
Found MPI C++ compiler        at: /usr/local/bin/mpicxx
Found GNU assembler           at: /opt/local/bin/as
Fast Legendre Transformation    : ACTIVE (Darwin)
gfortran -o f90check.x f90check.f90
ld: library not found for -lSystem
collect2: error: ld returned 1 exit status
make: *** [makecheck:4: f90check.x] Error 1
./configure.sh: line 343: ./f90check.x: No such file or directory
./configure.sh: line 344: ./cc_check.x: No such file or directory
FORTRAN Compiler: gfortran
C       Compiler: gcc
./configure.sh: line 361: f2py2: command not found
usage: f2py [--dep DEPENDENCIES] [--backend {meson,distutils}] [-m MODULE_NAME]
f2py: error: argument -m: expected one argument
./configure.sh: line 362: f2py2: command not found
usage: f2py [--dep DEPENDENCIES] [--backend {meson,distutils}] [-m MODULE_NAME]
f2py: error: argument -m: expected one argument
python3 -m numpy.f2py -c -m --f90exec=gfortran --f77exec=gfortran --f90flags=-O3 pyfft pyfft.f90 && mv pyfft.cpython*.so pyfft.so
usage: __main__.py [--dep DEPENDENCIES] [--backend {meson,distutils}] [-m MODULE_NAME]
__main__.py: error: argument -m: expected one argument
usage: __main__.py [--dep DEPENDENCIES] [--backend {meson,distutils}] [-m MODULE_NAME]
__main__.py: error: argument -m: expected one argument
alphaparrot commented 9 months ago

99 times out of 100 problems with f2py are a python/libraries problem, but there is always the looming threat that the numpy devs will introduce breaking changes. What versions of numpy and gcc do you have?

robmod commented 9 months ago

I have GCC 12.2.0 and numpy 1.26.4.

@alphaparrot Would a problem with f2py also explain the error I get when trying to run a case: No module named 'exoplasim.pyfft? That's the original and pressing error.

alphaparrot commented 9 months ago

Yes; if there is a problem with f2py, then it will fail to compile the pyfft linked library, resulting in that error. The pyfft module is written in Fortran (for speed), and needs to be compiled into a library importable by python. That is what f2py does.

I'll look into whether gcc 12 may be the culprit; I think the latest gcc I tested against was gcc 10. Because f2py is compiling Fortran, it uses gcc (actually gfortran) to accomplish the linking.

On Wed, Feb 21, 2024, 12:07 PM robmod @.***> wrote:

I have GCC 12.2.0 and numpy 1.26.4.

@alphaparrot https://github.com/alphaparrot Would a problem with f2py also explain the error I get when trying to run a case: No module named 'exoplasim.pyfft? That's the original and pressing error.

— Reply to this email directly, view it on GitHub https://github.com/alphaparrot/ExoPlaSim/issues/15#issuecomment-1957333240, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADRQKQBP2464C6U65267O43YUYSVNAVCNFSM6AAAAABDSBQCXWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNJXGMZTGMRUGA . You are receiving this because you were mentioned.Message ID: @.***>

robmod commented 9 months ago

Could this possibly be an issue with pathing? I'm running exoplasim, python, and numpy from installations under /Users/username/..., but my system also has installations of python and numpy under usr/local/.... For context I just upgraded both numpy installs prior to upgrading exoplasim. Prior to both these upgrades, my old version of exoplasim was working fine with numpy.

alphaparrot commented 9 months ago

That is certainly possible, and this is one of the risks of having configure.sh be a shell script. Eventually I'll translate it to python to ensure we always use the same environment for all steps; the shell script is a legacy of the underlying PlaSim model. If I can't replicate the problem on a clean install with gcc 12 then that might be a culprit (and would also point towards the solution, i.e. improving environment awareness in the configuration step).

On Wed, Feb 21, 2024, 12:22 PM robmod @.***> wrote:

Could this possibly be an issue with pathing? I'm running exoplasim, python, and numpy (I believe) from installations under /Users/username/..., but my system also has installations under usr/local/.... For context I just upgraded both numpy installs prior to upgrading exoplasim. Prior to both these upgrades, my old version of exoplasim was working fine with numpy.

— Reply to this email directly, view it on GitHub https://github.com/alphaparrot/ExoPlaSim/issues/15#issuecomment-1957380116, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADRQKQEBARLFYXSPY5ED2STYUYUMNAVCNFSM6AAAAABDSBQCXWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNJXGM4DAMJRGY . You are receiving this because you were mentioned.Message ID: @.***>

robmod commented 9 months ago

To be clear, I only used configure.sh to try to remedy the No module named 'exoplasim.pyfft' error. I've always just run my exoplasim cases by configuring a python file on a desktop folder and then calling the file from terminal, like python earth_case12b.py for example. I don't actually care about running configure.sh, except if it can help solve the "no module" issue.

alphaparrot commented 9 months ago

Configure.sh is always called at some point in the process of installing and using ExoPlaSim—the very first time you try to compile the model, if configure.sh has never been run before, it will be run automatically. Most users should never need to touch configure.sh; it should only be rerun if it failed the first time (usually resulting in exoplasim.pyfft module not found errors or the model flat-out failing to compile), or if the environment has changed (like you upgraded a compiler). This is the script that figures out which compilers to use and where they are, what flags to use, etc, and stores that info so the model can be compiled later without rerunning the shell script, and also compiles pyfft. When it's run automatically, it's run from inside the python wrapper, but still as a shell script.

On Wed, Feb 21, 2024, 1:55 PM robmod @.***> wrote:

To be clear, I only used configure.sh to try to remedy the No module named 'exoplasim.pyfft' error. I've always just run my exoplasim cases by configuring a python file on a desktop folder and then calling the file from terminal, like python earth_case12b.py for example. I don't actually care about running configure.sh, except if it can help solve the "no module" issue.

— Reply to this email directly, view it on GitHub https://github.com/alphaparrot/ExoPlaSim/issues/15#issuecomment-1957700895, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADRQKQBSBVEUSBPWL6KJNO3YUY7KNAVCNFSM6AAAAABDSBQCXWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNJXG4YDAOBZGU . You are receiving this because you were mentioned.Message ID: @.***>