Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Environment:Kserve Kserve Python Runtime

From Leeroopedia
Knowledge Sources
Domains Runtime, Model Serving
Last Updated 2026-02-13 00:00 GMT

Overview

Python >= 3.10 runtime environment required by KServe Python SDK, explainer samples, transformer samples, and model packaging code.

Description

The KServe Python SDK and its sample code (explainers, transformers, custom model servers) require a Python runtime environment. The SDK supports Python 3.10 through 3.12, with dependencies on FastAPI, uvicorn, grpcio, numpy, and other scientific computing libraries. Sample code such as AlibiExplainer, AnchorImages/Tabular/Text explainers, Kafka image transformer, PaddlePaddle preprocessor, and custom model servers (DenseNet161, MNIST CNN) all run within this environment.

Usage

Use this environment for Python-based KServe components including custom explainers, transformers, model servers, and any code using the `kserve` Python SDK.

System Requirements

Category Requirement Notes
Python >= 3.10, < 3.13 From kserve pyproject.toml
pip >= 21.0 For modern dependency resolution
OS Linux (x86_64 or aarch64) Container images are Linux-based

Dependencies

Core Python Packages

  • `kserve` == 0.16.0
  • `numpy` >= 1.26.0, < 3.0.0
  • `grpcio` >= 1.64.1, < 2.0.0
  • `fastapi` >= 0.115.3
  • `uvicorn[standard]` >= 0.30.6, < 1.0.0
  • `httpx` >= 0.27.2, < 1.0.0
  • `pydantic` >= 2.5.0, < 3.0.0
  • `protobuf` >= 5.27.1, < 6.0.0

Explainer-Specific

  • `alibi` (for AnchorTabular, AnchorImages, AnchorText)
  • `nest-asyncio` (for bridging sync Alibi with async KServe)
  • `aif360` (for AI Fairness model explainability)

Transformer-Specific

  • `kafka-python` (for Kafka image transformer)
  • `boto3` >= 1.29.0 (for S3 image access)
  • `Pillow` (for image preprocessing)
  • `paddlepaddle` (for Paddle image preprocessor)

Quick Install

# Install the KServe Python SDK
pip install kserve==0.16.0

# For explainer development
pip install kserve[storage]==0.16.0 alibi nest-asyncio

# For transformer development
pip install kserve[storage]==0.16.0 kafka-python boto3 Pillow

Code Evidence

Python version requirement from `python/kserve/pyproject.toml`:

[project]
name = "kserve"
requires-python = ">=3.10,<3.13"

Common Errors

Error Message Cause Solution
`ModuleNotFoundError: No module named 'kserve'` kserve SDK not installed `pip install kserve==0.16.0`
`Python version X.X not supported` Python < 3.10 or >= 3.13 Use Python 3.10, 3.11, or 3.12
`ImportError: alibi` Alibi not installed for explainer `pip install alibi`

Compatibility Notes

  • Container images: KServe provides pre-built images with Python environment included
  • Local development: Use virtual environment or conda for isolation
  • GPU support: For vLLM-based inference, use the separate Environment:Kserve_Kserve_VLLM_Runtime environment

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment