Trusted-AI / AIF360

A comprehensive set of fairness metrics for datasets and machine learning models, explanations for these metrics, and algorithms to mitigate bias in datasets and models.
https://aif360.res.ibm.com/
Apache License 2.0
2.46k stars 840 forks source link

Import statement for `ClassificationMetric` fails in Cent OS. #374

Closed engineerpassion closed 2 years ago

engineerpassion commented 2 years ago

Import statement fails as below in Cent OS.

  File "/opt/ibm/bias/python/service/runtime/aif360/metrics/aif360_metrics_evaluator.py", line 15, in <module>
    from aif360.metrics import ClassificationMetric
  File "/usr/lib/python3.10/site-packages/aif360/metrics/__init__.py", line 6, in <module>
    from aif360.metrics.mdss_classification_metric import MDSSClassificationMetric
  File "/usr/lib/python3.10/site-packages/aif360/metrics/mdss_classification_metric.py", line 6, in <module>
    from aif360.detectors.mdss.ScoringFunctions import Bernoulli, BerkJones, ScoringFunction
  File "/usr/lib/python3.10/site-packages/aif360/detectors/__init__.py", line 1, in <module>
    from aif360.detectors.mdss.MDSS import MDSS
  File "/usr/lib/python3.10/site-packages/aif360/detectors/mdss/MDSS.py", line 1, in <module>
    from aif360.detectors.mdss.ScoringFunctions.ScoringFunction import ScoringFunction
  File "/usr/lib/python3.10/site-packages/aif360/detectors/mdss/ScoringFunctions/__init__.py", line 5, in <module>
    from aif360.detectors.mdss.ScoringFunctions.Gaussian import Gaussian
  File "/usr/lib/python3.10/site-packages/aif360/detectors/mdss/ScoringFunctions/Gaussian.py", line 1, in <module>
    from turtle import pen
  File "/usr/lib/python3.10/turtle.py", line 107, in <module>
    import tkinter as TK
  File "/usr/lib/python3.10/tkinter/__init__.py", line 37, in <module>
    import _tkinter # If this fails your Python may not be configured for Tk
ModuleNotFoundError: No module named '_tkinter'

Code to reproduce:

from aif360.metrics import ClassificationMetric
nrkarthikeyan commented 2 years ago

Does this work in 3.8/3.9 ?

engineerpassion commented 2 years ago

Does this work in 3.8/3.9 ?

Yes.

gkumbhat commented 2 years ago

I think turtle isn't getting used and can be removed. PR: https://github.com/Trusted-AI/AIF360/pull/415

lanterno commented 1 year ago

@hoffmansc Can we get a new patch release with the fix for this issue, please? 🙏

I tried installing the library from source into my own project, but faced lots of different issues for that.