PAIR-code / what-if-tool

Source code/webpage/demos for the What-If Tool
https://pair-code.github.io/what-if-tool
Apache License 2.0
892 stars 165 forks source link

how to install what if in managed notebook of vertex ai? #215

Open zabir-nabil opened 1 year ago

zabir-nabil commented 1 year ago

It seems what-if is not available directly in managed notebooks? How can I install it? I have tried multiple times, but either I get permission error (don't have sudo), or something like this happens: Screenshot 2022-10-03 at 11 28 04 PM

zabir-nabil commented 1 year ago

following this one: https://cloud.google.com/ai-platform/prediction/docs/using-what-if-tool/#jupyterlab

jameswex commented 1 year ago

Can you list the steps you took exactly and the versions of managed notebooks used?

In general, the LIT tool is more general-purpose, extensible, and actively being developed, so you may want to look into that interactive model analysis tool which is our follow-up to WIT. https://pair-code.github.io/lit/

zabir-nabil commented 1 year ago

Hi, @jameswex I tried to reproduce the errors with a new managed notebook.

!jupyter --version

!jupyter --version
Selected Jupyter core packages...
IPython          : 7.33.0
ipykernel        : 6.15.3
ipywidgets       : not installed
jupyter_client   : 7.3.5
jupyter_core     : 4.11.1
jupyter_server   : 1.18.1
jupyterlab       : 3.2.9
nbclient         : 0.6.8
nbconvert        : 7.0.0
nbformat         : 5.5.0
notebook         : 6.4.12
qtconsole        : not installed
traitlets        : 5.4.0

So, my jupyterlab version is 3. So, according to the what-if github readme

I run the following commands,

!pip install witwidget
!jupyter labextension install wit-widget
!jupyter labextension install @jupyter-widgets/jupyterlab-manager

Then, I get the following errors:

ERROR: Could not install packages due to an OSError: [Errno 13] Permission denied: '/opt/conda/etc/jupyter/nbconfig/notebook.d/widgetsnbextension.json'
Consider using the `--user` option or check the permissions.   Config option `kernel_spec_manager_class` not recognized by `InstallLabExtensionApp`.
[W 2022-10-06 13:40:26.318 LabApp] Config option `kernel_spec_manager_class` not recognized by `LabApp`.
An error occurred.
PermissionError: [Errno 13] Permission denied: '/opt/conda/share/jupyter/lab/staging'
See the log file for details:  /tmp/jupyterlab-debug-7mtdhhkn.log
Config option `kernel_spec_manager_class` not recognized by `InstallLabExtensionApp`.
[W 2022-10-06 13:40:30.559 LabApp] Config option `kernel_spec_manager_class` not recognized by `LabApp`.
An error occurred.
PermissionError: [Errno 13] Permission denied: '/opt/conda/share/jupyter/lab/staging'
See the log file for details:  /tmp/jupyterlab-debug-35wisbse.log

I also try this:

!pip install witwidget --user
!jupyter labextension install wit-widget
!jupyter labextension install @jupyter-widgets/jupyterlab-manager

Still it fails with the following log:

WARNING: The script markdown_py is installed in '/home/jupyter/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.  WARNING: The script google-oauthlib-tool is installed in '/home/jupyter/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.  WARNING: The script tensorboard is installed in '/home/jupyter/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.  WARNING: The scripts estimator_ckpt_converter, import_pb_to_tensorboard, saved_model_cli, tensorboard, tf_upgrade_v2, tflite_convert, toco and toco_from_protos are installed in '/home/jupyter/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.  Successfully installed astunparse-1.6.3 gast-0.4.0 google-auth-oauthlib-0.4.6 google-pasta-0.2.0 h5py-3.7.0 ipywidgets-8.0.2 jupyterlab-widgets-3.0.3 keras-preprocessing-1.1.2 markdown-3.4.1 opt-einsum-3.3.0 protobuf-3.19.6 tensorboard-2.10.1 tensorboard-data-server-0.6.1 tensorflow-2.10.0 tensorflow-estimator-2.10.0 tensorflow-io-gcs-filesystem-0.27.0 termcolor-2.0.1 werkzeug-2.2.2 witwidget-1.8.1
Config option `kernel_spec_manager_class` not recognized by `InstallLabExtensionApp`.
[W 2022-10-06 13:50:48.548 LabApp] Config option `kernel_spec_manager_class` not recognized by `LabApp`.
An error occurred.
PermissionError: [Errno 13] Permission denied: '/opt/conda/share/jupyter/lab/staging'
See the log file for details:  /tmp/jupyterlab-debug-nb_wgm1r.log
Config option `kernel_spec_manager_class` not recognized by `InstallLabExtensionApp`.
[W 2022-10-06 13:50:52.629 LabApp] Config option `kernel_spec_manager_class` not recognized by `LabApp`.
An error occurred.
PermissionError: [Errno 13] Permission denied: '/opt/conda/share/jupyter/lab/staging'
See the log file for details:  /tmp/jupyterlab-debug-wzno2r2q.log

Note, I don't have sudo access.