How would I change the default tab displayed to the user when JupyterLab launches? In particular I’m looking to make it a Jupyter Notebook with certain instructions.
The closest I’ve gotten to in my search was this forum thread, but it talks about building extensions (in what seems like typescript) and is over my head.
Is there no simple way to configure the default tab? Or do I have to build an extension? If so, could you guys point to some examples on github?
Thank a ton.
You can open a file by default by giving it on the command line (IIRC), like
jupyter lab myfile.ipynb
Alternatively, you could give the default url in the config, and that default url could include a
/tree/myfile.ipynb to open a file on startup.
I actually tried both of those methods and neither of them worked for me. I’m using 3.0.
Actually, it looks likes Jupyter Server 1.2.3 was broken and pulled from pypi. It looks like Jupyter Server 1.3.0 was released less than an hour ago on pypi, and probably still is being built for conda-forge.
I just checked after installing Jupyter Server 1.3.0 from pypi, and this works to open
jupyter lab --LabApp.default_url='/lab/tree/test.txt'
However, it seems that this still does not work:
jupyter lab ./test.txt. I’ll comment on that issue that it still is not fixed.
Wow, thanks for the amazing discussion. This is super helpful.
So I feel I’m 90% there but something isn’t working still.
- Generate a config file for jupyterlab:
jupyter lab --generate-config (one was generated in
- Edit the below lines:
c.NotebookApp.default_url = '/tree/README.ipynb'
c.LabApp.default_url = '/lab/tree/README.ipynb'
systemctl restart jupyterhub.service
Unfortunately when I re-login into the server I still see launcher as the default landing page. The url also never attempts to go to
It can’t be the url itself because when I manually modify it, it does indeed go to the doc:
It can’t be step #3 coz when I change other settings in the config file they do reflect. Eg I tried turning off the terminal and it disappeared from the launcher.
What am I missing?
PS Forgot to say earlier, I’m serving JupyterLab using JupyterHub over SSL. Not sure if relevant.
The fact you’re using JupyterHub is very relevant . The Jupyter ecosystem has several interacting components, so it’s always better to provide too much information than too little.
JupyterHub also has its own
default_url setting: Application configuration — JupyterHub 1.3.0 documentation
Though the behaviour may depend on the rest of your configuration, and also exactly what you want to achieve. Give that a go, and if it’s still not working then seeing your full configurations for everything might be helpful.
Ok I managed to find a solution!
The problem was indeed that I’m using JupyterHub on top of Lab and it seems to have been overwriting the default url.
- add the following line
c.Spawner.default_url = '/lab/tree/README.ipynb'
systemctl restart jupyterhub
For those not using JupyterHub, look at the answer by @jasongrout.
Thanks for all the help everyone!
Only saw your post after I posted below, but yes that was exactly the issue! Thanks!