ASKSAGE: Sage Q&A Forum - Latest question feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Mon, 09 Mar 2020 00:09:38 -0500Interact in Jupyterlab vs Jupyterhttps://ask.sagemath.org/question/50194/interact-in-jupyterlab-vs-jupyter/Hello, Sage community!
I find Jupyterlab to be more comfortable than Jupyter, so I installed it with
sage -pip install jupyterlab
and I execute it with
sage -n jupyterlab
Everything work well, except when I try to execute an interact, in which case, no sliders, no selection boxes, etc. appear. However, if I use Jupyter with
sage -n jupyter
the interact works well.
Here is a minimal working example:
@interact
def const(k = slider(-5,5,0.1,1,label='Constant')):
print(k)
In this particular case, I obtain in Jupyterlab just `1.00000000000000` without any controls, nor the possibility to change the value of `k`.
Can somebody explain why it is not possible to use interacts in Jupyterlab while it is possible in Jupyter?dsejasMon, 09 Mar 2020 00:09:38 -0500https://ask.sagemath.org/question/50194/SageMath and interact / ipywidgets with jupyterhttps://ask.sagemath.org/question/41269/sagemath-and-interact-ipywidgets-with-jupyter/I got the SageMath kernel working well inside my anaconda distribution's copy of jupyter, following [these instructions](https://stackoverflow.com/a/41595015), so I can open SageMath notebooks using anaconda jupyter and they run perfectly fine -- almost.
I would like to get interact elements / ipywidgets working when I use SageMath as a kernel in anaconda jupyter, but with my current configuration (hopefully described in sufficient detail below), I get the following error message in the console
>[IPKernelApp] WARNING | Widget Javascript not detected. It may not be installed or enabled properly.
and the notebook simply outputs the initial value of the function with no interactivity.
---
I'm running SageMath 8.1 on macOS. I've been able to get interact elements and ipywidgets with SageMath code running in the SageMath jupyter notebook interface (not sure if this was necessary, but I ran
`/local/bin/jupyter nbextension enable --py widgetsnbextension`
in the SageMath directory.) Everything works as expected, i.e. if I run `sagemath -n jupyter` and open a notebook containing:
>import ipywidgets as widgets
>
>widgets.IntSlider(
value=7,
min=0,
max=10,
step=1,
description='Test:',
disabled=False,
continuous_update=False,
orientation='horizontal',
readout=True,
readout_format='d'
)
I get a slider widget which works.
Similarly, examples from this [interact tutorial](https://wiki.sagemath.org/interact/graphics) on the SageMath wiki run perfectly fine in SageMath jupyter.
I also have an up-to-date anaconda install of jupyter where the ipywidgets nbextension has been enabled; the above ipywidgets code can be run in anaconda jupyter with the ordinary python kernel and works fine.
----
[The real reason I am asking this question is I would like to figure out how to get interactive widgets working in jupyterlab with the SageMath kernel, but I'm guessing that if the above question can be answered, I can get everything else working as well.]j.c.Mon, 26 Feb 2018 12:16:26 -0600https://ask.sagemath.org/question/41269/