Skip to content

Commit 08f3390

Browse files
Dirk Petersenclaude
andcommitted
fix: improve install.sh to work in virtual environments
Fixed pipx installation to handle both system Python and virtual environments properly. Changes: - Skip pipx installation entirely when LOCAL_INSTALL=true (uses pip directly for editable installs) - Add fallback chain for pipx installation: 1. Try --user flag (system install) 2. Try --user --break-system-packages (newer pip) 3. Try without --user (works in venv) - Better error handling with warnings instead of hard failures - Clearer status messages showing installation method and version Now supports all scenarios: - System Python installation - Virtual environment with LOCAL_INSTALL=true - Virtual environment for regular PyPI install - CI/CD environments Fixes issue where install.sh would fail in fresh virtual environments with "No module named pipx" error. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 7d312c3 commit 08f3390

File tree

1 file changed

+21
-5
lines changed

1 file changed

+21
-5
lines changed

install.sh

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -301,19 +301,35 @@ backup_old_installation() {
301301

302302
install_pipx() {
303303

304+
# Skip pipx installation for LOCAL_INSTALL since we use pip directly
305+
if [ "$LOCAL_INSTALL" = "true" ]; then
306+
echo -e "\nSkipping pipx (using pip for local development install)..."
307+
return 0
308+
fi
309+
304310
echo -e "\nInstalling pipx..."
305311

306-
python3 -m pip install --user pipx 2>&1 | redirect_output || python3 -m pip install --user --break-system-packages pipx 2>&1 | redirect_output
312+
# Try installing pipx - handle both regular and virtual environments
313+
if python3 -m pip install --user pipx 2>&1 | redirect_output; then
314+
: # Success with --user flag
315+
elif python3 -m pip install --user --break-system-packages pipx 2>&1 | redirect_output; then
316+
: # Success with --break-system-packages flag
317+
elif python3 -m pip install pipx 2>&1 | redirect_output; then
318+
: # Success without --user flag (works in venv)
319+
else
320+
echo "...pipx installation failed"
321+
return 1
322+
fi
307323

308-
# ensure path for pipx
324+
# Verify pipx is working
309325
pipx_version=$(python3 -m pipx --version 2> /dev/null)
310326
if [[ $pipx_version =~ $version_regex ]]; then
311327
python3 -m pipx ensurepath 2>&1 | redirect_output
312-
echo "...pipx installed"
328+
echo "...pipx installed (version $pipx_version)"
313329
else
314-
echo "...pipx ensurepath failed"
330+
echo "...warning: could not verify pipx version, continuing anyway"
315331
fi
316-
332+
317333
}
318334

319335
install_froster() {

0 commit comments

Comments
 (0)