There are two ways to install XPK:
- Via
pip(Recommended for usage) - From Source (Recommended for development)
Ensure the following tools are installed and configured before proceeding.
- Python 3.10+: Ensure
pipandvenvare included.- Check:
python3 --version
- Check:
- Google Cloud SDK (gcloud): Install from here.
- Run
gcloud init - Authenticate to Google Cloud.
- Check:
gcloud auth list - Run
gcloud auth configure-dockerto enable image uploads to the registry.
- Run
Depending on your chosen installation method, you may need these additional tools:
| Install Method | Tool | Notes |
|---|---|---|
| Source | git | Install via your package manager (e.g., sudo apt-get install git on Debian/Ubuntu) |
| Source | make | Install via your package manager (e.g., sudo apt-get install make on Debian/Ubuntu) |
To avoid conflicts with system packages (and the common "This environment is externally managed" error), we strongly recommend installing XPK in a virtual environment.
Run the following to create and activate your environment:
# 1. Create the virtual environment (one-time setup)
VENV_DIR=~/venvp3
python3 -m venv $VENV_DIR
# 2. Activate the environment
# (You must run this command every time you open a new terminal to use xpk)
source $VENV_DIR/bin/activateChoose one of the following methods.
Once your prerequisites are met and your virtual environment is active:
pip install xpkIf you need to modify the source code or use the latest unreleased features:
# 1. Clone the XPK repository
git clone https://github.com/AI-Hypercomputer/xpk.git
cd xpk
# 2. Install dependencies and build
make install
# 3. Update your PATH
export PATH=$PATH:$PWD/binNote: Installing from source is recommended only for contributors and advanced users. Most users should install via PIP for the best stability.
Persisting the PATH configuration when installing from source:
To use xpk in future terminal sessions without re-running the export command, add the binary path to your shell configuration:
-
For Bash (Linux default):
echo "export PATH=\$PATH:$PWD/bin" >> ~/.bashrc source ~/.bashrc
-
For Zsh (macOS default):
echo "export PATH=\$PATH:$PWD/bin" >> ~/.zshrc source ~/.zshrc
Run the following command to ensure XPK is correctly installed and reachable:
xpk --helpIf the installation was successful, you will see the help menu listing available commands.
To enable tab completion for XPK commands:
-
Install argcomplete:
pip install argcomplete activate-global-python-argcomplete
-
Configure XPK completion:
eval "$(register-python-argcomplete xpk)"
To get the latest version of XPK:
Via Pip:
pip install --upgrade xpkFrom Source: Navigate to your cloned directory and run:
git pull
make installIssue: command not found: xpk
- Cause: The installation directory is not in your system
$PATH. - Fix: Ensure you have activated your virtual environment. If installing from source, ensure you added the
/binfolder to your PATH as described in Section 3.
Issue: error: externally-managed-environment
- Cause: You are trying to install Python packages globally, which is restricted by newer OS versions.
- Fix: Ensure you create and activate a Virtual Environment (see Section 2: Environment Setup).