Skip to content

Commit 31bf2a8

Browse files
authored
Handle the Numpy 3.13 issue (#2282)
#### Python 3.13 on macOS ARM: NumPy fails to install (builds from source) - Symptom: `make install` on Python 3.13 tries to build `numpy==2.0.x` from source on macOS ARM and fails with C/C++ errors. - Status: Ragas CI currently targets Python 3.9–3.12; Python 3.13 is best-effort until upstream wheels are broadly available. Workarounds: 1) Recommended: use Python 3.12 ```bash uv python install 3.12 uv venv -p 3.12 .venv-3.12 source .venv-3.12/bin/activate uv sync --group dev make check ``` 2) Stay on Python 3.13 (best effort): - Minimal install first to avoid heavy transitive pins: ```bash uv venv -p 3.13 .venv-3.13 source .venv-3.13/bin/activate uv pip install -e ".[dev-minimal]" make check ``` - If you need extras, add gradually: ```bash uv pip install "ragas[tracing,gdrive,ai-frameworks]" ``` - Prefer a prebuilt NumPy wheel (if available): ```bash uv pip install "numpy>=2.1" --only-binary=:all: ``` If the resolver still pins to 2.0.x via transitive deps, temporarily set `numpy>=2.1` locally and re-run `uv sync --group dev`. 3) Last resort: build NumPy locally ```bash xcode-select --install export SDKROOT="$(xcrun --sdk macosx --show-sdk-path)" export CC=clang uv pip install numpy ``` Safe alternate-venv tip: - Keep your project `.venv` untouched and use `.venv-3.12` / `.venv-3.13`. Avoid `make install` in alt envs; prefer `uv` commands directly. `make check` respects the active env via `uv run --active`.
1 parent 7458687 commit 31bf2a8

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

DEVELOPMENT.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,33 @@ uv run ruff check --no-fix # Check issues without fixing
386386
- **Follow existing code style** (enforced by `make format`)
387387

388388
---
389+
#### Python 3.13 on macOS ARM: NumPy fails to install (builds from source)
390+
391+
- Symptom: `make install` attempts to build `numpy==2.0.x` from source on Python 3.13 (no prebuilt wheel), failing with C/C++ errors.
392+
- Status: Ragas CI supports Python 3.9–3.12. Python 3.13 is not officially supported yet.
393+
394+
Workarounds:
395+
1) Recommended: use Python 3.12
396+
```bash
397+
uv python install 3.12
398+
rm -rf .venv
399+
uv venv -p 3.12
400+
make install
401+
```
402+
403+
2) Stay on 3.13 (best effort):
404+
- Install minimal first, then add extras as needed:
405+
```bash
406+
rm -rf .venv
407+
uv venv -p 3.13
408+
make install-minimal
409+
uv pip install "ragas[tracing,gdrive,ai-frameworks]"
410+
```
411+
- Or force a newer NumPy wheel:
412+
```bash
413+
uv pip install "numpy>=2.1" --only-binary=:all:
414+
```
415+
If conflicts pin NumPy to 2.0.x, temporarily set `numpy>=2.1` in `pyproject.toml` and run `uv sync --group dev`.
389416

390417
**Happy coding! 🚀**
391418

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ requires-python = ">=3.9"
55
license = {file = "LICENSE"}
66
dependencies = [
77
# Core dependencies
8-
"numpy",
8+
"numpy>=1.21.0,<3.0.0",
99
"datasets>=4.0.0",
1010
"tiktoken",
1111
"pydantic>=2.0.0",

0 commit comments

Comments
 (0)