Repository navigation
fix(install): install without pipx on Ubuntu 24.04 and Debian 12 through a private venv (OSS-69) - #55
Conversation
tests/install/run.sh runs the installer as a normal user in Ubuntu 24.04, Ubuntu 22.04, Debian 12, Fedora and python:3.12-slim images, with and without pipx, python3-venv and pip. Each scenario checks that `hydradb --version` works after a fresh install, a re-run, a forced re-run, a pinned older version and an upgrade back to the latest release. A system with only python3 must fail with install help. The Installer workflow runs every scenario on changes to the installer and once a week. `make test-install` runs them locally. On main, u24-pip and d12-pip fail with PEP 668 (externally-managed-environment), and u24-pyonly fails without help. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: adityamishra-hydradb <[email protected]>
On Debian 12 and Ubuntu 24.04 without pipx, the installer ran `pip install --user`, which pip refuses there (PEP 668). The install failed with externally-managed-environment. Without pipx, the installer now makes a virtual environment in ~/.local/share/hydradb-cli/venv and links ~/.local/bin/hydradb to it. When python3-venv is missing, it makes the venv with --without-pip and fills it with the system pip (--python, pip 22.3 or later). `pip install --user` is used only when Python allows it. When no method works, the installer stops and tells the user to install pipx. Other changes: - A re-run keeps the method of the existing install (pipx, venv or pip --user), so it upgrades in place. - An existing ~/.local/bin/hydradb that the installer did not make is not replaced unless HYDRADB_CLI_FORCE=1. - A venv made by a failed run is removed. - The script runs from main(), so a partial download does nothing. - It no longer upgrades the user's own pip. - The default repository is hydra-db/hydradb-cli. - It runs `hydradb --version` and fails if that fails. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: adityamishra-hydradb <[email protected]>
…g (OSS-69) - The README lists the three install methods in the order the installer tries them, and how a re-run behaves. - Pinning and forcing put the variable on bash, not on curl. `HYDRADB_CLI_VERSION=0.1.1 curl ... | bash` sets the variable only for curl, so the installer ignored it and installed the latest release. - The version examples use 0.2.0, which has a release. 0.2.1 has none. - Links use hydra-db/hydradb-cli. - The release-wheel example uses pipx, because `pip install` of a URL is refused on Debian 12 and Ubuntu 24.04 too. - New Uninstall section. The prerequisites no longer tell users to upgrade the system pip. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: adityamishra-hydradb <[email protected]>
When the system Python is upgraded, the venv's bin/python can point to nothing. The next run then made a new venv on top of the old one. It now passes --clear, so the old files go first. Found in self-review; checked by deleting bin/python in a container and running the installer again. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: adityamishra-hydradb <[email protected]>
- Find an existing venv by its directory and marker, not by a working bin/python, so a broken venv is rebuilt and pipx is not chosen. Remove our own broken link before pipx or pip --user write theirs. - Check the command that this run installed (the venv link, the pipx link, the pip --user script), and compare its --version output with the version that was installed. A mismatch is an error. - The PATH hint names only ~/.local/bin, the pipx bin dir or the pip user bin dir, never the venv bin dir. - pip --user does not write over an unrelated hydradb without HYDRADB_CLI_FORCE=1. - Stop when run as root, unless HYDRADB_CLI_ALLOW_ROOT=1. - Read XDG_DATA_HOME once; compare the link by real path and skip ln when it is already right; on a failed link remove the new venv and give a clean error. - Validate HYDRADB_CLI_VERSION (a leading v is removed) and print the repo and wheel URL. - No pipe into grep -q; add python3.14; no colour when not a terminal; show the venv pip output only when pip fails. - Help text per system: python3-venv or pipx on Debian/Ubuntu, brew on macOS, and how to get Python 3.10+. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: adityamishra-hydradb <[email protected]>
…SS-69) slim-upgrade made its old install with https://cli.hydradb.com/install. After this branch merges, that URL serves the new installer, so the test would fail for good. It now makes the old pip --user install directly from the 0.1.1 wheel, as the old installer did. New scenarios: broken venv then pipx (u24-venv-pipx), unrelated hydradb with the venv (u24-venv-other), with pipx (u24-pipx-other) and with pip --user (u22-pip-other), root with HYDRADB_CLI_ALLOW_ROOT=1 (slim-root), root without it (slim-root-refuse), and bash 3.2 (bash32). Every full scenario also pins with a leading v. The Installer job gets a 20-minute timeout. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: adityamishra-hydradb <[email protected]>
… (OSS-69) - Describe the order pipx, private venv, pip --user where allowed, stop with help, and what each method needs. - A stock Ubuntu 24.04 or Debian 12 desktop needs python3-venv or pipx first; say so. - Add macOS (Apple python3 is 3.9; brew, zsh PATH), Linux bash PATH, the pin with or without a leading v, and do not use sudo (HYDRADB_CLI_ALLOW_ROOT=1 for containers). - Uninstall removes only what the installer made: the venv link only if it points into the venv; pip --user with the same Python; ~/.hydradb. - Say where the method is printed, not "the last line". Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: adityamishra-hydradb <[email protected]>
- pipx: check the pipx bin dir before pipx runs. A file that pipx did not make stops the install, also on a re-run, unless HYDRADB_CLI_FORCE=1. - venv: only a directory with our marker is ours. A non-empty directory without it stops the install and is not changed. --clear runs only on a venv of ours, and a failed run removes only a directory that did not exist before it. - venv: run pip with PIP_USER=0, so pip.conf `user = true` or an exported PIP_USER=1 does not break the install. - Root: use EUID, not id. The refusal shows where the flag goes, and talks about sudo only when SUDO_USER is set. A root install that is not on PATH gets an ENV PATH hint for a Dockerfile. - An old pip --user script of hydradb-cli is named as such, with the exact uninstall command. - Try GitHub 3 times, and report a network error as a network error, not as "No wheel found". - Remove a marker that no venv is left for after a switch to pipx or pip --user. - Say what to do when the installed CLI reports another version. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: adityamishra-hydradb <[email protected]>
New scenarios: u24-venv-userdir, u24-venv-homevenv, u24-venv-pipuser, u24-venv-pipconf, u24-venv-oldpip, u24-offline (docker --network none). u24-pipx-other runs the installer twice and then with FORCE. u24-venv-pipx checks that pipx runs before "no second copy", and that a switch to pipx leaves no marker. slim-root checks the Dockerfile PATH hint. slim-root-refuse checks the container, sudo and no-id messages. bash32 checks that the shell under test is bash 3.2. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: adityamishra-hydradb <[email protected]>
…SS-69) - Show where HYDRADB_CLI_ALLOW_ROOT goes, with a Dockerfile example that also sets ENV PATH. - Uninstall: label the blocks pipx, venv and pip-user as the installer prints them; remove the installer's directory (venv and marker) for every method; cover XDG_DATA_HOME and HYDRADB_CLI_BIN_DIR; name the pip cache and pipx shared files as optional cleanup. - Pin example uses 0.2.0, the version the README documents. - CHANGELOG: root runs of the curl installer now need the flag. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: adityamishra-hydradb <[email protected]>
|
@hydra-mira-review review |
|
/devin review |
Mira score 5/5 · 🟢 Good to merge
1 more
Users on newer Ubuntu and Debian systems gain an installation path that avoids system Python restrictions. The installer adds a private virtual environment fallback, ownership checks, version verification, and root restrictions. Documentation and container tests cover the installation paths and behavior changes. Before this ships · 1 with another PR, 2 to confirm, 2 in place
How this PR works · 7 changes, 2 high risk, 5 medium riskThe curl installer fails on Ubuntu 24.04 and Debian 12 without pipx because Python rejects its pip user installation. This PR adds a private virtual environment before that fallback and prints platform-specific help when prerequisites are missing. It also protects existing files, verifies the installed version, and requires explicit permission for root installations. 1. Require explicit permission for root installations · 🟠 medium risk ·
|
- The ownership marker is now inside the venv. A marker beside it could outlive the venv and let --clear wipe a directory that the user put at the same path. A venv path that is a link is refused. - is_pipx_link accepts only a link into pipx's venv of this package. When pipx cannot print its paths (pipx 1.0.0), PIPX_BIN_DIR / PIPX_HOME and their defaults are used; if ownership still cannot be shown, the file is replaced only with HYDRADB_CLI_FORCE=1. The final pipx check uses it. - Native Windows Python keeps the pip --user method (venv paths differ). - A venv with no pip gets one from ensurepip when that is there now. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: adityamishra-hydradb <[email protected]>
- u24-venv-replaced: a replaced venv dir and a venv link are not touched; the documented uninstall keeps other files. - u24-venv-nopip: upgrade a venv with no pip after system pip is gone. - u22-pipx-link: custom PIPX_BIN_DIR on pipx 1.0.0, and an unrelated link is not replaced without HYDRADB_CLI_FORCE=1. - run.sh returns a failed image build instead of running an old image. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: adityamishra-hydradb <[email protected]>
The venv uninstall deletes the venv only when the marker is in it and rmdirs the parent only when empty; pipx and pip-user have no step for that directory. The Dockerfile line runs with pipefail. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: adityamishra-hydradb <[email protected]>
|
@hydra-mira-review review |
|
/devin review |
For humans
The problem (Linear OSS-69).
curl -fsSL https://cli.hydradb.com/install | bashfails on Ubuntu 24.04 and Debian 12 whenpipxis not installed. The installer falls back topip install --user, and these distros refuse it (PEP 668,externally-managed-environment), so it exits 1. Tested in clean containers: the live installer fails 4 of 12 scenarios.The fix. The installer now tries, in order:
pipx, if it is installed.~/.local/share/hydradb-cli/venv, linked into~/.local/bin/hydradb. No sudo needed, and it never touches the system Python.pip install --user, only where Python allows it.sudo apt install python3-venv(orpipx) on Debian/Ubuntu, Homebrew on macOS, dnf on Fedora.Safety rules (from 2 rounds of adversarial review):
hydradbor a directory it did not make, unlessHYDRADB_CLI_FORCE=1. A marker file identifies its own venv.hydradb --versionmatches the version it installed.HYDRADB_CLI_ALLOW_ROOT=1is set (for Dockerfiles and CI). This is a behaviour change; see the CHANGELOG.mainon its last line, so a cut-off download does nothing.v(HYDRADB_CLI_VERSION=v0.2.0). Network errors say "network error", not "no wheel found".Docs. README: the install order, macOS (Homebrew Python, zsh PATH), Linux PATH, pinning (
curl ... | HYDRADB_CLI_VERSION=0.2.0 bash; the old formHYDRADB_CLI_VERSION=x curl ... | bashwas silently ignored), root and Dockerfiles, and an uninstall that removes only what the installer made. The docs.hydradb.com page is a separate mintlify PR and must merge together with this one.Tests.
tests/install/runsinstall.shin clean containers (make test-install, and.github/workflows/install.ymlon PRs plus a weekly run). The result is 25 of 25 scenarios and 154 checks green. They cover Ubuntu 22.04/24.04, Debian 12, Fedora and python:3.12-slim, with and without pip, pipx and venv, plus root, bash 3.2 (macOS), broken venvs, unrelated files, pipuser = true, upgrades, pins and offline runs. Every new scenario fails on the old script and passes now. shellcheck-S styleis clean.After merge: the live
cli.hydradb.com/installserves this script frommain(GitHub Pages). The 0.2.3 release (hydradb-cli PR 54) then makes it install 0.2.3. README.md will conflict with PR 54; whichever merges second needs a merge frommain.For agents
https_enforcedon GitHub Pages (a repo admin setting).## Unreleasedsection below 0.2.2 that was already onmain; tidy it at the next release.🤖 Generated with Claude Code
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.