Skip to content

Installation on Linux via Apt Repository

Tobias Megies edited this page Jul 20, 2023 · 27 revisions

ObsPy is currently not being packaged for Debian anymore

Unfortunately, our packaging scripts stopped working at some point and debugging the packaging process was just getting too time consuming, so for the time being, Debian packaging for ObsPy is discontinued and thus the instructions below will not install a recent version of ObsPy.

However, it is trivial to extend the system Python with obspy simply using /usr/bin/pip3 as user root. Packages installed that way go into a different directory (/usr/local/lib/python3.X/dist-packages) from the packages installed with apt (/usr/lib/python3.X/dist-packages), so this is fairly clean and any additionally installed packages can easily be removed either with pip or if need be by simply deleting them from the filesystem.

Note ⚠️ Starting with Debian 12 "bookworm" is officially discouraging this simple approach. It can still be done by passing the flag --break-system-packages (and that should still be fine, as long as obspy is strictly the only package installed and no dependencies are installed that might be present now or later via system packages) but other options are presented as well.

  • install obspy dependencies with apt, so that as much as possible is installed as system packages
# hard dependencies
root:~# apt-get install python3-pip python3-numpy python3-scipy python3-matplotlib python3-lxml python3-setuptools python3-sqlalchemy python3-decorator python3-requests
# some more optional packages
root:~# apt-get install python3-packaging python3-pyproj python3-pytest python3-geographiclib python3-cartopy python3-pyshp
  • install obspy itself with pip
root:~# /usr/bin/pip3 install obspy
# if planning to run our test suite, another package is needed (not packaged for Debian as of 2022/11
root:~# /usr/bin/pip3 install pytest-json-report

Some screenshots for illustration:

Screenshot from 2022-10-18 13-16-45 Screenshot from 2022-10-18 13-16-12 Screenshot from 2022-10-18 13-16-59



The following is OUTDATED

For installation add the ObsPy apt repository to your package manager by adding the following line to the file /etc/apt/sources.list (needs root privileges): ObsPy is packed for all Debian and Ubuntu releases which are still officially supported. Replace $CODENAME with the codename of your Debian/Ubuntu release.

deb http://deb.obspy.org $CODENAME main

For example for Debian stretch put this in your /etc/apt/sources.list file:

deb http://deb.obspy.org stretch main

Currently supported releases are (see http://deb.obspy.org/pool/main/p/python-obspy/ for the most up-to-date list of current packages):

If you are unsure about the codename of your installation you can use the following command to display it:

lsb_release -cs

Next you need to import the ObsPy gnupg key so that apt is able to check the integrity of the downloaded packages. The following command needs to be executed only once:

$ wget --quiet -O - https://raw.githubusercontent.com/obspy/obspy/master/misc/debian/public.key | sudo apt-key add -

To install ObsPy including all dependencies:

$ sudo apt-get update
$ # python3 package only available for newer Debian/Ubuntu releases
$ sudo apt-get install python-obspy python3-obspy

If you want to uninstall ObsPy and all unneeded dependencies just do:

$ sudo apt-get remove python-obspy python3-obspy

For newer Debian (starting with "jessie") and Ubuntu (starting with "trusty") releases, python3-obspy package will be available. Furthermore data and image files only needed to run ObsPy's test suites are contained in a separate package python-obspy-dbg which can be opted-out when installing with e.g. aptitude install -R python-obspy.

Notes on Raspbian

Raspbian buster (and maybe other versions as well) has some packages specifically recompiled for ARM architecture it seems. This can cause dependency resolution issues, as seen in #2530. Use aptitude and check alternative solutions offered for resolving these conflicts (downgrading custom Raspbian packages to canonical version numbers in this case).