Skip to content

Fix Python 3.12 and numpy 2.x compatibility#85

Open
SaeedTaghavi wants to merge 5 commits into
mariomulansky:masterfrom
SaeedTaghavi:fix/python312-compatibility
Open

Fix Python 3.12 and numpy 2.x compatibility#85
SaeedTaghavi wants to merge 5 commits into
mariomulansky:masterfrom
SaeedTaghavi:fix/python312-compatibility

Conversation

@SaeedTaghavi
Copy link
Copy Markdown

@SaeedTaghavi SaeedTaghavi commented Apr 29, 2026

Problem

Closes #84
Installing pyspike fails on Python 3.11+ and numpy 2.x because:

  • The bundled pre-generated .c files were compiled with an old
    version of Cython incompatible with Python 3.12's C API
  • numpy 2.0 removed internal structs the old .c files depended on
  • pkg_resources is no longer available in newer setuptools

Solution

  • Add pyproject.toml declaring Cython and numpy as build dependencies
  • Simplify setup.py to always compile from .pyx files using
    cythonize(), removing reliance on bundled .c files entirely
  • Replace pkg_resources with importlib.metadata in __init__.py
  • Fix invalid escape sequences in docstrings causing SyntaxWarnings
  • Update .gitignore to exclude build artifacts

Testing

Tested successfully on Python 3.12.3 with numpy 2.4.4 on Ubuntu WSL2.

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.

Fails to install from pip

1 participant