microsoft / responsible-ai-toolbox

Responsible AI Toolbox is a suite of tools providing model and data exploration and assessment user interfaces and libraries that enable a better understanding of AI systems. These interfaces and libraries empower developers and stakeholders of AI systems to develop and monitor AI more responsibly, and take better data-driven actions.
https://responsibleaitoolbox.ai/
MIT License
1.27k stars 335 forks source link

ImportError: numpy.core.multiarray failed to import #2088

Open quocdat-le-insacvl opened 1 year ago

quocdat-le-insacvl commented 1 year ago

Describe the bug Hi, I'm trying to run:

from raiwidgets import ExplanationDashboard
ExplanationDashboard(global_explanation, model, dataset=x_test_scaled, true_y=y_test)

but I got the error:

RuntimeError                              Traceback (most recent call last)
File __init__.pxd:942, in numpy.import_array()

RuntimeError: module compiled against API version 0x10 but this version of numpy is 0xf . Check the section C-API incompatibility at the Troubleshooting ImportError section at https://numpy.org/devdocs/user/troubleshooting-importerror.html#c-api-incompatibility for indications on how to solve this problem .

During handling of the above exception, another exception occurred:

ImportError                               Traceback (most recent call last)
Cell In[29], line 1
----> 1 from responsibleai import RAIInsights

File [c:\Users\Q1636743\project\interpret_dashboard\.venv\lib\site-packages\responsibleai\__init__.py:8](file:///C:/Users/Q1636743/project/interpret_dashboard/.venv/lib/site-packages/responsibleai/__init__.py:8)
      6 # ModelTask is only imported for backwards compatibility
      7 from raiutils.models import ModelTask
----> 8 from responsibleai.modelanalysis import ModelAnalysis
      9 from responsibleai.rai_insights import RAIInsights
     11 from .__version__ import version

File [c:\Users\Q1636743\project\interpret_dashboard\.venv\lib\site-packages\responsibleai\modelanalysis\__init__.py:8](file:///C:/Users/Q1636743/project/interpret_dashboard/.venv/lib/site-packages/responsibleai/modelanalysis/__init__.py:8)
      6 # ModelTask is only imported for backwards compatibility
      7 from raiutils.models import ModelTask
----> 8 from responsibleai.modelanalysis.model_analysis import ModelAnalysis
     10 __all__ = ["ModelAnalysis", "ModelTask"]

File [c:\Users\Q1636743\project\interpret_dashboard\.venv\lib\site-packages\responsibleai\modelanalysis\model_analysis.py:13](file:///C:/Users/Q1636743/project/interpret_dashboard/.venv/lib/site-packages/responsibleai/modelanalysis/model_analysis.py:13)
     10 import pandas as pd
     12 from responsibleai.feature_metadata import FeatureMetadata
---> 13 from responsibleai.managers.causal_manager import CausalManager
     14 from responsibleai.managers.counterfactual_manager import CounterfactualManager
     15 from responsibleai.managers.error_analysis_manager import ErrorAnalysisManager

File [c:\Users\Q1636743\project\interpret_dashboard\.venv\lib\site-packages\responsibleai\managers\causal_manager.py:10](file:///C:/Users/Q1636743/project/interpret_dashboard/.venv/lib/site-packages/responsibleai/managers/causal_manager.py:10)
      8 import numpy as np
      9 import pandas as pd
---> 10 from econml.solutions.causal_analysis import CausalAnalysis
     12 from raiutils.models import ModelTask
     13 from responsibleai._data_validations import validate_train_test_categories

File [c:\Users\Q1636743\project\interpret_dashboard\.venv\lib\site-packages\econml\solutions\causal_analysis\__init__.py:4](file:///C:/Users/Q1636743/project/interpret_dashboard/.venv/lib/site-packages/econml/solutions/causal_analysis/__init__.py:4)
      1 # Copyright (c) PyWhy contributors. All rights reserved.
      2 # Licensed under the MIT License.
----> 4 from ._causal_analysis import CausalAnalysis
      6 __all__ = ["CausalAnalysis"]
...
File statsmodels\nonparametric\_smoothers_lowess.pyx:22, in init statsmodels.nonparametric._smoothers_lowess()

File __init__.pxd:944, in numpy.import_array()

ImportError: numpy.core.multiarray failed to import

To Reproduce Steps to reproduce the behavior:

  1. I've just installed these packages : interpret-community lightgbm interpret raiwidgets
  2. Train a model
  3. And run the code above

Packages version

raiwidgets           0.27.0
numpy                1.22.4
pandas               1.5.3
interpret-community 0.29.0
hawestra commented 11 months ago

Hi @quocdat-le-insacvl! I'm sorry for the delay in response; could you please tell me what version of python you are using ? We've seen issues in the past where certain versions of python cause this error when running certain version of numpy and shap