online-ml/river

River tries to import the inexistent module compat.pytorch

e10e3 opened this issue · 1 comments

Versions

River version: 0.21.1
Python version: 3.12.5
Operating system: macOS 14.6.1

Describe the bug

In test_estimators.py, River tries to import PyTorch2RiverBase from river.compat.pytorch.

try:
from river.compat.pytorch import PyTorch2RiverBase
PYTORCH_INSTALLED = True
except ImportError:
PYTORCH_INSTALLED = False

The thing is, there is no file river/compat/pytorch.py:

$ ls river/compat
__init__.py		river_to_sklearn.py	test_sklearn.py
__pycache__		sklearn_to_river.py

The file was removed in commit ac5c9a1.

This raises an error in MyPy when missing module checking is enabled (such a check is disabled for River in pyproject.toml):

$ mypy river
[...]
river/test_estimators.py:29: error: Cannot find implementation or library stub for module named "river.compat.pytorch"  [import-not-found]

Because the module does not exist any more, the import try-except can probably be removed.

By the way, the file conftest.py also does stuff with former modules that date from the Creme days.

It references (in strings) both compat/sklearn.py and compat/pytorch.py.