Setup Guides
This guide will help you set up a development environment for cz-benchmarks on macOS, Linux, or Windows.
Prerequisites
Install Python and a Tool for Environment/Dependency Management
Make sure you have Python 3.10+ installed.
There are several tools you can use for managing Python environments and dependencies:uv(described below)
Choose the tool you prefer and make sure it is installed.
Install Build Tools and Python Headers
Some dependencies require C/C++ compilers and Python headers.macOS: Install Xcode Command Line Tools:
xcode-select --installLinux (Debian/Ubuntu): Install compilers and Python dev headers:
sudo apt-get update sudo apt-get install build-essential python3-dev
Windows: Install Build Tools for Visual Studio (select “C++ build tools” during installation).
Setting Up the Environment
Create a Virtual Environment
Using a virtual environment is strongly recommended to isolate dependencies.
Example usingvenv:python -m venv venv
Activate the environment:
macOS/Linux:
source venv/bin/activate
Windows:
venv\Scripts\activate
Install Dependencies
Install the required Python packages in editable mode with development dependencies:pip install -e ".[dev]"
Note: On some systems (especially macOS and Linux), you may need to ensure system C/C++ build tools and Python header files are present before installing dependencies such as
hnswlib(see above).
Using uv for Dependency Management
uv is an alternative tool that simplifies Python dependency management.
Install
uv
You can usepipto installuv:pip install uv
Install the Required Python Version (Optional)
If your Python version doesn’t match the project requirements,uvcan help install/manage it:uv python install
Sync Dependencies
To install all project dependencies, including optional “extras”:uv sync --all-extras
Troubleshooting
hnswlibInstallationsIf you encounter an error involving
Python.h(e.g.,fatal error: Python.h: No such file or directory), make sure Python development headers and static libraries are installed:Linux (Debian/Ubuntu):
sudo apt-get install python3-dev
macOS: Ensure Xcode Command Line Tools are installed (
xcode-select --install).Windows: Ensure Visual Studio C++ Build Tools are present.
💡 Tip: For more details, see the official
uvinstallation guide.