You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This leads to the following ImportError when importing the package into an environment with Numpy 2.
ImportError while loading conftest '/home/user/repos/Surprise/tests/conftest.py'.
tests/conftest.py:10: in <module>
from surprise import Dataset, Reader
.venv/lib/python3.12/site-packages/surprise/__init__.py:6: in <module>
from .prediction_algorithms import (
.venv/lib/python3.12/site-packages/surprise/prediction_algorithms/__init__.py:23: in <module>
from .algo_base import AlgoBase
.venv/lib/python3.12/site-packages/surprise/prediction_algorithms/algo_base.py:8: in <module>
from .. import similarities as sims
surprise/similarities.pyx:1: in init surprise.similarities
"""
E ImportError: numpy.core.multiarray failed to import (auto-generated because you didn't call 'numpy.import_array()' after cimporting numpy; use '<void>numpy._import_array' to disable if you are certain you don't need it).
Steps to reproduce
You can reproduce this problem by following these steps.
# Setup a fresh virtual environment
python -m venv .venv
source .venv/bin/activate
# Install this package and its dependencies
pip install .# Install packages to run rests
pip install pytest pandas
# Run tests (this will fail with the previously mentioned error)
pytest -v
Full package list
The command pip list shows that pip install . grabbed the most recent version of Numpy (2.2.2).
Problem
This package is incompatible with Numpy 2 but does not have an upper bound on the Numpy version in
pyproject.toml
.Surprise/pyproject.toml
Line 24 in 2381fb1
This leads to the following
ImportError
when importing the package into an environment with Numpy 2.Steps to reproduce
You can reproduce this problem by following these steps.
Full package list
The command
pip list
shows thatpip install .
grabbed the most recent version of Numpy (2.2.2).I noticed this problem magically goes away when importing Surprise in Google Collab. Looks like by default Google Collab installs Numpy 1.26.4.
The text was updated successfully, but these errors were encountered: