Obspy-scan and other scripts...

Dear all,

I’m a novice user of ObsPy and Python. First of all I want to thank the developers for their excellent work in implementing all this marvelous tools for seismology in Python.
I’ve been having trouble running some of the provided shell scripts that use the obspy.imaging package. Namely, whenever I run obspy-plot or obspy-scan shell scripts I run into this type of error message:

ean@lapsis:~/…/ObsPyOut$ obspy-plot
Traceback (most recent call last):
File “/usr/local/bin/obspy-plot”, line 5, in
from pkg_resources import load_entry_point
File “/usr/local/lib/python2.7/dist-packages/pkg_resources.py”, line 2707, in
working_set.require(requires)
File “/usr/local/lib/python2.7/dist-packages/pkg_resources.py”, line 686, in require
needed = self.resolve(parse_requirements(requirements))
File “/usr/local/lib/python2.7/dist-packages/pkg_resources.py”, line 584, in resolve
raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: obspy.imaging==0.7.0

I read in stack exchange a similar case where a certain version of a package distribution was asked for and the fix was basically backtracking to an older version of the required package… In this case it seems that there is a requirement for obspy.imaging==0.7.0. What is the best way to go about fixing this?
By the way, I’m using Linux and Python2.7.3.

Thank you very much for your time and suggestions.

Best regards,

Emanuel Antunes

Dear all,

I’m a novice user of ObsPy and Python. First of all I want to thank the developers for their excellent work in implementing all this marvelous tools for seismology in Python.
I’ve been having trouble running some of the provided shell scripts that use the obspy.imaging package. Namely, whenever I run obspy-plot or obspy-scan shell scripts I run into this type of error message:

ean@lapsis:~/.../ObsPyOut$ obspy-plot
Traceback (most recent call last):
  File "/usr/local/bin/obspy-plot", line 5, in <module>
    from pkg_resources import load_entry_point
  File "/usr/local/lib/python2.7/dist-packages/pkg_resources.py", line 2707, in <module>
    working_set.require(__requires__)
  File "/usr/local/lib/python2.7/dist-packages/pkg_resources.py", line 686, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/local/lib/python2.7/dist-packages/pkg_resources.py", line 584, in resolve
    raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: obspy.imaging==0.7.0

This looks like your obspy-plot script, is referencing a quite old version of obspy, actually more precisely a the package `obspy.imaging`, which existed when obspy was composed by may sub-packages.

Maybe, your obspy-plot script is a left over, from an older installation. You may want to check with `which obspy-plot` which script you are actually execution and if it is the one you are expecting. It may just come first in you PATH and mask the current version ??? Just a guess …
~petr

Greetings again,

  Thank you Peter for your reply. This is the first time I installed and run ObsPy, and at the time I downloaded it (some two weeks ago) I think it was the last version (installed via apt-get as referenced here: https://github.com/obspy/obspy/wiki/Installation-on-Linux-via-Apt-Repository ) .
Therefore, there is no conflicting version. The "which obspy-plot" and "which obspy-scan" point respectively to /usr/local/bin/obspy-plot and /usr/local/bin/obspy-scan .

Has anyone experienced this type of issue? I have no problem whenever I run another shell script that uses packages outside of the obspy.imaging package...

All your suggestions and hints are deeply appreciated. Thank you.

Best regards,

Emanuel A.

Hi Emanuel,

so you're on Ubuntu, I assume.. Can you please send me the output of
following commands:

$ aptitude search obspy
$ aptitude show python-obspy
$ aptitude versions python-obspy
$ grep obspy /etc/apt/sources.list
$ lsb_release -a
$ uname -a

Also can you please run the test suites, like..

$ obspy-runtests -r

best,
Tobias

Hello Tobias,

Thank you for your interest in helping solve this problem.
In the mean time I figured out a way of doing what I had to running “python -m obspy.imaging.scripts.scan” in my own shell script. That works without any trouble. So I guess most functions would work from within Python.
In any case, it would be good to see what is wrong with my obspy installation. So, here goes the terminal output of the commands you asked me to run:

antunes@lapsis:~$ aptitude search obspy
i python-obspy - ObsPy: A Python Toolbox for seismology seismol

antunes@lapsis:~$ aptitude show python-obspy
Package: python-obspy
New: yes
State: installed
Automatically installed: no
Version: 0.9.2-1~wheezy
Priority: extra
Section: python
Maintainer: ObsPy Development Team <devs@obspy.org>
Architecture: i386
Uncompressed Size: 39.8 M
Depends: python (>= 2.6), python (< 3), python-numpy (>= 1:1.6.1), python-numpy-abi9,
python-setuptools (>= 0.6), python-lxml (>= 2.1), python-matplotlib (>= 0.98.1),
python-scipy, python-sqlalchemy, python-suds (>= 0.4), libc6 (>= 2.11), libgcc1
(>= 1:4.1.1), libgfortran3 (>= 4.6), libquadmath0 (>= 4.6), python-tornado
Recommends: python-geographiclib, python-nose, python-flake8, python-imaging, python-mock
Suggests: python-mpltoolkits.basemap, python-mlpy, python-pyproj, ipython
Conflicts: python-obspy-arclink, python-obspy-core, python-obspy-datamark,
python-obspy-db, python-obspy-earthworm, python-obspy-fissures,
python-obspy-gse2, python-obspy-imaging, python-obspy-iris,
python-obspy-mseed, python-obspy-neries, python-obspy-realtime,
python-obspy-sac, python-obspy-seg2, python-obspy-segy, python-obspy-seisan,
python-obspy-seishub, python-obspy-sh, python-obspy-signal, python-obspy-taup,
python-obspy-wav, python-obspy-xseed
Replaces: python-obspy-arclink, python-obspy-core, python-obspy-datamark,
python-obspy-db, python-obspy-earthworm, python-obspy-gse2,
python-obspy-imaging, python-obspy-iris, python-obspy-mseed,
python-obspy-neries, python-obspy-realtime, python-obspy-sac,
python-obspy-seg2, python-obspy-segy, python-obspy-seisan,
python-obspy-seishub, python-obspy-sh, python-obspy-signal, python-obspy-taup,
python-obspy-wav, python-obspy-xseed
Description: ObsPy: A Python Toolbox for seismology seismological observatories
ObsPy is an open-source project dedicated to provide a Python framework for processing
seismological data. It provides parsers for common file formats, clients to access data
centers and seismological signal processing routines which allow the manipulation of
seismological time series.

For more information visit http://www.obspy.org.
Homepage: http://www.obspy.org

antunes@lapsis:~$ aptitude versions python-obspy
Package python-obspy:
i 0.9.2-1~wheezy stable 500

antunes@lapsis:~$ grep obspy /etc/apt/sources.list
deb http://deb.obspy.org wheezy main

antunes@lapsis:~$ lsb_release
LSB Version: core-2.0-ia32:core-2.0-noarch:core-3.0-ia32:core-3.0-noarch:core-3.1-ia32:core-3.1-noarch:core-3.2-ia32:core-3.2-noarch:core-4.0-ia32:core-4.0-noarch:core-4.1-ia32:core-4.1-noarch:security-4.0-ia32:security-4.0-noarch:security-4.1-ia32:security-4.1-noarch

antunes@lapsis:~$ lsb_release -a
LSB Version: core-2.0-ia32:core-2.0-noarch:core-3.0-ia32:core-3.0-noarch:core-3.1-ia32:core-3.1-noarch:core-3.2-ia32:core-3.2-noarch:core-4.0-ia32:core-4.0-noarch:core-4.1-ia32:core-4.1-noarch:security-4.0-ia32:security-4.0-noarch:security-4.1-ia32:security-4.1-noarch
Distributor ID: Debian
Description: Debian GNU/Linux 7.7 (wheezy)
Release: 7.7
Codename: wheezy

antunes@lapsis:~$ uname -a
Linux lapsis 3.2.0-4-686-pae #1 SMP Debian 3.2.60-1+deb7u3 i686 GNU/Linux

antunes@lapsis:~/ObspyTests$ obspy-runtests -r
Traceback (most recent call last):
File “/usr/local/bin/obspy-runtests”, line 5, in
from pkg_resources import load_entry_point
File “/usr/local/lib/python2.7/dist-packages/pkg_resources.py”, line 2707, in
working_set.require(requires)
File “/usr/local/lib/python2.7/dist-packages/pkg_resources.py”, line 686, in require
needed = self.resolve(parse_requirements(requirements))
File “/usr/local/lib/python2.7/dist-packages/pkg_resources.py”, line 584, in resolve
raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: obspy.core==0.7.1

As you can see, the obspy-runtests script gives a similar result as other scripts, with a “pkg_resources.DistributionNotFound” error…

Thank you very much for you assistance,

Best Regards,

Emanuel Antunes

Seismology Laboratory
Instituto Superior Técnico (IST) - Lisbon Technical University (UTL)

Hi Emanuel,

indeed as Petr suggested the only thing that I can imagine is going on
here is that there is an old and conflicting installation of ObsPy in
your system. The files in the Debian package for wheezy get installed in..

/usr/bin/obspy-...
/usr/lib/python2.6/dist-packages/obspy
/usr/lib/python2.7/dist-packages/obspy

(and some other less important directions)

I would recommend that you uninstall the ObsPy debian package again,
then find the other installation (e.g. "find /usr -name 'obspy*'") and
remove those files manually. Then install the debian package again.

best,
Tobias

Hello Tobias,

Well, I did a clean install and it seems that now I am able to run the shell scripts properly. I also ran the tests on ObsPy and apart from a few “Fails” it ran well, so I guess the distribution is well installed.

Thank you for your input and advice.

Best Regards,

Emanuel A.