Installation
:::warning Apple Silicon required VeloxQuant-MLX uses Metal GPU kernels compiled at runtime. It requires macOS on an Apple M-series chip (M1 or later). Intel Macs and Linux are not supported. :::
Requirements
| Requirement | Version |
|---|---|
| macOS | 13 Ventura or later |
| Apple Silicon | M1, M2, M3, M4 (any tier) |
| Python | 3.11 or 3.12 |
| MLX | ≥ 0.18 |
| NumPy | ≥ 1.26 |
Install from PyPI
pip install veloxquant-mlx
This installs the library and its runtime dependencies (MLX, NumPy, psutil).
Install from source
Use this if you want the latest development version or plan to contribute.
git clone https://github.com/rajveer43/VeloxQuant-MLX.git
cd VeloxQuant-MLX
pip install -e ".[dev]"
The [dev] extra installs SciPy (for codebook training) and the full test suite dependencies.
Verify the installation
import veloxquant_mlx
print(veloxquant_mlx.__version__) # e.g. 0.7.0
import mlx.core as mx
print(mx.default_device()) # Device(gpu, 0)
If you see Device(cpu, 0) instead of gpu, MLX is not using Metal. See the troubleshooting section below.
Install mlx_lm (optional but recommended)
Most users will want to run VeloxQuant-MLX with mlx_lm for model loading and generation:
pip install mlx-lm
Check compatibility:
python -c "import mlx_lm; print(mlx_lm.__version__)"
Troubleshooting
Device(cpu, 0) — Metal not active
MLX falls back to CPU when Metal is unavailable. Common causes:
- Running in a VM or Docker — Metal is not forwarded; run natively on the Mac host.
- Rosetta 2 Python — Install an arm64 Python via Homebrew or the official installer:
brew install python@3.12
- Conda environment — Use miniforge (arm64) instead of standard Anaconda:
brew install miniforgeconda create -n velox python=3.12conda activate veloxpip install veloxquant-mlx
ImportError: No module named 'mlx'
MLX is only published for Apple Silicon. If pip install mlx fails, you are on an incompatible platform.
Metal kernel compilation errors
VeloxQuant-MLX compiles Metal kernels on first use with mx.fast.metal_kernel. If you see compilation errors:
# Ensure Xcode Command Line Tools are installed
xcode-select --install
# Confirm Metal availability
python -c "import mlx.core as mx; mx.fast.metal_kernel"
ArtifactNotFoundError on first run
Some algorithms (VecInfer, SpectralQuant) require precomputed calibration artifacts. Run:
python -m veloxquant_mlx precompute --method vecinfer --model <path-to-model>
See the Calibration Guide for details.