HomeDocs
DocsCommunityTestimonialsUsersGitHubTwitterBlogJobsTermsPrivacyCookies
TermsPrivacyCookies

Installing Pants

Prerequisites

To run Pants, you need:

  • Linux or macOS.
  • Python 3.6+ discoverable on your PATH.
  • Internet access (so that Pants can fully bootstrap itself).

๐Ÿ“˜

Python 2 compatibility

Pants requires Python 3.6+ to run itself, but it can build Python 2 code.

๐Ÿšง

Issues discovering your Python interpreter?

You likely have a non-standard Python installation. Pants expects to find both python and one of python3.6, python3.7, or python3.8 on your PATH. Ensure that you have these binaries installed by running which python and which python3.6 (or equivalent).

We've found pyenv to be a useful tool for installing specific Python versions in a uniform manner.

Creating the launch script

Pants is invoked via a launch script named <<pantscmd>> , saved at the root of the repository.

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

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

Then, download the script:

curl -L -o <<pantscmd>> https://pantsbuild.github.io/setup/pants && \
chmod +x <<pantscmd>>

๐Ÿšง

Some Linux distributions may need additional packages

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

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

<<pantscmd>> --version

๐Ÿšง

"Too many open files" error?

See Troubleshooting for how to fix this. (We're working on a long-term fix this.)

๐Ÿ“˜

Tip: add <<pantscmd>> to version control

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