Classic notebook instead of jupyterlab on mybinder.org

Hello, I’m french so excuse my bad english…
I’ve created some Notebooks which use personnal module and ipwidgets.
Here is an example :slight_smile: Binder

Some days ago, when I was clicking on the link, the Notebook were opened with Jupytehub.
Which was perfect.
But now, notebooks are opened with JupyterLab, which is a problem because I dont’ see the result of clicking on the widgets.
Is there a way to choose JupyterHub by default?
Thank you for your help.

1 Like

Sorry, I was still in the middle of writing my announcement on the topic.

You can opt-in to the old interface (aka ‘classic’ notebook) by specifying a url to open instead of a file. In your link, that would be /notebooks/les_variables/bases_python.ipynb. Full link: https://mybinder.org/v2/gh/fontainedeseaux/NSI_premiere/HEAD?urlpath=%2Fnotebooks%2Fles_variables%2Fbases_python.ipynb

1 Like

Thanks a lot for your help.
I tried with another notebook, and it worked well!

Do you think the problem with the widgets can be solved?
The beahaviour with JupyterLab is not the same than JupyterHub.

Yes, I’m certain it can. I’m not an expert on widgets and don’t know how your widgets work, though.

A clarification - this is the classic notebook vs jupyterlab; jupyterhub is not related here.

1 Like

Do you have example widgets you could point at that aren’t behaving? The one you link to in your first post in this thread is epically long. What I looked at seem to be working in JupyterLab, but maybe I’m missing something by not going through each and every one?

I noticed your validation buttons didn’t seem to give the proper validation messages. You need to use an Output widget to capture the output you wish to display (see Widget Events — Jupyter Widgets 8.1.1 documentation). Actually, it does seem like at least one part of the code in outils.py does use an output widget to properly capture output messages in a button on_click handler (in class Question, for example, the output is displayed inside of a with self.out context handler), but other places do not capture the output messages in an output widget (for example, in Question_ouverte, the button on_click handler displays output without redirecting it to an output widget). I would suggest making the Question_ouverte class on_click handler behave like the Question on_click handler, i.e., display an output widget in the widget layout, and use it to capture the markdown displayed in the on_click handler.

@fomightez.
Thanks
I’ll make a shorter notebook in english to show the differences!

@Jasongrount
Thank you for your advices. I’ll try to look at that.
I made it two years ago and it’s not esay to go back in my code!
I also realize that it’s not a good choice to comment in french… It’s not esay to share and debug after.
But it’s very kind of you ti get a look at the code of outils!
Have a good day.

Thanks to @jasongrout, it may not be necessary to make a shorter notebook to show the differences. @jasongrout is much more knowledgeable than me. However, I think he is pointing you towards what I was wondering would come out of looking at a minimal example. JupyterLab 3 has recently greatly improved use of ipywidgets in notebooks, and so my thinking was maybe issues you are still seeing with widgets in the notebook may be because you were using some widgets-related coding approaches that had somewhat changed over the last few years.

Hi @minrk,

I read your announcement post and still was a little confused about the procedure.

I went back to the binder site (https://mybinder.org/) and provided a path to the URL above. However, the image was still opening in Jupyter lab. Any help will be greatly appreciated!

Edit: Once the file was built, I added /tree/ and that seems to bring me back to the classic notebook. Crisis adverted!

UPDATE: Some time between early September and December 2021, the form at MyBinder.org changed so that by default it makes a URL with labpath when specifying a particular notebook. Most of this discussion thread above and below don’t reflect that. HOWEVER, THIS DETAILED POST HAS BEEN UPDATED to be consistent with the current method to select the classic notebook interface, i.e., where you take the URL that the form at MyBinder.org makes and you change labpath to filepath to have launches open to the classic notebook when the session starts.


@portobello, for specifying the classic interface, you don’t want to go back to the MyBinder site. Or at least don’t take what it makes without further editing. What that sie produces will now only send you to JupyterLab.
You want to hand-edit the URLs that produces now, if you are trying to launch with the classic interface.

For example, the one @minrk posted above works great to open in the classic notebook interface:

https://mybinder.org/v2/gh/fontainedeseaux/NSI_premiere/HEAD?urlpath=%2Fnotebooks%2Fles_variables%2Fbases_python.ipynb

But you’ll see if you go to MyBinder.org now, and make one filling in the information related to that repo and that notebook:

https://github.com/fontainedeseaux/NSI_premiere/les_variables/bases_python.ipynb

It produces the following URL:

https://mybinder.org/v2/gh/fontainedeseaux/NSI_premiere/HEAD?labpath=les_variables%2Fbases_python.ipynb

And consistent with labpath being there, that will now open in JupyterLab.

You can take what MyBinder.org gives you swap out labpath from the URL and replace it with filepath, and you’ll have a link that will open that specific notebook with the classic interface.

https://mybinder.org/v2/gh/fontainedeseaux/NSI_premiere/HEAD?filepath=les_variables%2Fbases_python.ipynb

(Note that consistent with what @minrk posted above, you can also take what MyBinder.org gives you swap out labpath=les_variables and replace it with urlpath=%2Fnotebooks%2Fles_variables; but you’ll note that requires a slight bit more of editing to accomplish the same thing.)

You’ll do similar with links from MyBinder.org to your own notebooks, following that pattern.
If yours happen to be in root it is easier because you just replace labpath= with filepath=.
Feel free to specify a repo and notebook in a reply if you still are having trouble.

If you still want to use the launch badges that MyBinder.org site produces yet send users to the classic notebook interface, you just need to edit them in a similar way after-the-fact.


As an aside to your ‘EDIT’:
If you have launched in JupyterLab yourself, you can opt to switch to classic via the upper menu bar ‘Help’ > ‘Launch Classic Notebook’.
You’ll see that it takes you to the classic Jupyter dashboard and tree is at the end of the URL. For that direction, you don’t need to edit in tree in the address bar yourself because a way is built into the upper menu bar.
If you are in the classic interface at the dashboard, you can edit the URL that ends in /tree so that it ends in /lab to switch to JupyterLab. There’s not a way presently built in for that direction from classic to lab interface.

2 Likes

Hi @fomightez,

Thank you for the detailed explanation!

Since our binder link points to the entire folder of notebooks instead of a file, I think appending tree to the end of the url or using the help menu would be the best options. Thank you so much for pointing those out.

In the future, are there any plans to allowing users to bypass JupyterLab entirely?

A couple things related to that:

  1. As I suggested, it may make more sense to you if you post an example you are trying to work with so we can reply with specifics? Because you didn’t provide an example, I’m going to use the repo we were discussing at the start of this thread. You’ll have to imagine the sub-folder has more notebooks in it like yours.
    The way provided to open the classic notebook interface is the way to bypass JupyterLab. For your case where you want to go to a place to allow users to choose a notebook from that subfolder, the link would be like this to open the dashboard in the booleens sub-folder:

    https://mybinder.org/v2/gh/fontainedeseaux/NSI_premiere/HEAD?urlpath=/tree/booleens
    

    -or-

    https://mybinder.org/v2/gh/fontainedeseaux/NSI_premiere/HEAD?urlpath=%2Ftree%2Fbooleens
    

    Click here to test the launch with the first pattern.

    Right now substituting either of those patterns to the URL in a launch badge should allow you to open the classic notebook and have the classic Jupyter dashboard listing the notebooks in your sub-folder.

  2. There is also a ‘retro’ flavor of JupyterLab that you may be interested in. I made this example that has the more classic look of retrolab skin. That one also allows real-time collaboration but you won’t need the stuff pertinent to that. The key thing for the classic-looking skin is "RetroApp": { "retro_logo": false },. I describe there how to make Binder links to notebooks in retro.

    I don’t have a sub-folder there to test, but I suspect some variation of the patterns above should allow opening the Retro-flavor skin of the dashboard with the notebooks in that subfolder listed.

UPDATE:
I think I may see what prompted the ‘bypass JupyterLab entirely’ question now.
I would expect if I launched in the classic notebook interface using the correctly-triggering URL, that it would stay in that interface unless I changed the URL. However, I see that while I am in the classic notebook, clicking the Jupyter logo doesn’t take me to the classic notebook Jupyter dashboard (i.e., /tree) as expected & desired, but instead is taking me to JupyterLab. Example repo with launch badge that goes to the classic notebook interface is here. Once it launches, click the Jupyter logo in the upper left to see the behavior. @minrk Is this the behavior you’d would expect after launching from that link https://mybinder.org/v2/gh/fontainedeseaux/NSI_premiere/HEAD?urlpath=%2Fnotebooks%2Fles_variables%2Fbases_python.ipynb you posted above? (Meaning it isn’t a bug, but a ‘feature’?)

I’ll add that launching retrolab from here, I see clicking on the Jupyter icon in the upper left, does still go to the retrolab-flavored Dashboard as expected.

Hi @fomightez,

Thanks very much for the instruction. The repo I’m working with is here. The binder link we work with is https://mybinder.org/v2/gh/tianleimin/ECE4078_Practical_2021/main

I haven’t been able to successfully include the tree tag in the above URL that would launch the notebook successfully in the classic interface. i.e. cannot do “ECE4078_Practical_2021/main/tree”, but need to wait for the URL to load fully before adding the /tree tag.

The reason we want to bypass jupyter lab is because we are using interactive widgets in our notebooks and jupyter lab does not support that functionality fully. We don’t want students to be re-directed if we can just supply the correct link.

Thanks very much again for your help on this :sweat_smile:.

The following four variations on the approach I detailed above using urlpath work for your repo:

https://mybinder.org/v2/gh/tianleimin/ECE4078_Practical_2021/HEAD?urlpath=/tree/
https://mybinder.org/v2/gh/tianleimin/ECE4078_Practical_2021/HEAD?urlpath=%2Ftree%2F
https://mybinder.org/v2/gh/tianleimin/ECE4078_Practical_2021/main?urlpath=/tree/
https://mybinder.org/v2/gh/tianleimin/ECE4078_Practical_2021/main?urlpath=%2Ftree%2F

From launches from any of those, the dashboard opens in classic notebook mode at the root directory. Then for example, you can select Week01 and open any notebook in that directory. The notebook opens in classic notebook mode.

(Historically, the ones with the escape symbols, i.e., %2Ftree%2F, are the choice that worked. Only recently did I see cases where I didn’t need to escape the symbols to have things work. So I prefer the escaped versions as I know they’ve worked the longest; however, maybe it is no longer necessary.)

Here is a launch badge that should work as you wanted. Does it work for you?

Binder

The markdown form of that launch badge is:

[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/tianleimin/ECE4078_Practical_2021/HEAD?urlpath=%2Ftree%2F)
2 Likes

thank you very much for your help and tip on the symbols. the links work!

1 Like

UPDATE:

Apparently, there was some dust still setting when most of this thread was written. The big difference is that as of the middle of December 2021, I see the form at MyBinder.org produces links with labpath= as part of the URL when you specify a particular notebook with which to start the launched session.

This specific post above in this thread has been updated reflect the two current options to edit the URLS generated by MyBinder.org to switch the URLs to directing to the classic notebook interface instead of JupyterLab.

I’m noting this here because given the topic title of this thread, others may continue to end up here when looking into how to specify launching with the classic notebook interface.

3 Likes