Asking for help
See Getting Help. We would love to help!
If you are confused by something, likely someone else will run into the same issue. It is helpful for us to know what is going wrong so that we can improve Pants and improve this documentation.
Pants defaults to not displaying the full stack trace when it encounters an error. Pants also defaults to logging at the info level.
When you encounter an exception, it can help to use the global options
-ldebug, like this:
<<pantscmd>> --print-exception-stacktrace -ldebug
Once you have this stack trace, we recommend copying it into Pastebin or a GitHub Gist, then opening a GitHub issue or posting on Slack. Someone from the Pants team would be happy to help. See Getting Help.
You may encounter this error when running Pants:
$ ./pants cloc helloworld/greet ERROR: Could not initialize store for process cache: "Error making env for store at \"/Users/pantsbuild/.cache/pants/lmdb_store/processes/2\": Too many open files" (Use --print-exception-stacktrace to see more error details.)
This sometimes happens because Pants uses lots of file handles to read and write to its cache at
~/.cache/pants/lmdb_store; often, this is more than your system's default.
This can be fixed by setting
ulimit -n 10000. (10,000 should work in all cases, but feel free to lower or increase this number as desired.)
Tip: permanently configuring
We recommend permanently setting this by either:
ulimit -n 10000to your
- Using a tool like Direnv to run
ulimit -n 10000everytime the project is loaded.
ulimit -n 10000to your global
The first two approaches have the benefit that they will be checked into version control, so every developer at your organization can use the same setting.
macOS users: avoid
Contrary to the name, this will not fix the issue. You must use
It may be necessary to explicitly set the directory Pants uses as a temporary directory. For example, if the system default temporary directory is a small partition, you may exhaust that temp space.
Use the global option
local_execution_root_dir to change the tmpdir used by Pants.
[GLOBAL] local_execution_root_dir = "/mnt/large-partition/tmpdir"
On Linux, Pants uses
inotify to watch all files and directories related to any particular build. Some systems have limits configured for the maximum number of files watched. To adjust the limit on file watches, you can run:
echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
This is an error from
pip, and it means that the same 3rdparty Python requirement, with different version constraints, appears in your dependencies. You can use one of these commands to list the dependencies and find the conflicting requirements:
$ # List all targets the specified targets depend on. $ ./pants dependencies --transitive <targets> $ $ # List all files the specified targets depend on. $ ./pants filedeps --transitive <targets>
Pants may complain that it cannot find a file or directory, but the file does indeed exist.
Almost always, this error happens because of the option
pants_ignore in the
[GLOBAL] scope. By default, Pants will read your top-level
.gitignore file to populate
pants_ignore, along with ignoring
dist/ and any top-level files/directories starting with
To override something included in your
.gitignore, add a new value to
pants_ignore and prefix it with
!, like the below.
pants_ignore uses the same syntax as gitignore.
[GLOBAL] pants_ignore.add = ["!folder/"]
Alternatively, you can stop populating
pants_ignore from your
.gitignore by setting
pants_ignore_use_gitignore = false in the
1.30.x can only be run with Python 3.6-3.8, but Apple Silicon is not natively supported until version 3.9. One way to bypass this problem is to build python 3.8 under x86_64 via homebrew. You will need to create a separate
brew installation and install the
[email protected] formula.
$ arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)" $ arch -x86_64 brew install [email protected]
N.B. This will install python into
Having this on $PATH, it should be possible to run pants as arm_64.
Updated over 2 years ago