Skip to content

Conversation

@rabah-khalek
Copy link
Contributor

See linear card for details

@rabah-khalek rabah-khalek added Python Pull requests that update Python code dependency Created by Linear-GitHub Sync labels Sep 7, 2023
@rabah-khalek rabah-khalek self-assigned this Sep 7, 2023
@linear
Copy link

linear bot commented Sep 7, 2023

GSK-1702 shap import issue

We currently make shap only a server dependency, but the installation without the server also relies on it:

!pip install "giskard>=2.0.0b" -U
import giskard

I'm getting:

----> 1 import giskard
      2 giskard.__version__

1 frames
/usr/local/lib/python3.10/dist-packages/giskard/models/model_explanation.py in <module>
      5 import numpy as np
      6 import pandas as pd
----> 7 from shap.maskers import Text
      8 from shap import KernelExplainer, Explanation, Explainer
      9 

ModuleNotFoundError: No module named 'shap'

---------------------------------------------------------------------------
NOTE: If your import is failing due to a missing package, you can
manually install dependencies using either !pip or !apt.

To view examples of installing some common dependencies, click the
"Open Examples" button below.
---------------------------------------------------------------------------

Solution:

  • either don’t expose explain_with_shap on a root level
  • or make shap imports method-local so that it’s not imported unless you want to use it

we're going with option 2

@sonarqubecloud
Copy link

sonarqubecloud bot commented Sep 7, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

57.1% 57.1% Coverage
0.0% 0.0% Duplication

@andreybavt andreybavt merged commit 6110603 into main Sep 7, 2023
@Hartorn Hartorn deleted the GSK-1702-shap-import-issue branch September 22, 2023 10:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependency Created by Linear-GitHub Sync Python Pull requests that update Python code

Development

Successfully merging this pull request may close these issues.

3 participants