sandlock icon indicating copy to clipboard operation
sandlock copied to clipboard

Installing with pip, the command is now reported as not found

Open SuperManito opened this issue 7 months ago • 3 comments

$ pip3 install sandlock --break-system-packages
Looking in indexes: https://mirrors.aliyun.com/pypi/simple
Collecting sandlock
  Downloading https://mirrors.aliyun.com/pypi/packages/ea/43/edb389fa0714be7135d8f93ced4f31d762c1c9d8912d57651cf648d5c0a3/sandlock-0.6.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.0 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3.0/3.0 MB 21.5 MB/s eta 0:00:00
Installing collected packages: sandlock
Successfully installed sandlock-0.6.0
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager, possibly rendering your system unusable. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv. Use the --root-user-action option if you know what you are doing and want to suppress this warning.

$ sandlock
bash: sandlock: command not found

$ cat /etc/os-release 
PRETTY_NAME="Debian GNU/Linux 13 (trixie)"
NAME="Debian GNU/Linux"
VERSION_ID="13"
VERSION="13 (trixie)"
VERSION_CODENAME=trixie
DEBIAN_VERSION_FULL=13.4
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

I wanted to add sandboxing capabilities to my project running in a container environment, but I found that bubblewrap cannot be used directly because it requires adding --cap-add SYS_ADMIN. The risks involved are too great to outweigh the benefits.

SuperManito avatar Apr 25 '26 07:04 SuperManito

Thanks for the report. The sandlock PyPI package ships the Python SDK plus the sandlock-mcp script. It does not include the sandlock CLI binary. That's why pip install sandlock followed by sandlock gives "command not found." Only sandlock-mcp lands on PATH from pip.

The sandlock CLI is a Rust binary distributed through crates.io:

cargo install sandlock-cli

That installs the sandlock binary into ~/.cargo/bin/.

On the bubblewrap / --cap-add SYS_ADMIN concern: sandlock doesn't use bubblewrap. It uses Landlock + seccomp, neither of which needs SYS_ADMIN or any added capability. As long as your container's kernel is recent enough (Linux 6.12+ for full Landlock ABI v6), sandlock run ... should work inside an unprivileged container.

congwang-mk avatar Apr 26 '26 08:04 congwang-mk

Thanks for the report. The sandlock PyPI package ships the Python SDK plus the sandlock-mcp script. It does not include the sandlock CLI binary. That's why pip install sandlock followed by sandlock gives "command not found." Only sandlock-mcp lands on PATH from pip.

The sandlock CLI is a Rust binary distributed through crates.io:

cargo install sandlock-cli That installs the sandlock binary into ~/.cargo/bin/.

On the bubblewrap / --cap-add SYS_ADMIN concern: sandlock doesn't use bubblewrap. It uses Landlock + seccomp, neither of which needs SYS_ADMIN or any added capability. As long as your container's kernel is recent enough (Linux 6.12+ for full Landlock ABI v6), sandlock run ... should work inside an unprivileged container.

I don't want to incorporate a full Rust toolchain into my project. What I need is a tool that works out of the box. I found this project after seeing your reply in a Bubblewrap issue. I thought binary installation would only require Python.

Could you please provide binary installation support and ARM64 architecture support?

SuperManito avatar Apr 26 '26 09:04 SuperManito

Could you please provide binary installation support and ARM64 architecture support?

Quick clarification on the first part, then good news on the second.

Prebuilt x86_64 binaries already exist. Every tagged release attaches sandlock-x86_64-unknown-linux-gnu.tar.gz — see https://github.com/multikernel/sandlock/releases/latest. Just tar -xzf and run, no Rust toolchain needed. Sorry it wasn't more discoverable from the README.

aarch64 is landing in the next release. #30 (merged) adds aarch64-unknown-linux-gnu to the release pipeline, plus manylinux_aarch64 wheels. Once the next tag cuts, you'll get both:

  • sandlock-aarch64-unknown-linux-gnu.tar.gz on GitHub Releases
  • pip install sandlock working on aarch64 hosts (currently x86_64-only on PyPI)

For the record on what each install path delivers — these are deliberately separate:

Path What you get
pip install sandlock Python SDK + sandlock-mcp MCP server
GitHub Releases tarball sandlock CLI binary + libsandlock_ffi.so
cargo install sandlock-cli sandlock CLI binary, built from source

The Python wheel intentionally doesn't ship the sandlock CLI — the SDK and the CLI have different audiences. If you only need the CLI in your container, the Releases tarball is what you want; no Python required.

congwang-mk avatar May 01 '26 04:05 congwang-mk