Skip to main content
Version: 2.7 (deprecated)

Installing Pants


Prerequisites

To run Pants, you need:

  • One of:
    • Linux (x86_64)
    • MacOS (Intel or Apple Silicon, 10.15 Catalina or newer)
    • Microsoft Windows 10 with WSL 2
  • Python 3.7+ discoverable on your PATH
  • Internet access (so that Pants can fully bootstrap itself)
Python 2 compatibility

Pants requires Python 3.7+ to run itself, but it can build Python 2 code (and earlier Python 3 versions, such as 3.6).

Using a proxy?

See Proxies for instructions.

System-specific notes

Linux

Some Linux distributions may need additional packages

On Ubuntu you may need to run: apt install -y python3-dev python3-distutils.

Alpine Linux is not yet supported

Pants for Linux is currently distributed as a manylinux wheel. Alpine Linux is not covered by manylinux (it uses MUSL libc while manylinux requires glibc), so at present Pants will not run on Alpine Linux.

If you need to run Pants on Alpine, let us know, so we can prioritize this work. Meanwhile, you can try building Pants yourself on Alpine.

Linux on ARM is not yet supported

Pants for Linux is currently only distributed as an x86_64 wheel.

If you need to run Pants on ARM, please comment on this issue so we can prioritize this work. Meanwhile, you can try building Pants yourself on ARM.

MacOS

Apple Silicon (M1) support

We publish a macOS arm64 wheel for Python 3.9. Make sure you have Python 3.9 discoverable on your $PATH, e.g. via Homebrew or Pyenv, and an updated version of the ./pants runner script.

Given the lack of CI infrastructure for Apple Silicon, this support is best-effort and there may a delay in publishing this wheel compared to our normal releases.

If you have Python code, you may need to set your interpreter constraints to Python 3.9+, as many tools like Black will not install correctly when using earlier Python versions.

Some users have also had success with earlier versions using Rosetta by running arch -x86_64 pants. Note that Pants's cache currently does not work properly when switching between architectures; you will need to run rm -rf ~/.cache/pants when switching.

Microsoft Windows

Windows 10 support

Pants runs on Windows 10 under the Windows Subsystem for Linux (WSL):

  • Follow these instructions to install WSL 2.
  • Install a recent Linux distribution under WSL 2 (we have tested with Ubuntu 20.04 LTS).
  • Run sudo apt install unzip python3-dev python3-distutils python3-venv gcc in the distribution.
  • You can then run Pants commands in a Linux shell, or in a Windows shell by prefixing with wsl .

Creating the launch script

Pants is invoked via a launch script named ./pants , saved at the root of the repository. This script will install Pants and handle upgrades.

First, set up a minimal pants.toml config file to instruct the script to download the latest 2.7 release:

printf '[GLOBAL]\npants_version = "2.7.2"\n' > pants.toml

Then, download the script:

curl -L -O https://static.pantsbuild.org/setup/pants && chmod +x ./pants

Now, run this to bootstrap Pants and to verify the version it installs:

./pants --version
Tip: add ./pants to version control

This will allow all users in the project to use Pants without having to install it themselves.

Building Pants from sources

We currently distribute Pants for Linux (x86_64) and MacOS.

If you need to run Pants on some other platform, such as Linux on ARM or Alpine Linux, you can try building it yourself by checking out the Pants repo, and running ./pants package src/python/pants:pants-packaged to build a wheel.

Running Pants from sources

See here for how to run Pants directly from sources, when modifying Pants itself.