paudetseis / PyRaysum

Teleseismic body wave modeling through stacks of (dipping/anisotropic) layers
https://paudetseis.github.io/PyRaysum/
MIT License
43 stars 14 forks source link

Error: ImportError: DLL load failed while importing fraysum: The specified module could not be found. #16

Closed tbelinic closed 1 year ago

tbelinic commented 1 year ago

Hello, I installed pyraysum with:

conda create -n prs python fortran-compiler obspy -c conda-forge
conda activate prs
conda install jupyter
pip install pyraysum

When I try to run anything, for example:

from pyraysum import Model, Geometry, Control, run

# Build a 1-layer-over-half-space subsurface model
model = Model(
    thickn=[32000, 0],  # m; half-space thickness is irrelevant
    rho=[2800, 3600],  # kg/m^3
    vp=[6400, 8100],  # m/s
    vs=[3600, 4650],  # m/s
)
model.plot()

I get:

ImportError                               Traceback (most recent call last)
Cell In[1], line 1
----> 1 from pyraysum import Model, Geometry, Control, run
      3 # Build a 1-layer-over-half-space subsurface model
      4 model = Model(
      5     thickn=[32000, 0],  # m; half-space thickness is irrelevant
      6     rho=[2800, 3600],  # kg/m^3
      7     vp=[6400, 8100],  # m/s
      8     vs=[3600, 4650],  # m/s
      9 )

File ~\.conda\envs\prs\lib\site-packages\pyraysum\__init__.py:25
      1 # Copyright 2022 Wasja Bloch, Pascal Audet
      2 
      3 # This file is part of PyRaysum.
   (...)
     20 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
     21 # SOFTWARE.
     23 __version__ = '1.0.0'
---> 25 from .prs import Model, Geometry, Control, Result, run

File ~\.conda\envs\prs\lib\site-packages\pyraysum\prs.py:32
     30 from numpy.fft import fft, ifft, fftshift
     31 from copy import deepcopy
---> 32 import fraysum
     34 from pyraysum import plot
     35 from pyraysum.frs import read_arrivals, read_traces, _phnames

ImportError: DLL load failed while importing fraysum: The specified module could not be found.

And I cannot find fraysum anywhere. Thank you for your help!

wasjabloch commented 1 year ago

Hi @tbelinic

I'm sorry to hear that the installation process did not work for you. In fact, in a fresh install, I was unable to install jupyter next to pyraysum, due to conflicts between the fortran-compiler and jupyter. Can you try to execute the above comands in a python console?

wasjabloch commented 1 year ago

There has been a backward incompatibility with recent f2py versions. For the time being, I recommend installing the package with these version constraints:

conda create -n prs python<3.12 numpy<1.23 setuptools<60.0 fortran-compiler obspy -c conda-forge

Please test if this resolves your issue and open a new issue if the problem persists.

Thank you for reporting!