Skip to main content
Install, list, and manage Python packages in the Lager Box Python container.

Syntax

lager pip COMMAND [OPTIONS]

Commands

CommandDescription
installInstall packages into the Python container
listList user-installed packages
uninstallUninstall packages from the container
applyApply package changes by rebuilding container

Command Reference

install

Install Python packages persistently into the Lager Box container.
lager pip install PACKAGES... [OPTIONS]
Arguments:
  • PACKAGES - One or more package names (with optional version specifiers)
Options:
  • --box BOX - Lagerbox name or IP address
  • --yes - Skip confirmation and rebuild immediately
Examples:
# Install a single package
lager pip install numpy --box lab-lager-box --yes

# Install multiple packages
lager pip install pandas scipy matplotlib --box lab-lager-box

# Install specific versions
lager pip install 'requests==2.28.0' 'flask>=2.0' --box lab-lager-box

list

List user-installed packages on a Lager Box.
lager pip list --box BOX
Output:
User-installed packages on lab-lager-box:
  numpy==1.24.0
  pandas==2.0.0
  requests==2.28.0

uninstall

Remove packages from the Lager Box container.
lager pip uninstall PACKAGES... [OPTIONS]
Arguments:
  • PACKAGES - One or more package names to remove
Options:
  • --box BOX - Lagerbox name or IP address
  • --yes - Skip confirmation and rebuild immediately
Examples:
# Uninstall a package
lager pip uninstall old-package --box lab-lager-box --yes

# Uninstall multiple packages
lager pip uninstall pkg1 pkg2 pkg3 --box lab-lager-box

apply

Apply pending package changes by rebuilding the container.
lager pip apply --box BOX [--yes]
This is useful when you’ve installed packages without --yes and want to apply changes later.

How It Works

  1. Package Validation: Packages are validated against PyPI before installation
  2. Requirements File: Packages are added to user_requirements.txt on the Lager Box
  3. Container Rebuild: Container is rebuilt with new packages (no-cache)
  4. Persistence: Packages persist across container restarts

Version Specifiers

Standard pip version specifiers are supported:
SpecifierExampleDescription
==numpy==1.24.0Exact version
>=flask>=2.0Minimum version
<=requests<=2.28Maximum version
~=django~=4.0Compatible release
(none)pandasLatest version

Package Storage

User packages are stored at:
/home/www-data/gateway/python/docker/user_requirements.txt
This file is used during container builds to install user packages.

Deferred Rebuild

If you don’t use --yes, packages are queued for installation:
# Queue packages
lager pip install numpy pandas --box lab-gw

# Later, apply changes
lager pip apply --box lab-gw --yes

Examples

# Set up a Lager Box with data science packages
lager pip install numpy pandas scipy matplotlib seaborn --box lab-lager-box --yes

# Add a specific version
lager pip install 'scikit-learn==1.2.0' --box lab-lager-box --yes

# Check what's installed
lager pip list --box lab-lager-box

# Clean up unused packages
lager pip uninstall unused-package --box lab-lager-box --yes

Package Name Normalization

Package names are normalized to handle variations:
  • scikit-learn and scikit_learn are treated the same
  • Duplicates are automatically detected and skipped

PyPI Validation

Before installation, packages are validated:
Validating packages against PyPI...
  [OK] numpy (found)
  [OK] pandas (found)
  [FAIL] nonexistent-pkg (not found on PyPI)

Error: Some packages not found on PyPI

Notes

  • Container rebuild uses --no-cache for fresh builds
  • Rebuild can take several minutes depending on packages
  • Use lager pip list to verify installation
  • Pre-installed packages (in base image) are not shown in list
  • Container restart happens automatically after rebuild