jupyenv icon indicating copy to clipboard operation
jupyenv copied to clipboard

Unable to configure jupyterlab_widgets / ipywidgets with jupiterWith

Open dmayle opened this issue 3 years ago • 0 comments

Describe the bug Following the docs, I've generated a shell.nix and used generate-directory but the widgets won't load

To Reproduce

  1. shell.nix
let                                                                                                                                                                                                                                                                          
  jupyter = import (builtins.fetchGit {                                                                                                                                                                                                                                      
    url = https://github.com/tweag/jupyterWith;                                                                                                                                                                                                                              
    rev = "45f9a774e981d3a3fb6a1e1269e33b4624f9740e";                                                                                                                                                                                                                        
  }) {};                                                                                                                                                                                                                                                                     
                                                                                                                                                                                                                                                                             
  iPython = jupyter.kernels.iPythonWith {                                                                                                                                                                                                                                    
    name = "python";                                                                                                                                                                                                                                                         
    packages = p: with p; [                                                                                                                                                                                                                                                  
      beautifulsoup4                                                                                                                                                                                                                                                         
      ipywidgets                                                                                                                                                                                                                                                             
      matplotlib                                                                                                                                                                                                                                                             
      Keras                                                                                                                                                                                                                                                                  
      pillow                                                                                                                                                                                                                                                                 
      tensorflow                                                                                                                                                                                                                                                             
      tqdm                                                                                                                                                                                                                                                                   
      jupyterlab-widgets                                                                                                                                                                                                                                                     
    ];                                                                                                                                                                                                                                                                       
  };                                                                                                                                                                                                                                                                         
                                                                                                                                                                                                                                                                             
  golang = jupyter.kernels.gophernotes {                                                                                                                                                                                                                                     
    name = "Go";                                                                                                                                                                                                                                                             
  };                                                                                                                                                                                                                                                                         
                                                                                                                                                                                                                                                                             
  jupyterEnvironment =                                                                                                                                                                                                                                                       
    jupyter.jupyterlabWith {                                                                                                                                                                                                                                                 
      kernels = [ iPython golang ];                                                                                                                                                                                                                                          
      directory = /home/doug/src/ml-playground/jupyterlab;                                                                                                                                                                                                                 
    };                                                                                                                                                                                                                                                                       
in                                                                                                                                                                                                                                                                           
  jupyterEnvironment.env

Run generate-directory jupyterlab_widgets Enter this into a jupyterlab cell:

import jupyterlab_widgets
from ipywidgets import interact, interactive, fixed, interact_manual
import ipywidgets as widgets
def f(x):
    return x
interact(f, x=10)

Expected behavior The cell output should be an interactive slider

Environment

  • Debian latest with home manager
  • Version of the code: (git hash in shell.nix)

Additional context

doug@doug-laptop:~/src/ml-playground$ jupyter-labextension list
JupyterLab v3.1.6
Other labextensions (built into JupyterLab)
   app dir: /nix/store/wijndwf354w2i7fx7j30w7pgl3vqh4f0-jupyterlab
        jupyterlab_widgets v0.3.1 enabled OK

dmayle avatar May 19 '22 20:05 dmayle