Install — PETSc 3.21.4 documentation

Skip to main content
`Ctrl`+`K`

# Install

Note

PETSc is available from multiple package managers. Depending on your exact needs (for example limited use of external packages) they are possibly the easiest way for you to install PETSc. Always verify that the package manager is providing a recent enough release of PETSc with support for the external packages you need. Some package managers provide separate packages for the complex number installation of PETSc.

- Archlinux https://aur.archlinux.org/packages/petsc

- Conda: https://anaconda.org/conda-forge/petsc

    `conda install -c conda-forge petsc`

- Debian: https://packages.debian.org/petsc-dev

    `sudo apt install petsc-dev`

- Fedora: https://packages.fedoraproject.org/pkgs/petsc/petsc

    `sudo yum install petsc-mpich-devel`

- Homebrew: https://formulae.brew.sh/formula/petsc

    `brew install petsc`

- MacPorts: https://ports.macports.org/port/petsc

    `sudo port install petsc`

- MSYS2 (Windows) https://packages.msys2.org/package/mingw-w64-x86_64-petsc

- openSUSE https://software.opensuse.org/package/petsc

- Python: https://pypi.org/project/petsc

    `python -m pip install mpi4py petsc petsc4py`

- Slackware: https://slackbuilds.org/repository/15.0/academic/petsc/?search=petsc

- Spack: https://spack.io

    - debug install - `spack install petsc +debug`

    - optimized install -`spack install petsc cflags='-g -O3 -march=native -mtune=native' fflags='-g -O3 -march=native -mtune=native' cxxflags='-g -O3 -march=native -mtune=native'`

    - install with some external packages - `spack install petsc +superlu-dist +metis +hypre +hdf5`

    - list available variants (configurations) - `spack info petsc`

- Ubuntu: https://packages.ubuntu.com/petsc-dev

    `sudo apt install petsc-dev`

Information and tutorials on setting up a PETSc installation.

- Download
  - Recommended: Obtain Release Version With Git
  - Alternative: Obtain Release Version with Tarball
  - Advanced: Obtain PETSc Development Version With Git
  - Release Schedule
- Quick Start Tutorial
  - QQTW (Quickest Quick-start in The West)
  - Prerequisites
  - Downloading Source
  - Configuration
  - Compilation
  - Congratulations!
- Configuring PETSc
  - Common Example Usages
  - Compilers
  - External Packages
  - BLAS/LAPACK
  - MPI
  - Installing On macOS
  - Installation Location: In-place or Out-of-place
  - Installing On Machine Requiring Cross Compiler Or A Job Scheduler
  - Installing With TAU Instrumentation Package
  - Installing PETSc To Use GPUs And Accelerators
  - Installing To Run in Browser with Emscripten
  - Installing On Large Scale DOE Systems
- Installing PETSc On Microsoft Windows
  - Linux on Microsoft Windows
  - Cygwin/GNU Compilers on Microsoft Windows
  - Native Microsoft/Intel Windows Compilers
  - MSYS2/MinGW (GNU) Compilers on Microsoft Windows
- Maintaining Your PETSc Installation(s)
  - Environmental Variables `$PETSC_DIR` And `$PETSC_ARCH`
  - Configure Caching
  - Reconfigure
  - Updating or Reinstalling PETSc
- Supported External Software
  - Partial List Of Software
  - Additional Software
- License
  - 2-clause BSD license
  - Contributing License Agreement
  - Legacy License