I finally got around to trying out ObsPy… well, okay, I am still trying to figure out how to install it properly. Finally made some headway though. I followed the instructions on the ObsPy installation page. I thought everything was going smoothly. For starters, I had all of the dependencies – most importantly Python, SciPy, NumPy, and Matplotlib. I also had the Easy_install package already from when I was installing Mercurial.
The installations all seemed to go just fine, I was getting messages telling me it was all good. But then it just didn’t work. I opened up iPython, tried to give it a whirl, and it just didn’t recognize those packages at all. Turns out the default installation location was not actually in the Python path. It sounds like it should be pretty easy to fix, but it took me a long time to figure it out.
So, normally, if you want to import from a Python library, you would use something like this:
from numpy import *
But when I tried importing obspy.core, like this:
from obspy.core import read
it couldn’t find the library. After much searching, I finally figured out how to add to my python path. First, say in iPython, import sys, and check the path:
This will list what’s in the path. So for me, it was:
To add to that path, I just used:
And it worked! Although I’m still not sure how to change it permanently. But until I figure that out, at least I can play with ObsPy.