Skip to content
This repository has been archived by the owner on Jul 12, 2023. It is now read-only.

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

Open
jc-barreto opened this issue Sep 18, 2020 · 9 comments
Open

Comments

@jc-barreto
Copy link

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

@dccowan
Copy link
Member

dccowan commented Sep 18, 2020

@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.

@domfournier
Copy link

domfournier commented Sep 18, 2020

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

@sgkang
Copy link
Contributor

sgkang commented Sep 18, 2020

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.

@jc-barreto
Copy link
Author

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

@prisae
Copy link
Member

prisae commented Sep 19, 2020

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
Copy link
Member

prisae commented Sep 19, 2020

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
Copy link
Member

prisae commented Sep 19, 2020

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
scipy/scipy@d1c1191#diff-44389779461bd39a8cfbcac8e69e470eL89

@jc-barreto
Copy link
Author

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

@prisae prisae changed the title Error installing SimPEGEM1D BUG: cannot import scipy.interpolate.quadrature for SciPy >= 1.5.0 Sep 20, 2020
@prisae
Copy link
Member

prisae commented Sep 20, 2020

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 prisae reopened this Sep 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants