Hi, I am trying to marry pants to <Devbox>. Howeve...
# general
b
Hi, I am trying to marry pants to Devbox. However pants is unhappy with the binaries on the path being symlinks to the actual binary location. From a cursory search I grasped that handling of symlinks had issues and also changed at some point, but could not find a definite source on whether and how this is supposed to work.
Copy code
15:15:58.03 [ERROR] 1 Exception encountered:

Engine traceback:
  in root
    ..
  in pants.core.goals.package.package_asset
    `package` goal
Traceback (most recent call last):
[... shortened for brevity ...]
"/home/user/.cache/nce/ab1acf935c4cc43338c604ae7d0f6aa2419f2415d94eb9cae381601dbba70a61/bindings/venvs/2.22.0/lib/python3.9/site-packages/pants/backend/docker/util_rules/docker_binary.py", line 162, in get_docker
    if not first_path:
  File "/home/user/.cache/nce/ab1acf935c4cc43338c604ae7d0f6aa2419f2415d94eb9cae381601dbba70a61/bindings/venvs/2.22.0/lib/python3.9/site-packages/pants/core/util_rules/system_binaries.py", line 176, in first_path_or_raise
    raise BinaryNotFoundError.from_request(request, rationale=rationale)
pants.core.util_rules.system_binaries.BinaryNotFoundError: Cannot find `docker` on `['/home/user/.nix-profile/bin', '/home/user/VCS/project/.devbox/bin', '/home/user/VCS/project/.devbox/nix/profile/default/bin', '/home/user/VCS/project/.devbox/virtenv/runx/bin', '/nix/store/0b9bsznqs6pdg42dxcwvrlmarjn2p6a1-gcc-12.3.0/bin', 
[... shortened again ...]
]`. Please ensure that it is installed so that Pants can interact with the docker daemon.
Symlink to docker actually is on the path:
Copy code
ls -l /home/user/VCS/project/.devbox/nix/profile/default/bin/docker
lrwxrwxrwx 1 axccu axccu 68  1. Jan 1970  /home/user/VCS/project/.devbox/nix/profile/default/bin/docker -> /nix/store/szw73hrv059aqj6prdvqq5h7gdliasd2-docker-27.2.0/bin/docker*
Any chance to make this work?
b
Heya, sorry for the trouble. I think the best way to debug this might be to look at how Pants is searching for the binary and working out what that involves/what's failing. One way to do that is to look at the sandboxes: https://www.pantsbuild.org/stable/docs/using-pants/troubleshooting-common-issues#debug-tip-inspect-the-sandbox-with---keep-sandboxes
b
Thanks. I think it fixed itself when pantsd restarted. Is negative caching of binaries expected to happen in pantsd? If not, I will try to reproduce.
b
ah, good catch. yeah, I think that's it. Reference: • the search caching calls `executable_search_path_cache_scope`: https://github.com/pantsbuild/pants/blob/06d4884f0a67f8901a667f7f3c8af0e1799fa605/src/python/pants/core/util_rules/system_binaries.py#L782 • for a local environment with
cache_failures=True
like that, this returns `ProcessCacheScope.PER_RESTART_ALWAYS`: https://github.com/pantsbuild/pants/blob/06d4884f0a67f8901a667f7f3c8af0e1799fa605/src/python/pants/core/util_rules/environments.py#L567 • which indeed is per-pantsd restart: https://github.com/pantsbuild/pants/blob/06d4884f0a67f8901a667f7f3c8af0e1799fa605/src/python/pants/engine/process.py#L38-L40
b
Thanks for the confirmation. Do you know whether this is documented anywhere? I cannot remember reading about it. Would this be a good place to mention it? https://www.pantsbuild.org/stable/docs/using-pants/troubleshooting-common-issues
h
That would be a great place to mention it, if you don’t mind sending a PR? That doc is in
docs/docs/using-pants/troubleshooting-common-issues.mdx
in the main Pants repo at https://github.com/pantsbuild/pants
b
Sure, will put it on my list.