ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Wed, 11 Nov 2020 01:03:54 +0100Interact 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?Mon, 09 Mar 2020 06:09:38 +0100https://ask.sagemath.org/question/50194/interact-in-jupyterlab-vs-jupyter/Comment by slelievre for <p>Hello, Sage community!</p>
<p>I find Jupyterlab to be more comfortable than Jupyter, so I installed it with</p>
<pre><code>sage -pip install jupyterlab
</code></pre>
<p>and I execute it with</p>
<pre><code>sage -n jupyterlab
</code></pre>
<p>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</p>
<pre><code>sage -n jupyter
</code></pre>
<p>the interact works well.</p>
<p>Here is a minimal working example:</p>
<pre><code>@interact
def const(k = slider(-5,5,0.1,1,label='Constant')):
print(k)
</code></pre>
<p>In this particular case, I obtain in Jupyterlab just <code>1.00000000000000</code> without any controls, nor the possibility to change the value of <code>k</code>.</p>
<p>Can somebody explain why it is not possible to use interacts in Jupyterlab while it is possible in Jupyter?</p>
https://ask.sagemath.org/question/50194/interact-in-jupyterlab-vs-jupyter/?comment=52742#post-id-52742Thanks for reporting! This is now tracked at
- [Sage Trac ticket 30246: Support interacts in JupyterLab](https://trac.sagemath.org/ticket/30246)Wed, 29 Jul 2020 14:17:49 +0200https://ask.sagemath.org/question/50194/interact-in-jupyterlab-vs-jupyter/?comment=52742#post-id-52742Comment by slelievre for <p>Hello, Sage community!</p>
<p>I find Jupyterlab to be more comfortable than Jupyter, so I installed it with</p>
<pre><code>sage -pip install jupyterlab
</code></pre>
<p>and I execute it with</p>
<pre><code>sage -n jupyterlab
</code></pre>
<p>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</p>
<pre><code>sage -n jupyter
</code></pre>
<p>the interact works well.</p>
<p>Here is a minimal working example:</p>
<pre><code>@interact
def const(k = slider(-5,5,0.1,1,label='Constant')):
print(k)
</code></pre>
<p>In this particular case, I obtain in Jupyterlab just <code>1.00000000000000</code> without any controls, nor the possibility to change the value of <code>k</code>.</p>
<p>Can somebody explain why it is not possible to use interacts in Jupyterlab while it is possible in Jupyter?</p>
https://ask.sagemath.org/question/50194/interact-in-jupyterlab-vs-jupyter/?comment=53271#post-id-53271Update: the ticket
- [Sage Trac ticket 30246: Support interacts in JupyterLab](https://trac.sagemath.org/ticket/30246)
was merged in Sage 9.2.beta11.Thu, 03 Sep 2020 03:11:30 +0200https://ask.sagemath.org/question/50194/interact-in-jupyterlab-vs-jupyter/?comment=53271#post-id-53271Answer by slelievre for <p>Hello, Sage community!</p>
<p>I find Jupyterlab to be more comfortable than Jupyter, so I installed it with</p>
<pre><code>sage -pip install jupyterlab
</code></pre>
<p>and I execute it with</p>
<pre><code>sage -n jupyterlab
</code></pre>
<p>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</p>
<pre><code>sage -n jupyter
</code></pre>
<p>the interact works well.</p>
<p>Here is a minimal working example:</p>
<pre><code>@interact
def const(k = slider(-5,5,0.1,1,label='Constant')):
print(k)
</code></pre>
<p>In this particular case, I obtain in Jupyterlab just <code>1.00000000000000</code> without any controls, nor the possibility to change the value of <code>k</code>.</p>
<p>Can somebody explain why it is not possible to use interacts in Jupyterlab while it is possible in Jupyter?</p>
https://ask.sagemath.org/question/50194/interact-in-jupyterlab-vs-jupyter/?answer=53270#post-id-53270Starting from Sage 9.2.beta11, you can install JupyterLab
and its jupyterlab-widgets extension for Sage:
$ sage -i jupyterlab_widgets
and then the interact in the question works fine!Thu, 03 Sep 2020 03:10:13 +0200https://ask.sagemath.org/question/50194/interact-in-jupyterlab-vs-jupyter/?answer=53270#post-id-53270Comment by dsejas for <p>Starting from Sage 9.2.beta11, you can install JupyterLab
and its jupyterlab-widgets extension for Sage:</p>
<pre><code>$ sage -i jupyterlab_widgets
</code></pre>
<p>and then the interact in the question works fine!</p>
https://ask.sagemath.org/question/50194/interact-in-jupyterlab-vs-jupyter/?comment=54206#post-id-54206Thank you very much, @slelievre! In order to help other users that have this problem, I am selecting your answer as correct.Wed, 11 Nov 2020 00:57:26 +0100https://ask.sagemath.org/question/50194/interact-in-jupyterlab-vs-jupyter/?comment=54206#post-id-54206Answer by nbruin for <p>Hello, Sage community!</p>
<p>I find Jupyterlab to be more comfortable than Jupyter, so I installed it with</p>
<pre><code>sage -pip install jupyterlab
</code></pre>
<p>and I execute it with</p>
<pre><code>sage -n jupyterlab
</code></pre>
<p>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</p>
<pre><code>sage -n jupyter
</code></pre>
<p>the interact works well.</p>
<p>Here is a minimal working example:</p>
<pre><code>@interact
def const(k = slider(-5,5,0.1,1,label='Constant')):
print(k)
</code></pre>
<p>In this particular case, I obtain in Jupyterlab just <code>1.00000000000000</code> without any controls, nor the possibility to change the value of <code>k</code>.</p>
<p>Can somebody explain why it is not possible to use interacts in Jupyterlab while it is possible in Jupyter?</p>
https://ask.sagemath.org/question/50194/interact-in-jupyterlab-vs-jupyter/?answer=50298#post-id-50298It looks like lab takes a different approach than notebook regarding javascript in output cells. It would be nice to have a more official source, but the following Q/A seems to contain some valuable info:
https://stackoverflow.com/questions/49542417/how-to-get-ipywidgets-working-in-jupyter-lab
it looks like there's some work to do once sagemath starts moving to lab in earnest.Thu, 19 Mar 2020 06:42:01 +0100https://ask.sagemath.org/question/50194/interact-in-jupyterlab-vs-jupyter/?answer=50298#post-id-50298Comment by dsejas for <p>It looks like lab takes a different approach than notebook regarding javascript in output cells. It would be nice to have a more official source, but the following Q/A seems to contain some valuable info:</p>
<p><a href="https://stackoverflow.com/questions/49542417/how-to-get-ipywidgets-working-in-jupyter-lab">https://stackoverflow.com/questions/4...</a></p>
<p>it looks like there's some work to do once sagemath starts moving to lab in earnest.</p>
https://ask.sagemath.org/question/50194/interact-in-jupyterlab-vs-jupyter/?comment=54207#post-id-54207Thank you very much for your help, @nbruin! Although I had selected your answer as correct the first time, given the up-to-date answer by slelievre, I had to make a re-selection of answers, putting slelievre's answer as correct for the good of other users with the same problem.Wed, 11 Nov 2020 01:03:54 +0100https://ask.sagemath.org/question/50194/interact-in-jupyterlab-vs-jupyter/?comment=54207#post-id-54207