recommenders: [BUG] Movielens not working in python 3.7 due to Pandera library
Description
In python 3.7, movielens doesn’t load due to a conflict with Pandera library:
from recommenders.datasets import movielens
/opt/hostedtoolcache/Python/3.7.17/x64/lib/python3.7/site-packages/recommenders/datasets/movielens.py:[36](https://github.com/LinkedInLearning/recommendation-systems-a-practical-introduction-2703578/actions/runs/7327519315/job/19954500824?pr=24#step:7:37): in <module>
import pandera as pa
/opt/hostedtoolcache/Python/3.7.17/x64/lib/python3.7/site-packages/pandera/__init__.py:4: in <module>
import pandera.backends
/opt/hostedtoolcache/Python/3.7.17/x64/lib/python3.7/site-packages/pandera/backends/__init__.py:6: in <module>
import pandera.backends.pandas
/opt/hostedtoolcache/Python/3.7.17/x64/lib/python3.7/site-packages/pandera/backends/pandas/__init__.py:5: in <module>
import pandera.typing
/opt/hostedtoolcache/Python/3.7.17/x64/lib/python3.7/site-packages/pandera/typing/__init__.py:9: in <module>
from pandera.typing import (
/opt/hostedtoolcache/Python/3.7.17/x64/lib/python3.7/site-packages/pandera/typing/geopandas.py:5: in <module>
from typing import ( # type: ignore[attr-defined]
E ImportError: cannot import name 'get_args' from 'typing' (/opt/hostedtoolcache/Python/3.7.17/x64/lib/python3.7/typing.py)
In which platform does it happen?
How do we replicate the issue?
Pandera recently release 0.18.0 see https://pypi.org/project/pandera/#history
With Pandera < 0.18.0, the code works.
Expected behavior (i.e. solution)
Other Comments
About this issue
- Original URL
- State: closed
- Created 6 months ago
- Comments: 15
I am fixing this in a new PR. Until we release the fix on PyPI, one way to bypass the issue is after you have done
pip install recommendersyou do apip install "pandera[strategies]>=0.6.5,<0.18"This should uninstall the latest version of pandera (which is causing the error) and install the previous one.@anargyri It’s serverless doesn’t consume lots of money and enables the spark jobs don’t worry about quota.
As for your question as this is a preconfigured compute there are only two options python 3.8 or python 3.10 and python 3.10 is not supported by the recommenders package so, you need to fix this in order for this environment to work on Azure ML.
Thanks @john0isaac I don’t have quota for this type of machine, I am afraid. I should make a commit for Python 3.8 too. What happens if you try with higher Python versions on that machine?
I could only replicate the issue in 3.7, not in 3.8. @john0isaac what machine did you use? mine is a Standard_E4ds_v4 (4 cores, 32 GB RAM, 150 GB disk). What did you do to get this error? I tried
Thanks, so
panderaneeds to handle this. We need to remove the dependency then.But maybe the
typingdependency is the problem.Also here
This also affects Python 3.8.