Skip to content

Comments

Fix NumPy 2.0 compatibility and modernize build config#662

Open
dhruvildarji wants to merge 1 commit intoFarama-Foundation:masterfrom
dhruvildarji:fix/numpy-compatibility
Open

Fix NumPy 2.0 compatibility and modernize build config#662
dhruvildarji wants to merge 1 commit intoFarama-Foundation:masterfrom
dhruvildarji:fix/numpy-compatibility

Conversation

@dhruvildarji
Copy link

Summary

Fixes #617

This PR addresses the NumPy 2.0 compatibility issue reported in #617 by modernizing the build configuration:

  • Add [build-system] section (PEP 517/518): Ensures proper build isolation with setuptools>=64, preventing compiled module version mismatches between NumPy 1.x and 2.x
  • Bump minimum numpy from >=1.21.0 to >=1.23.0: NumPy 1.23 is the earliest version that includes forward-compatibility improvements for the NumPy 2.0 transition
  • Drop EOL Python 3.8: Already removed from CI in Drop python 3.8 in build workflow #654, this aligns requires-python and classifiers accordingly
  • Add Python 3.13 support: Added to classifiers and CI test matrix
  • Update GitHub Actions: actions/checkout@v2 -> @v4, actions/setup-python@v1 -> @v5

Context

The error in #617 ("A module compiled using NumPy 1.x cannot be run in NumPy 2.0.2") occurs when pip resolves dependencies without proper build isolation. Adding the [build-system] table ensures pip uses an isolated build environment with compatible NumPy versions, preventing the compiled module mismatch.

Test plan

  • CI passes on Python 3.9-3.13
  • pip install . works in a fresh environment with NumPy 2.x
  • import highway_env works without NumPy version errors

- Add [build-system] section (PEP 517/518) for proper build isolation
- Bump minimum numpy from 1.21.0 to 1.23.0 for NumPy 2.0 compatibility
- Drop EOL Python 3.8 from requires-python and classifiers
- Add Python 3.13 to classifiers and CI test matrix
- Update GitHub Actions to latest versions (checkout@v4, setup-python@v5)

Fixes Farama-Foundation#617

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NumPy Issue in version 1.10.1

1 participant