Hi, I'm using ```archive( name="zip", form...
# general
f
Hi, I'm using
Copy code
archive(
    name="zip",
    format="zip",
    packages=[
        ":target",
    ],
)
but I'm getting
Copy code
BinaryNotFoundError: Cannot find `zip` on `['/bin', '/opt/homebrew/bin', '/usr/bin', '/usr/local/bin']`. Please ensure that it is installed so that Pants can create `.zip` archives.
I'm on Arch Linux and the zip binary is actually in
Copy code
$ which zip
/usr/sbin/zip
How can I adapt the binary search path for the archive rule?
a
@full-author-61014 Can you once try creating symlink in one of those paths? For eg:
Copy code
ln -s $(which zip) /usr/local/bin
Then, retry.
f
Interesting, this does not help
Copy code
$ ls -l /usr/sbin
lrwxrwxrwx 1 root root 3 18. Sep 15:18 /usr/sbin -> bin
So the whole /usr/sbin is linked to /bin and the utility is actually there
Copy code
$ ls -l /usr/bin/zip
-rwxr-xr-x 1 root root 236680  6. Okt 20:44 /usr/bin/zip
Output after linking
Copy code
$ ln -s /usr/sbin/zip /usr/local/bin/zip
$ which zip
/usr/local/bin/zip
Still getting the same
BinaryNotFoundError
. What is interesting, after adding just the section
Copy code
[shell-setup]
to
pants.toml
it starts to work, even without the symlink.
c
I would assume if you make another
pants.toml
change (like removing the empty section again) with the symlink gone you’d get the error back as well. This would likely be explained by
pantsd
caching the found location of the zip binary, and possibly following the symlink, explaining why it continued working also after removing the symlink.
starting with pants 2.19, you’ll have a config section to add search paths for this: https://www.pantsbuild.org/v2.19/docs/reference-system-binaries#system_binary_paths
1
f
Yes, I stumbled already over
pantsd
caching. I commonly run
pkill -f pantsd
to restart it in the next pants run. The
system_binary_paths
solution works. I am already on
2.20.0.dev1
. Thanks for your time and insights.
👍 1
c
for restarting
pantsd
you can also
rm -rf .pids
as a potentially less invasive method.. 😉
👍 1