Installation

Requirements

  • Python >= 3.10

  • NumPy

  • CMake >= 3.15

  • C compiler (gcc, clang, or MSVC)

Using pip

pip install .

Using UV

UV is a fast Python package installer and resolver:

uv pip install .

Development Installation

For development, install in editable mode with development dependencies:

pip install -e ".[dev]"

Or with UV:

uv pip install -e ".[dev]"

Building from Source

  1. Clone the repository:

    git clone <repository-url>
    cd kmeans
    
  2. Build and install:

    pip install .
    

The build process will:

  1. Configure CMake

  2. Compile the C extension

  3. Build the Python wheel

  4. Install the package

Troubleshooting

CMake not found

Install CMake:

# Ubuntu/Debian
sudo apt-get install cmake

# macOS
brew install cmake

# Windows
# Download from https://cmake.org/download/

Compiler not found

Install a C compiler:

# Ubuntu/Debian
sudo apt-get install build-essential

# macOS (installs clang)
xcode-select --install

# Windows
# Install Visual Studio with C++ support