Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fortran Libs not importing properly #32

Closed
ghost opened this issue Jul 21, 2021 · 6 comments
Closed

Fortran Libs not importing properly #32

ghost opened this issue Jul 21, 2021 · 6 comments

Comments

@ghost
Copy link

ghost commented Jul 21, 2021

With build_lib set to true, from magic import * fails. Specifically, it has trouble import magic.legendre as leg which leads me to believe that the fortran libraries are not importing correctly. Any help would be greatly appreciated! Traceback:

Please wait: building greader_single...
Please wait: building greader_double...
Please wait: building lmrreader_single...
Please wait: building Legendre transforms...
Please wait: building vtklib...

ModuleNotFoundError Traceback (most recent call last)
in
----> 1 from magic import *

~/magic/python/magic/init.py in
14 from .checker import *
15 from .thHeat import *
---> 16 from .coeff import *
17 from .radialSpectra import *
18 from .checkpoint import *

~/magic/python/magic/coeff.py in
4 import numpy as np
5 import matplotlib.pyplot as plt
----> 6 from .spectralTransforms import SpectralTransforms
7 from magic.setup import labTex
8 import copy

~/magic/python/magic/spectralTransforms.py in
4
5 if buildSo:
----> 6 import magic.legendre as leg
7
8

ModuleNotFoundError: No module named 'magic.legendre'

@AnkitBarik
Copy link
Member

Hi,
I've typically seen this occur while using python2. Do you have both python versions (2 and 3) installed on your computer?
One way to force it to use python3 might be to explicitly set f2pyexec = f2py3. Can you set that in the magic.cfg, remove the *.so files and try again?

@ghost
Copy link
Author

ghost commented Jul 22, 2021

Hi, thank you for the reply. It doesn't even look like the .so files are created. They are supposed to be in $MAGIC_HOME/python/magic correct?

@AnkitBarik
Copy link
Member

I see. It's the compiler then. Could you send the following information?

  • Is this on a cluster or a local computer?
  • What compilers are you using (system variables: CC, FC, CXX) ?
  • Can you paste your magic.cfg ?

@ghost
Copy link
Author

ghost commented Jul 22, 2021

Local computer, CC=gcc, FC=gfortran, CXX=mpicxx
magic.cfg:

[plots]
Adapt your backend to your machine: 'TkAgg', 'GTKAgg', 'Qt4Agg', ...
backend = TkAgg
In case you don't have LaTeX installed switch to False
labTex = False
Default colormap
defaultCm = seismic
Default number of levels
defaultLevels = 65
[libraries]
adapt this value if you don't want libraries
buildLib = True
f2py executable, can be f2py, f2py2 or f2py3 (python 3)
f2pyexec = f2py3
fortran compiler: f2py -c --help-fcompiler, frequently 'intelem' or 'gnu95'
fcompiler = gfortran
c compiler: f2py -c --help-compiler
No need to touch this one except on gwdg, change it to intelem
ccompiler = gcc
~

@AnkitBarik
Copy link
Member

AnkitBarik commented Jul 22, 2021

You need to set fcompiler=gnu95 and leave the ccompiler to the default value of unix.
Edit: These should get set automatically if you source the sourceme.sh script: source /path/to/magic/sourceme.sh

@ghost
Copy link
Author

ghost commented Jul 22, 2021

Ah, that worked! Thought I had already tried gnu95 as my fortran compiler but apparently not. Thank you!

@ghost ghost closed this as completed Jul 22, 2021
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant