ImportError: No module named sac obspy

Hi there

I am really new to python and obspy and I need to run a script written in python2.7
I installed conda with Miniconda3-latest-Linux-x86_64.sh file.
I built an environment with miniconda for obspy by the following command
conda create -n obspy27 python=2.7
I also installed some other packages like ipython, numpy, matplotlib and basemap.
When I built my environment with python 3.7 I got some syntax error and because I am not familiar with python I prefer to build my environment with python 2.7 so that my script can run with no need to change syntaxes.
But when I build my environment with python 2.7 I get the following error with importing sac modules:
import obspy.sac
ImportError: No module named sac

Great thanks,

Try import obspy.io.sac.

This will import the sac module which I believe you are looking for. It’s always worth checking the docs to understand the submodule structure of a package.

1 Like