Skip to content
This repository has been archived by the owner on Dec 20, 2023. It is now read-only.

Cannot use contextual-ai with python 3.9 based application due to hard dependency on scikit-learn version #37

Open
sinha-kirti opened this issue Oct 18, 2022 · 0 comments

Comments

@sinha-kirti
Copy link

Hi Team,

There is a strong dependency on contextual-ai on scikit-learn version 0.21.x. As a result, we cannot use this library beyond python 3.7. We are using contextual-ai==0.0.2. Consider the error log below:

File "/home/.../.local/lib/python3.9/site-packages/xai/compiler/base.py", line 363, in render
09:22:36 self.render_contents(report=report,
09:22:36 File "/home/.../.local/lib/python3.9/site-packages/xai/compiler/base.py", line 264, in render_contents
09:22:36 Controller.render_contents(report=report,
09:22:36 File "/home/.../.local/lib/python3.9/site-packages/xai/compiler/base.py", line 260, in render_contents
09:22:36 Controller.render_component(report=report,
File "/home/.../.local/lib/python3.9/site-packages/xai/compiler/base.py", line 325, in render_component
09:22:36 Controller.factory(report=report, package=package,
09:22:36 File "/home/.../.local/lib/python3.9/site-packages/xai/compiler/base.py", line 299, in factory
09:22:36 imported_module = import_module('.' + module, package=package)
09:22:36 File "/usr/local/lib/python3.9/importlib/init.py", line 127, in import_module
09:22:36 return _bootstrap._gcd_import(name[level:], package, level)
09:22:36 File "", line 1030, in _gcd_import
09:22:36 File "", line 1007, in _find_and_load
09:22:36 File "", line 986, in _find_and_load_unlocked
09:22:36 File "", line 680, in _load_unlocked
09:22:36 File "", line 850, in exec_module
09:22:36 File "", line 228, in _call_with_frames_removed
09:22:36 File "/home/.../.local/lib/python3.9/site-packages/xai/compiler/init.py", line 13, in 09:22:36 from .evaluation import ClassificationEvaluationResult
09:22:36 File "/home/.../.local/lib/python3.9/site-packages/xai/compiler/evaluation.py", line 19, in 09:22:36 from xai.model.evaluation.result_compiler import ResultCompiler
09:22:36 File "/home/.../.local/lib/python3.9/site-packages/xai/model/evaluation/result_compiler.py", line 11, in 09:22:36 from sklearn.metrics.classification import precision_recall_fscore_support, confusion_matrix
09:22:36 ModuleNotFoundError: No module named 'sklearn.metrics.classification'

This module is only available till scikit-learn version 0.21.x. See: https://github.com/scikit-learn/scikit-learn/tree/0.22.X/sklearn/metrics and https://github.com/scikit-learn/scikit-learn/tree/0.21.X/sklearn/metrics

Is there any plan to make this library compatible with newer versions of python (v3.9 and v3.10)?

Although the requirements file pins the scikit-learn version to 0.22.2, the classification module is deprecated in version 0.22.2.

--Python 3.8.0 (default, Nov 6 2019, 15:49:01) --
[Clang 4.0.1 (tags/RELEASE_401/final)] :: Anaconda, Inc. on darwin
Type "help", "copyright", "credits" or "license" for more information.

from sklearn.metrics.classification import precision_recall_fscore_support, confusion_matrix
/usr/local/homebrew/anaconda3/envs/py38/lib/python3.8/site-packages/sklearn/utils/deprecation.py:144: FutureWarning: The sklearn.metrics.classification module is deprecated in version 0.22 and will be removed in version 0.24. The corresponding classes / functions should instead be imported from sklearn.metrics. Anything that cannot be imported from sklearn.metrics is now part of the private API.
warnings.warn(message, FutureWarning)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant