jupyterlab / jupyterlab

JupyterLab computational environment.
https://jupyterlab.readthedocs.io/
Other
14.13k stars 3.35k forks source link

Workspace Interference Between Different JupyterLab Sessions #11120

Open psychemedia opened 3 years ago

psychemedia commented 3 years ago

Installing JupyterLab-app and running it for the first time opened the app into a workspace that matched a JupyterLab workspace I was working in that was running via a local Jupyter server.

If I made changes to the JupyterLab-app workspace, and then loaded a new local server JupyterLab environment, the JupyterLab-app workspace appeared in the new local server JupyterLab environment.

Things were further complicated by the JupyterLab-app notebooks running against a Python3 kernel bundled inside JupyterLab-app, and the local server notebook running against a local Python3 kernel.

Is there a way of scoping JupyterLab workspaces somehow so that different JupyterLab sessions don't interfere with each others' workspaces?

krassowski commented 3 years ago

Phrasing this in technical terms, can we store the default workspace per virtual environment rather than once per user? I often loose workspace when switching between JupyterLab installed between virtual environments and it is a real annoyance to me. The documentation mentions that (first documented in 9c983860d893d000157de85df525c27b3edaecb7):

By default, the location is $HOME/.jupyter/lab/workspaces/, where $HOME is the user's home directory. This folder is not in the JupyterLab application directory, because these files are typically shared across Python environments. The location can be modified using the JUPYTERLAB_WORKSPACES_DIR environment variable.

So this seems to be by design. I would like to have it in the application directory, which is environment specific. It is annoying for me to set JUPYTERLAB_WORKSPACES_DIR variable for each of the projects I am working with separately, and quite impossible to do that for jupyterlab-app at the moment. I would like to suggest that we reconsider where the default workspace is stored (I agree that storing exported workspaces in shared location might be a good idea, but storing the default which restores layout after re-opening window currently leads to loss of workspace).

I think that this is something which needs fixing because causes to loss of workspace leading to annoyance (for me) and possibly frustration (for other users). It took me quite a while to connect the dots here because the workspace seemed to randomly get lost once every few times I opened JupyterLab; it was only when I started seeing that the notebooks which incidentally share the same name in both the projects A and B that I am working on getting opened in the project B after last closing project A, instead of getting different (recently opened) notebooks from project A opening. Before that I just accepted that the layout restoration is unreliable and I will be loosing some productivity due to that.

psychemedia commented 3 years ago

Would it make sense to try to address this in the UI somehow?

For example, when a user starts a particular JupyterLab instance, or launches a JupyterLab workspace (eg from a JupyterHub environment login / selection page) either,:

Where the persistent state for these settings is managed is another matter; local persistent state for each JupyterLab server exe?

amit-chandak-unskript commented 3 years ago

@psychemedia i ran into a very similar issue described here.

Steps to repro

  1. Create 2 .ipynb files in the same directory.
  2. Open one of the files using the url. For eg: http://127.0.0.1:8888/doc/tree/Untitled.ipynb
  3. In another browser (i havent tried in the same browser, different tab), open the other file using the url way.
  4. You will see that it will redirect it to the first file opened in 2.

Here is the gif for the same.

jlabredirect

meeseeksmachine commented 3 years ago

This issue has been mentioned on Jupyter Community Forum. There might be relevant details there:

https://discourse.jupyter.org/t/jupyterlab-opening-a-different-file-that-whats-passed-in-the-url/11195/7

krassowski commented 3 years ago

As mentioned on discourse I don't think this one is related to the issue discussed in here. It looks like #10876 to me.

amit-chandak-unskript commented 3 years ago

Thanks @krassowski , i am using 3.1.6. Yes, the issue you mentioned seems like the right one, let me try 3.1.16 and update here.