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 ofpython3.6
,python3.7
, orpython3.8
on yourPATH
. Ensure that you have these binaries installed by runningwhich python
andwhich 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 controlThis will allow all users in the project to use Pants without having to install it themselves.
Updated about 3 years ago