malcolmw / pykonal

Travel-time calculator based on the fast-marching method solution to the Eikonal equation.
https://malcolmw.github.io/pykonal-docs/
GNU General Public License v3.0
154 stars 55 forks source link

Cannot import - missing scipy/no module named 'pykonal.solver' #6

Closed hemmelig closed 4 years ago

hemmelig commented 4 years ago

Hi,

Just to flag - following the installation instructions using miniconda3 lead to issues (at least on my system):

In [1]: import pykonal                                                                                                                                                                                      
---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-1-ad447b62261e> in <module>
----> 1 import pykonal

~/miniconda3/envs/pykonal/lib/python3.8/site-packages/pykonal/__init__.py in <module>
     14 from . import heapq
     15 from . import inventory
---> 16 from . import locate
     17 from . import solver
     18 from . import stats

pykonal/locate.pyx in init pykonal.locate()

ModuleNotFoundError: No module named 'scipy'

Resolved by installing scipy in my pykonal environment, as it doesn't ship with miniconda3. Possibly also true for virtualenv users.

Further to this, when then trying to import pykonal:

In [1]: import pykonal                                                                                                                                                                                      
---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-1-ad447b62261e> in <module>
----> 1 import pykonal

~/Documents/pykonal/pykonal/__init__.py in <module>
      8 )
      9 
---> 10 from .solver import EikonalSolver
     11 
     12 from . import constants

ModuleNotFoundError: No module named 'pykonal.solver'

I have tried also installing locally using the setup.py file, but to no avail.

System details:

>> g++ -v
...
gcc version 7.5.0 (Ubuntu 7.5.0-3ubuntu1~18.04) 

Looking forward to using the package - I've been using scikit-fmm to generate traveltime lookup tables as a backend for a software project I am involved in, but the ability to use spherical coordinate systems is an excellent addition!

malcolmw commented 4 years ago

@hemmelig Thank you for reporting this.

Indeed scipy is a dependency that crept in to a peripheral module used for locating earthquakes. I updated the setup.py file to prevent this issue from coming up in the future and published a new release that includes this small patch https://github.com/malcolmw/pykonal/releases/tag/0.3.2b1.

Regarding the second issue: Can you verify that you are outside of the package directory when you try your import? If you are inside the package directory, I believe the interpreter will look for a local file named solver.py, which is nonexistent.

hemmelig commented 4 years ago

Perfect, thank you. I did wonder how I managed to generate two different issues (I encountered the solver related issue before scipy, which I must have then generated by trying in a new shell in a different directory). It's perhaps worth flagging that somewhere in the documentation - the first thing I wanted to do after the install is open an iPython session and check it imports!

Thanks again, closing this issue.

malcolmw commented 4 years ago

@hemmelig Great! Glad it was a simple fix :) I will update the docs with a note as you suggest.

Please let me know if you run into any other problems or have any questions.