Installation under Linux¶
This page describes the most common ways to install Pyrocko under Linux. Pick the one that fits your situation:
Your situation |
Way to install |
|---|---|
Debian or Ubuntu |
|
Any distribution (recommended) |
|
No suitable system packages,
or no permission to install them
|
|
Working on Pyrocko itself,
or need a special branch
|
|
Conda user |
Recommended: pip in a virtual environment, prerequisites from the system¶
On any Linux distribution, Pyrocko can be installed with pip into a virtual environment (a directory with its own set of Python packages), while all its prerequisites come from the distribution’s own packages. This way, pip doesn’t interfere with the packages of your system, and the system’s packages for NumPy, Qt, etc. are used, which are well integrated with the rest of your system.
Step 1: Prerequisites¶
Install the prerequisites with your system’s package manager:
sudo apt install python3-venv python3-numpy python3-scipy \
python3-matplotlib python3-yaml python3-requests python3-jinja2 \
python3-tornado python3-pyqt5 python3-pyqt5.qtopengl \
python3-pyqt5.qtsvg python3-pyqt5.qtwebengine python3-vtk9
sudo dnf install python3-numpy python3-scipy python3-matplotlib \
python3-matplotlib-qt5 python3-pyyaml python3-requests \
python3-jinja2 python3-tornado python3-qt5 python3-qt5-webengine \
python3-vtk
sudo zypper install python3-numpy python3-scipy python3-matplotlib \
python3-matplotlib-qt5 python3-PyYAML python3-requests \
python3-Jinja2 python3-tornado python3-qt5 python3-PyQtWebEngine \
python3-vtk
sudo pacman -S --needed python-numpy python-scipy python-matplotlib \
python-yaml python-requests python-jinja python-tornado \
python-pyqt5 vtk
Step 2: Virtual environment and Pyrocko¶
Create the virtual environment, with access to the system’s packages, and install Pyrocko into it:
python3 -m venv --system-site-packages ~/venv/pyrocko
source ~/venv/pyrocko/bin/activate
pip install pyrocko
source ~/venv/pyrocko/bin/activate activates the virtual environment in
the current terminal: python3, pip and Pyrocko’s applications (e.g.
snuffler, squirrel) then refer to the virtual environment. Run it in
every new terminal in which you want to use Pyrocko. Alternatively, you can
start the applications without activating, e.g. ~/venv/pyrocko/bin/snuffler.
To update Pyrocko, activate the virtual environment and run
pip install --upgrade pyrocko.To remove it, simply delete the directory
~/venv/pyrocko.If pip starts to download NumPy, SciPy, PyQt5 or other prerequisites, one of them is missing on your system. Stop pip (Ctrl-C), install the missing package with your system’s package manager (Step 1) and run pip again.
If no prebuilt pip package of Pyrocko exists for your Python version (e.g. for very new Python versions), pip builds Pyrocko from source. This needs a C compiler and the Python headers, e.g. on Fedora:
sudo dnf install gcc make patch python3-devel.
Alternative: pip in an isolated virtual environment¶
If suitable system packages for the prerequisites are not available, e.g. on an older distribution or on a system where you cannot install packages, pip can install all prerequisites into the virtual environment as well. The virtual environment is then isolated: it doesn’t use any of the system’s Python packages, only the Python interpreter itself.
python3 -m venv ~/venv/pyrocko
source ~/venv/pyrocko/bin/activate
pip install "pyrocko[gui]"
The [gui] part also installs the prerequisites of the GUI applications
(PyQt5 and VTK); leave it out if you don’t need them. On Debian and Ubuntu, the
venv module needs the package python3-venv.
Activating, updating and removing work as described above. Compared to the
recommended way, the isolated virtual environment needs more disk space, you
have to update the prerequisites yourself (pip install --upgrade ...), and
the GUI libraries from pip may integrate less well with the desktop than the
system’s.
Installation from source, for development¶
To work on Pyrocko itself, or to use a specific branch, install it from
source. The first three variants use
Pyrocko’s install.py helper, which can also install the prerequisites with
your system’s package manager. The last one installs a branch directly with
pip.
System-wide¶
cd ~/src/ # or wherever you keep your source packages
git clone https://git.pyrocko.org/pyrocko/pyrocko.git pyrocko
cd pyrocko
python install.py deps system # installs prerequisites using apt/yum/pacman
python install.py system # installs Pyrocko with pip, but uses system deps
Into a virtual environment, prerequisites from pip¶
cd ~/src/ # or wherever you keep your source packages
git clone https://git.pyrocko.org/pyrocko/pyrocko.git pyrocko
cd pyrocko
python -m venv myenv
source myenv/bin/activate
pip install . # pip auto-resolves prerequisites (!)
pip install --only-binary :all: PyQt5 PyQtWebEngine # for Snuffler
Into a virtual environment, prerequisites from the system¶
cd ~/src/ # or wherever you keep your source packages
git clone https://git.pyrocko.org/pyrocko/pyrocko.git pyrocko
cd pyrocko
python -m venv --system-site-packages myenv
source myenv/bin/activate
python install.py deps system # installs prerequisites using apt/yum/pacman
python install.py user # installs Pyrocko with pip, but uses system deps
Directly from the repository with pip, without cloning¶
To try out a specific branch (or tag, or commit) without keeping a source checkout, pip can fetch and build it directly from the Git repository. Set up the prerequisites and the virtual environment as described in Recommended: pip in a virtual environment, prerequisites from the system, then, with the virtual environment activated:
pip install "git+https://git.pyrocko.org/pyrocko/pyrocko.git@BRANCH"
Replace BRANCH with the name of the branch, e.g. main. This needs
git, a C compiler and the Python headers (e.g. on Debian/Ubuntu: sudo apt
install git gcc python3-dev). To pick up new commits on the branch later, run
the command again with --force-reinstall --no-deps added.
Distribution specific details and prerequisite package lists¶
For instructions on how to install Pyrocko on other systems or if the installation with any of the above procedures fails, see System specific installation instructions or Detailed installation instructions.