Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cell output not preserved even when server-side execution is enabled #339

Closed
francesco-ballarin opened this issue Aug 21, 2024 · 6 comments
Labels
bug Something isn't working

Comments

@francesco-ballarin
Copy link

Description

Hi,
I saw #279, and was eager to use it on my system with motivations similar to the one in jupyterlab/jupyterlab#2833.
However, cell output does not get preserved even when following the instructions in the PR.

I show below how to replicate with a docker container, but I actually have the same issue on my host machine (without docker).

Reproduce

Open a new docker image with docker run -it --rm -p 80:80 debian:testing
and run the following

apt -y update
apt -y upgrade
apt -y dist-upgrade
apt install -y python3-pip

rm /usr/lib/python3.12/EXTERNALLY-MANAGED
rm -rf /usr/local/lib/python3.12/dist-packages

pip install jupyterlab
pip install "jupyverse[jupyterlab, auth]"

# I need the following patch
sed -i 's|self.prefix_dir = Path(sys.prefix)|self.prefix_dir = Path(sys.prefix) / "local"|g' /usr/local/lib/python3.12/dist-packages/jupyverse_api/lab/__init__.py
# because python3 comes from /usr (installed via apt), while jupyter is installed in /usr/local (via pip).

# In my actual system I also need to run
# sed -i 's|for d1 in s.iterdir():|for d1 in s.iterdir():\n                if (d1 / "package.json.orig").exists():\n                    continue|g' /usr/local/lib/python3.12/dist-packages/fps_lab/routes.py
# because I have folders where package.json.orig is in the d1 rather than its subdirectory d2
# (for instance, created by ipyparallel). For simplicity, we do not install those packages here.

jupyverse --host 0.0.0.0 --port 80 --set kernels.require_yjs=true --set jupyterlab.server_side_execution=true

Got to the jupyter URL, create a new notebook with content

from time import sleep
i = 1
while True:
    print(i)
    i+=1
    sleep(1)

and run the cell. Save, close and re-open the tab. The output is not updated after opening the new tab.

It may not be relevant, but I also noted that the html output is not exactly the same as in the video in #279:

  • the video has [ ] next to the second cell while it runs, while I have [*] as in jupyterlab
  • in the video there is an odd extra new line between one number and the next. I don't have that extra space.

Expected behavior

Something similar to the video in #279

Context

  • Operating System and version: Debian testing (both on the host and on the container)
  • Browser and version: Chrome 127.0.6533.119
  • JupyterLab version: see below
# pip list | grep jupy
fps_jupyterlab              0.6.0
jupyter_client              8.6.2
jupyter_core                5.7.2
jupyter-events              0.10.0
jupyter-lsp                 2.2.5
jupyter_server              2.14.2
jupyter_server_terminals    0.5.3
jupyterlab                  4.2.4
jupyterlab_pygments         0.3.0
jupyterlab_server           2.27.3
jupyverse                   0.6.0
jupyverse_api               0.6.0
@francesco-ballarin francesco-ballarin added the bug Something isn't working label Aug 21, 2024
@krassowski
Copy link
Member

It looks like you do not have the latest jupyter-collaboration packages installed. You would need v3 which is in beta currently.

@krassowski
Copy link
Member

There is also https://github.com/datalayer/jupyter-server-nbmodel as an alternative. You do not need to install all of jupyter-collaboration, just "jupyter-docprovider>=1.0.0b1" and "jupyter-server-ydoc>=1.0.0b1".

@francesco-ballarin
Copy link
Author

It looks like you do not have the latest jupyter-collaboration packages installed. You would need v3 which is in beta currently.

Well, how silly of me ;)

However, pip install "jupyter-server-ydoc>=1.0.0b1" results in

Installing collected packages: pycrdt, sqlite-anyio, jupyter-ydoc, pycrdt-websocket, jupyter-server-fileid, jupyter-server-ydoc
  Attempting uninstall: pycrdt
    Found existing installation: pycrdt 0.8.31
    Uninstalling pycrdt-0.8.31:
      Successfully uninstalled pycrdt-0.8.31
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
fps-yjs 0.6.0 requires pycrdt<0.9.0,>=0.8.16, but you have pycrdt 0.9.8 which is incompatible.
Successfully installed jupyter-server-fileid-0.9.2 jupyter-server-ydoc-1.0.0b2 jupyter-ydoc-2.1.1 pycrdt-0.9.8 pycrdt-websocket-0.14.1 sqlite-anyio-0.2.3

Should I be installing some other dependencies with --pre? Adding --pre to the installation of jupyterlab didn't help, and upgrading jupyter-ydoc with --pre didn't help either.

Thanks for the super fast reply!

@krassowski
Copy link
Member

fps-yjs sounds like something from jupyverse, maybe the jupyverse version you are installing does not yet support newer pycrdt?

@davidbrochart
Copy link
Collaborator

Indeed, I'll have to update jupyverse to support latest pycrdt.

@francesco-ballarin
Copy link
Author

Indeed, I'll have to update jupyverse to support latest pycrdt.

Fixed in the most recent jupyverse release. Closing.

@francesco-ballarin francesco-ballarin closed this as not planned Won't fix, can't repro, duplicate, stale Sep 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants