Skip to content

docs(custom-packages): warn against pip --user installs (image shadowing) - #11

Merged
Tianhao-Gu merged 1 commit into
mainfrom
docs/warn-against-pip-user-install
Jul 16, 2026
Merged

docs(custom-packages): warn against pip --user installs (image shadowing)#11
Tianhao-Gu merged 1 commit into
mainfrom
docs/warn-against-pip-user-install

Conversation

@Tianhao-Gu

Copy link
Copy Markdown
Contributor

Why

A BERDL user's JupyterLab file-browser folder tree stopped rendering (favorites broken, object-store folders 404). Root cause was not the favorites file — it was a pip install --user package in their persistent ~/.local (google-cloud-storage 3.4.1, missing the .asyncio submodule the image's gcsfs needs) that shadowed the base image, so jupyter_server_config.py failed to register the lakehouse_minio S3 contents manager at startup. Because ~/.local is on the persistent home, it survived restarts.

The custom-packages guide's venv approach is correct and structurally avoids this — but it never warned users off the trap they actually hit: running pip install without activating the venv, which silently falls back to a --user install (Defaulting to user installation because normal site-packages is not writeable).

Change

  • Step 5: warning box — always activate the venv before pip install, never pip install --user, and stop if you see the "Defaulting to user installation" message.
  • Troubleshooting: new "A pip user-install broke my environment" entry — symptoms (tree won't render / S3 404 / survives restarts), detection (ls ~/.local/... + the PYTHONPATH=~/.local... import gcsfs reproduction), and fix (pip uninstall --user + Stop/Start).

No changes to the recommended workflow itself — just guardrails around the known failure mode.

…ing)

A pip install run without activating a venv silently falls back to a
--user install into ~/.local, which shadows the base image for the whole
single-user server. Observed in prod (2026-07-16): a user-site
google-cloud-storage lacking the .asyncio submodule the image's gcsfs needs
broke the S3 contents manager registration -> file-browser folder tree
would not render, object-store folders 404'd; it survived restarts.

- Step 5: warning box to always activate the venv first, never pip --user,
  and to watch for the 'Defaulting to user installation' pip message.
- Troubleshooting: new 'A pip user-install broke my environment' entry with
  detection (ls ~/.local + PYTHONPATH reproduction) and fix (uninstall + restart).
Copilot AI review requested due to automatic review settings July 16, 2026 17:17
@Tianhao-Gu
Tianhao-Gu merged commit b483c68 into main Jul 16, 2026
1 check passed
@Tianhao-Gu
Tianhao-Gu deleted the docs/warn-against-pip-user-install branch July 16, 2026 17:18

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR strengthens the custom packages user guide by adding explicit guardrails against accidentally doing pip install outside an activated venv (which can default to a persistent ~/.local user-site install that shadows the base image and can break JupyterLab server behavior across restarts).

Changes:

  • Adds a prominent Step 5 warning to ensure the venv is activated before installing packages and to stop if pip reports “Defaulting to user installation…”.
  • Adds a new troubleshooting entry describing symptoms, how to detect ~/.local shadowing, and how to recover.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +63 to +64
> Fix: `pip uninstall --user <package>`, then reinstall inside your activated venv
> (see [Troubleshooting](#a-pip-user-install-broke-my-environment)).
Comment on lines +254 to +258
2. Uninstall the offending user-site package(s) so the base-image version is used
again (e.g. if you installed `google-cloud-storage`):
```bash
pip uninstall -y google-cloud-storage
```
To confirm the shadow is gone (this reproduces the failure a fresh server hits,
so it should now succeed):
```bash
PYTHONPATH="$(echo ~/.local/lib/python*/site-packages)" python -c "import gcsfs; print('OK')"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants