Installation Guide¶
This guide covers detailed installation instructions for ByzPy, including system requirements, optional dependencies, and troubleshooting.
System Requirements¶
Minimum Requirements¶
Python: 3.9 or higher
Operating System: Linux, macOS, or Windows
Memory: 4GB RAM minimum (8GB+ recommended)
Disk Space: ~500MB for installation
Optional Requirements¶
CUDA: For GPU support (CUDA 11.8+ recommended)
UCX: For high-speed GPU cluster communication
Network: For distributed training across machines
Installation Methods¶
PyPI Installation (Recommended)¶
The simplest way to install ByzPy:
pip install byzpy
This installs the core package with CPU support.
Installation with GPU Support¶
To enable GPU operations, install with the gpu extra:
pip install "byzpy[gpu]"
This installs:
cupy-cuda12x: For GPU array operationsucxx-cu12: For UCX-based GPU communication
Note: GPU extras require CUDA to be installed on your system. The package will work without CUDA, but GPU features will be unavailable.
Installation with Development Dependencies¶
For development and testing:
pip install "byzpy[dev]"
This installs:
pytest: Testing frameworkpytest-asyncio: Async test supportpytest-cov: Coverage reporting
Installation with All Extras¶
pip install "byzpy[gpu,dev]"
Installation from Source¶
Prerequisites¶
Git
Python 3.9+
pip
(Optional) CUDA toolkit for GPU support
Steps¶
Clone the repository:
git clone https://github.com/Byzpy/byzpy.git
cd byzpy
Create a virtual environment (recommended):
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
Install in development mode:
pip install -e python[dev]
(Optional) Install GPU extras:
pip install -e python[gpu]
Verifying Installation¶
Check Version¶
byzpy version
This should display the installed version number.
Run Diagnostics¶
byzpy doctor
This checks:
Python version and platform
PyTorch installation and CUDA availability
CuPy availability (for GPU operations)
UCX availability (for GPU communication)
For JSON output:
byzpy doctor --format json
Test Installation¶
Run a simple test:
import byzpy
from byzpy.aggregators.coordinate_wise.median import CoordinateWiseMedian
import torch
aggregator = CoordinateWiseMedian()
gradients = [torch.randn(100) for _ in range(5)]
result = aggregator.aggregate(gradients)
print(f"Success! Aggregated gradient shape: {result.shape}")
GPU Setup¶
CUDA Installation¶
Install CUDA toolkit (11.8 or later recommended)
Verify CUDA installation:
nvcc --version
nvidia-smi
Install PyTorch with CUDA support (if not already installed):
pip install torch torchvision --index-url https://download.pytorch.org/whl/cu118
Install ByzPy GPU extras:
pip install "byzpy[gpu]"
UCX Setup (Optional)¶
UCX enables high-speed communication for GPU clusters:
Install UCX library (system package manager or conda)
Install UCX Python bindings:
pip install ucxx-cu12
Verify UCX:
from byzpy.engine.actor.backends.gpu import have_ucx
print(f"UCX available: {have_ucx()}")
Environment Variables¶
ByzPy respects the following environment variables:
CUDA_VISIBLE_DEVICES: Control which GPUs are visibleOMP_NUM_THREADS: Number of OpenMP threads for CPU operationsTORCH_NUM_THREADS: Number of PyTorch threads
Troubleshooting¶
Import Errors¶
If you see import errors, ensure ByzPy is installed:
pip show byzpy
If not installed, reinstall:
pip install byzpy
CUDA Not Found¶
If GPU features don’t work:
Check CUDA installation:
nvcc --versionCheck PyTorch CUDA:
python -c "import torch; print(torch.cuda.is_available())"Verify GPU extras:
pip list | grep cupy
UCX Issues¶
If UCX communication fails:
Verify UCX library is installed:
ucx_info -vCheck Python bindings:
python -c "import ucxx; print(ucxx.__version__)"Ensure UCX version matches CUDA version
Permission Errors¶
If you see permission errors during installation:
Use
pip install --user byzpyfor user installationOr use a virtual environment (recommended)
Version Conflicts¶
If you have dependency conflicts:
Create a fresh virtual environment
Install ByzPy first:
pip install byzpyThen install other packages
Upgrading¶
To upgrade to the latest version:
pip install --upgrade byzpy
To upgrade from source:
cd byzpy
git pull
pip install -e python[dev] --upgrade
Uninstallation¶
To remove ByzPy:
pip uninstall byzpy
This removes the package but not its dependencies (PyTorch, NumPy, etc.). To remove all dependencies, you may need to manually uninstall them.
Next Steps¶
After installation:
Read the Getting Started Guide
Explore the Architecture Overview
Check out the Examples
Review the API Reference