simpegEM1D icon indicating copy to clipboard operation
simpegEM1D copied to clipboard

BUG: cannot import scipy.interpolate.quadrature for SciPy >= 1.5.0

Open jc-barreto opened this issue 5 years ago • 9 comments

Hello,

I'm trying to install SimPEGEM1D, but I'm getting an error with the fortran compiler. I have standard SimPEG 14.0 running. I already had in my PC the fortran 95 from Silverfrost and I also have installed through conda : conda install -c conda-forge fortran-compiler . I also installed MinGW64 I add everything to my Path but still not working.

Would you please help me?

image image image

jc-barreto avatar Sep 18 '20 17:09 jc-barreto

@jc-barreto we are currently updating the simpegEM1D repository so that we can add it directly to the SimPEG framework. The master branch of this repository is actually not compatible with the latest version of SimPEG. If you need to use this code right away, I suggest working on the branch "update_to_simulation" within the simpegEM1D repository. Please note this branch is being actively worked on.

The Fortran addon will speed up the runtime for any simulation or inversion but it is not actually necessary for running the code. If the Fortran is not compiled, the same operations will instead be performed purely in Python.

dccowan avatar Sep 18 '20 17:09 dccowan

Hi @jc-barreto,

The fortran compiler should be handled now by scipy anyway.

What I would recommend doing is to install SimPEG from conda-forge

conda install -c conda-forge simpeg=0.13.1

Once that's done, just path the simpegEM1D folder to your system environments under a PYTHONPATH variable. On Windows, it should look like this. image

This should do the trick... no need to run the setup.py

domfournier avatar Sep 18 '20 17:09 domfournier

Hi @jc-barreto,

I am sorry to hear that you are having problem for installing. Below is the copy and paste from #28:

1- Install tdm64-gcc-5.1.0

2- Download and unzip the fortran compiler (overwrite) in the C:\TDM-GCC-64 directory

3- Add the C:\TDM-GCC-64\bin to your PATH environment

(Since you have other compilers installed, you might also need to temporarily remove them from your path.)

4- In a command terminal run conda uninstall mingw, this makes sure that the install goes through the TDM-GCC-64 compiler.

5- Re-run the pip install simpegEM1D

Try this, and let us know if you still have problem. Also, try pip install SimPEG==0.13.1 because simpegEM1D is not up-to-date for the latest SimPEG version.

sgkang avatar Sep 18 '20 18:09 sgkang

Hello @dccowan , @sgkang and @domfournier thank you for the answers. I have first tried the solution proposed by @domfournier but unfortunately didn't work.

1- So I created a new env, and I installed SimPEG = 0.13.1

2- I tried the one @sgkang, and for that one, I had to modify a little, because with the step 2 didn't work. After installing TDM-GCC-64 and doing all the steps I tried to install SimPEGEM1D, didn't work. So I uninstall everything and install it again without doing the step 2, and this worked for installing SimPEGEM1D.

My problem now is that when I try to run the example from the notebook folder in simpegEM1d it gives an error with scipy.

ModuleNotFoundError: No module named 'scipy.integrate.quadrature'

But I have scipy installed, it was installed when I installed SimPEG 0.13.1

Do you know why is not working? is it because the Scipy version? The one I have is 1.5.0

image

jc-barreto avatar Sep 19 '20 10:09 jc-barreto

No, it is not the SciPy version. This is potentially a bug, as quadrature has first to be imported.

Try running this before the other commands:

from scipy.integrate import quadrature

That should hopefully work.

prisae avatar Sep 19 '20 10:09 prisae

Actually it might be the SciPy version @jc-barreto . If above doesn't work try installing older SciPy versions, e.g. 1.3 or so.

prisae avatar Sep 19 '20 11:09 prisae

Yeah, that is it. It is probably broken since SciPy 1.5.0, as quadrature was moved to a private namespace _quadrature. So installing SciPy < 1.5.0 should be fine.

Maybe we should open a separate issue with this.

Here the change in SciPy https://github.com/scipy/scipy/commit/d1c119150d1c11eb9025b21afc5505ff3ee42911#diff-44389779461bd39a8cfbcac8e69e470eL89

prisae avatar Sep 19 '20 11:09 prisae

@prisae It was a problem with SciPy version, I installed the 1.3 and worked. thank you

jc-barreto avatar Sep 20 '20 12:09 jc-barreto

Hi @jc-barreto - Great it worked! I reopen and rename the issue, as it is actually a bug and we should fix it. Thanks for reporting.

prisae avatar Sep 20 '20 13:09 prisae