Ask Your Question
3

Interact in Jupyterlab vs Jupyter

asked 2020-03-09 00:09:38 -0600

dsejas gravatar image

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?

edit retag flag offensive close merge delete

Comments

Thanks for reporting! This is now tracked at

slelievre gravatar imageslelievre ( 2020-07-29 07:17:49 -0600 )edit

Update: the ticket

was merged in Sage 9.2.beta11.

slelievre gravatar imageslelievre ( 2020-09-02 20:11:30 -0600 )edit

2 answers

Sort by ยป oldest newest most voted
2

answered 2020-09-02 20:10:13 -0600

slelievre gravatar image

Starting 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!

edit flag offensive delete link more

Comments

Thank you very much, @slelievre! In order to help other users that have this problem, I am selecting your answer as correct.

dsejas gravatar imagedsejas ( 2020-11-10 17:57:26 -0600 )edit
3

answered 2020-03-19 00:42:01 -0600

nbruin gravatar image

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:

https://stackoverflow.com/questions/4...

it looks like there's some work to do once sagemath starts moving to lab in earnest.

edit flag offensive delete link more

Comments

Thank 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.

dsejas gravatar imagedsejas ( 2020-11-10 18:03:54 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2020-03-09 00:09:38 -0600

Seen: 726 times

Last updated: Sep 02 '20