|
| 1 | +--- |
| 2 | +id: installation |
| 3 | +title: Installation |
| 4 | +sidebar_label: Installation |
| 5 | +--- |
| 6 | + |
| 7 | +# Installation |
| 8 | + |
| 9 | +This guide covers installing ContextPilot and its dependencies. |
| 10 | + |
| 11 | +## Requirements |
| 12 | + |
| 13 | +- Python >= 3.10 |
| 14 | +- CUDA 12.x (for GPU-accelerated distance computation) |
| 15 | +- An inference engine: [SGLang](https://github.com/sgl-project/sglang), [vLLM](https://github.com/vllm-project/vllm), or any OpenAI-compatible server |
| 16 | + |
| 17 | +## Install ContextPilot |
| 18 | + |
| 19 | +```bash |
| 20 | +pip install contextpilot |
| 21 | +``` |
| 22 | + |
| 23 | +Or from source (development): |
| 24 | +```bash |
| 25 | +git clone https://github.com/EfficientContext/ContextPilot.git |
| 26 | +cd ContextPilot |
| 27 | +pip install -e . |
| 28 | +python -m contextpilot.install_hook # one-time: enables automatic SGLang + vLLM hooks |
| 29 | +``` |
| 30 | + |
| 31 | +This installs the core dependencies: |
| 32 | + |
| 33 | +| Package | Purpose | |
| 34 | +|---------|--------| |
| 35 | +| `fastapi[all]` | HTTP server | |
| 36 | +| `aiohttp` | Async inference engine proxy | |
| 37 | +| `scipy` | Hierarchical clustering | |
| 38 | +| `transformers` | Tokenizer / chat templates | |
| 39 | +| `cupy-cuda12x` | GPU distance computation | |
| 40 | +| `elasticsearch` | BM25 retriever (optional) | |
| 41 | +| `datasets` | Loading benchmark datasets | |
| 42 | + |
| 43 | +## Install an Inference Engine |
| 44 | + |
| 45 | +**SGLang:** |
| 46 | +```bash |
| 47 | +pip install "sglang>=0.5" |
| 48 | +``` |
| 49 | + |
| 50 | +**vLLM:** |
| 51 | +```bash |
| 52 | +pip install vllm |
| 53 | +``` |
| 54 | + |
| 55 | +Both engines are supported via zero-patch runtime hooks — just set `CONTEXTPILOT_INDEX_URL` when launching. See [Online Usage Guide](../guides/online_usage#inference-engine-integration). |
| 56 | + |
| 57 | +## Distributed Setup |
| 58 | + |
| 59 | +If the ContextPilot index server and the inference engine run in **separate Python environments** (e.g., different virtualenvs or containers), the engine environment won't have the `contextpilot` package. Use the standalone hook instead: |
| 60 | + |
| 61 | +```bash |
| 62 | +# In the engine's Python environment (one command, no clone needed): |
| 63 | +pip install requests |
| 64 | +curl -sL https://raw.githubusercontent.com/EfficientContext/ContextPilot/main/contextpilot/install_standalone.py | python - |
| 65 | +``` |
| 66 | + |
| 67 | +The installer downloads the hook from GitHub and installs it into site-packages. No `contextpilot` clone or install needed — just `requests` as a runtime dependency. |
| 68 | + |
| 69 | +## Verify Installation |
| 70 | + |
| 71 | +```bash |
| 72 | +python -c "import contextpilot; print('ContextPilot', contextpilot.__version__)" |
| 73 | +``` |
0 commit comments