Skip to content

fix for python 3.13.x#498

Open
agnelvishal wants to merge 1 commit intoNicolasHug:masterfrom
agnelvishal:master
Open

fix for python 3.13.x#498
agnelvishal wants to merge 1 commit intoNicolasHug:masterfrom
agnelvishal:master

Conversation

@agnelvishal
Copy link
Copy Markdown

This package has compatibility issues with Python 3.13.x as mentioned in #488

Issue Analysis
The primary issue was a build failure in surprise/prediction_algorithms/co_clustering.pyx due to the use of np.int_t, which has been deprecated and removed in newer versions of NumPy's Cython interface. Additionally, Cython 3.x introduced stricter pickling requirements for classes defined in .pyx files when using typed features.

Fixes Implemented - Refactored co_clustering.pyx:

  • Replaced legacy np.ndarray type declarations with modern Cython typed memoryviews (long [::1], double [::1], etc.).
  • Moved the compute_averages method to a standalone function to prevent Cython from implicitly converting the CoClustering class into a non-picklable extension type.
  • Ensured that all internal memoryviews are converted back to standard NumPy arrays usingnp.asarray()before being stored as instance attributes (self.cltr_u, self.user_mean, etc.), resolving a TypeError during pickling (dumping).

Verification Results
I verified the fixes by building the package extensions and running the complete test suite:

Build: Successfully compiled all Cython extensions on Python 3.13.3.
Tests: All 82 tests passed, including specific tests for algorithm convergence and model dumping/loading.

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.

1 participant