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

Jupyter Notebook cells don’t execute properly #3199

Closed
gogobd opened this issue Apr 23, 2021 · 27 comments
Closed

Jupyter Notebook cells don’t execute properly #3199

gogobd opened this issue Apr 23, 2021 · 27 comments
Labels
bug Something isn't working extension The issue needs to be fixed in the extension

Comments

@gogobd
Copy link

gogobd commented Apr 23, 2021

OS/Web Information

  • Web Browser: Brave
  • Local OS: macOS
  • Remote OS: docker on macoS
  • Remote Architecture: amd64
  • code-server --version: 3.9.3

Steps to Reproduce

  1. Click a .ipynb file

Expected

Jupyter Notebook should open, connect to a Kernel and cells should be ready to run

Actual

Even after a series of installations of plugins (that seem to work fine) the Notebook can connect to a kernel but no output is being received (all i see is "Loading...", then after some time I get the error shown in the screenshot "ChunkLoadError")

Screenshot

Screenshot 2021-04-23 at 20 50 21

Notes

This issue can be reproduced in VS Code: No idea.

@gogobd
Copy link
Author

gogobd commented Apr 26, 2021

I tried again, still no dice.

This time I tried to installed (Mini-)conda environment into docker before getting and starting code server.

1.) I click the .ipynb file, Code Server asks me if I want to search the Marketplace for support for ipnb files, I agree and install Jupyter v2021.3.0
2.) I install Python v2021.4.765268190
3.) I click the .ipynb file again and Code Server installs an ipython kernel
4.) I can select the kernel and get no error message when I connect to it
5.) I try to run a "print('Hello, world!')" cell and get the error message posted previously - after about a minute or so

@code-asher code-asher added the bug Something isn't working label Apr 26, 2021
@code-asher
Copy link
Member

Is that the only error you see in the browser console logs?

@code-asher code-asher added the extension The issue needs to be fixed in the extension label Apr 26, 2021
@gogobd
Copy link
Author

gogobd commented Apr 26, 2021

This error is seen in the editor, i didn’t look at the browsers console log

@code-asher
Copy link
Member

Oops my bad. Please post the browser console logs! The code-server logs may also be helpful although in this case probably not.

@gogobd
Copy link
Author

gogobd commented Apr 26, 2021

I was trying to provide the console logs when the bug just went away. I don't know why but it's not an issue any more. I'm closing this, sorry for the fuzz.

@gogobd gogobd closed this as completed Apr 26, 2021
@gogobd
Copy link
Author

gogobd commented Apr 26, 2021

Ok; i was able to reproduce this here's the browser's console log:

[Extension Host] Starting WebSocket: RAW/api/kernels/7d025fa9-1f07-48a9-aa46-6723eb7bc0b8

[Extension Host] Kernel: connected (7d025fa9-1f07-48a9-aa46-6723eb7bc0b8)

Starting WebSocket: BOGUS_PVSC/api/kernels/7d025fa9-1f07-48a9-aa46-6723eb7bc0b8

Kernel: connected (7d025fa9-1f07-48a9-aa46-6723eb7bc0b8)

[Extension Host] Starting WebSocket: RAW/api/kernels/f1d4f34b-d134-452e-bb8a-1ede6ecac9c5

[Extension Host] Kernel: connected (f1d4f34b-d134-452e-bb8a-1ede6ecac9c5)

[Extension Host] Starting WebSocket: RAW/api/kernels/7d025fa9-1f07-48a9-aa46-6723eb7bc0b8
console.ts:137 [Extension Host] Kernel: connected (7d025fa9-1f07-48a9-aa46-6723eb7bc0b8)
commons.initial.bundle.js:2 Starting WebSocket: BOGUS_PVSC/api/kernels/7d025fa9-1f07-48a9-aa46-6723eb7bc0b8
commons.initial.bundle.js:2 Kernel: connected (7d025fa9-1f07-48a9-aa46-6723eb7bc0b8)
console.ts:137 [Extension Host] Starting WebSocket: RAW/api/kernels/f1d4f34b-d134-452e-bb8a-1ede6ecac9c5
console.ts:137 [Extension Host] Kernel: connected (f1d4f34b-d134-452e-bb8a-1ede6ecac9c5)
commons.initial.bundle.js:2 ChunkLoadError: Loading chunk vendors~dataresource~geojson~modeldebug~nteract_transforms~nteract_transforms_vsdom failed.
(timeout: http://localhost:8080/webview/vscode-resource/file///root/.local/share/code-server/extensions/ms-toolsai.jupyter-2021.3.0/out/datascience-ui/notebook/vendors~dataresource~geojson~modeldebug~nteract_transforms~nteract_transforms_vsdom.bundle.js)
    at Function.o.e (http://localhost:8080/webview/vscode-resource/file///root/.local/share/code-server/extensions/ms-toolsai.jupyter-2021.3.0/out/datascience-ui/notebook/nativeEditor.js:1:1713)
    at http://localhost:8080/webview/vscode-resource/file///root/.local/share/code-server/extensions/ms-toolsai.jupyter-2021.3.0/out/datascience-ui/notebook/commons.initial.bundle.js:2:493888
    at http://localhost:8080/webview/vscode-resource/file///root/.local/share/code-server/extensions/ms-toolsai.jupyter-2021.3.0/out/datascience-ui/notebook/commons.initial.bundle.js:2:2003054
    at Object.next (http://localhost:8080/webview/vscode-resource/file///root/.local/share/code-server/extensions/ms-toolsai.jupyter-2021.3.0/out/datascience-ui/notebook/commons.initial.bundle.js:2:2003159)
    at http://localhost:8080/webview/vscode-resource/file///root/.local/share/code-server/extensions/ms-toolsai.jupyter-2021.3.0/out/datascience-ui/notebook/commons.initial.bundle.js:2:2002096
    at new Promise (<anonymous>)
    at s (http://localhost:8080/webview/vscode-resource/file///root/.local/share/code-server/extensions/ms-toolsai.jupyter-2021.3.0/out/datascience-ui/notebook/commons.initial.bundle.js:2:2001870)
    at e.importer (http://localhost:8080/webview/vscode-resource/file///root/.local/share/code-server/extensions/ms-toolsai.jupyter-2021.3.0/out/datascience-ui/notebook/commons.initial.bundle.js:2:493770)
    at e.getComponent (http://localhost:8080/webview/vscode-resource/file///root/.local/share/code-server/extensions/ms-toolsai.jupyter-2021.3.0/out/datascience-ui/notebook/commons.initial.bundle.js:2:485940)
    at http://localhost:8080/webview/vscode-resource/file///root/.local/share/code-server/extensions/ms-toolsai.jupyter-202

@gogobd gogobd reopened this Apr 26, 2021
@gogobd
Copy link
Author

gogobd commented Apr 26, 2021

I was now reproducing this issue both with a conda environment and debian buster python3 (both inside docker). Code Server asks me to install the Jupyter extension, then Python, then it installs ipython Kernel; unfortunately the ChunkLoadError comes up every time now again.

@code-asher
Copy link
Member

code-asher commented Apr 26, 2021

I tried to replicate but I ran into issues with the extension activating at all; I'm getting the error mentioned here: #2929

I'd be interested in seeing if downloading and installing the extension from OpenVSX instead of our marketplace works for you: https://open-vsx.org/extension/ms-python/python

@gogobd
Copy link
Author

gogobd commented Apr 26, 2021

With https://open-vsx.org/api/ms-python/python/2020.10.332292344/file/ms-python.python-2020.10.332292344.vsix installed (and de-selecting Extensions: Automatic Updates first) it was kinda worse - I wasn't even able to connect to the ipython Kernel. Even though at one point Code Server has installed ipython.

@code-asher
Copy link
Member

I gave it a try and I'm seeing the same thing (or something similar). It says Not connected. If I click it to connect it fails with:

Error: Jupyter cannot be started. Error attempting to locate jupyter: Data Science libraries jupyter and notebook are not installed in interpreter Python 2.7.17 64-bit

If I switch to Python 3 using the button in the status bar I get this instead:

Error: Jupyter cannot be started. Error attempting to locate jupyter:

Jupyter is in my path so I'm not sure why.

So then I opened the command pallete and switched the interpreter there instead and for some reason that worked. (Credit here: https://stackoverflow.com/questions/60330837/jupyter-server-not-started-no-kernel-in-vs-code)

I don't know if any of that applies to your situation but maybe it'll be helpful.

@gogobd
Copy link
Author

gogobd commented Apr 28, 2021

When I shift-reload code server i see "Connecting to Python 3", then the icon goes green and I'm connected (idle). But a cell containing "print('Hello, world!')" just yields "Loading...", then, later, the error I posted above (ChunkLoadError: Loading chunk vendorsdataresourcegeojsonmodeldebugnteract_transf...). So for me connecting (supposedly) works, execution doesn't.
@code-asher Thank you very much for your help, though! I think it helped clarify this issue :-)

@code-asher
Copy link
Member

code-asher commented Apr 28, 2021

Ah that's unfortunate. This won't be helpful but running cells is working for me (similar code, just a simple print) (3.9.3 on Firefox and Linux.)

I don't think we've seen the browser logs yet with the OpenVSX version so posting those might lead to a clue.

@gogobd
Copy link
Author

gogobd commented Apr 28, 2021

I was posting the console log before (#3199 (comment)) maybe i should just post the Dockerfile

@gogobd
Copy link
Author

gogobd commented Apr 28, 2021

FROM debian:buster-slim

ENV SHELL /bin/bash
  
# Install system dependencies
RUN apt-get update \
 && DEBIAN_FRONTEND=noninteractive apt-get install -y \
    curl \
    wget \
    git \
    screen \
    unzip \
    vim \
    procps \
 && apt-get clean

# Install miniconda
RUN curl -sfLO https://repo.anaconda.com/miniconda/Miniconda3-py39_4.9.2-Linux-x86_64.sh \
 && /bin/bash Miniconda3-py39_4.9.2-Linux-x86_64.sh -b -p /root/miniconda \
 && PATH="/root/miniconda/bin:$PATH" \
 && conda install -c anaconda jupyter

## Code server
RUN mkdir -p ~/.local/lib ~/.local/bin
RUN curl -sfL https://github.com/cdr/code-server/releases/download/v3.9.3/code-server-3.9.3-linux-amd64.tar.gz | tar -C ~/.local/lib -xz
RUN mv ~/.local/lib/code-server-3.9.3-linux-amd64 ~/.local/lib/code-server-3.9.3
RUN ln -s ~/.local/lib/code-server-3.9.3/bin/code-server ~/.local/bin/code-server
RUN PATH="~/.local/bin:$PATH"

WORKDIR /app
CMD ~/.local/bin/code-server --bind-addr 0.0.0.0:8080 /app

# docker build -t jupyter .
# docker run -v $(pwd):/app -p 8080:8080 -p ... -it -d jupyter
# docker exec -it <dontainer_id> cat /root/.config/code-server/config.yaml

@code-asher
Copy link
Member

code-asher commented Apr 28, 2021

Oh those weren't the logs with the version from our marketplace and not the OpenVSX one?

I'll give the Dockerfile a run when I get a chance.

@gogobd
Copy link
Author

gogobd commented Apr 28, 2021

With OpenVSX I wasn't able to connect to the kernel - and I tried again now via Command Palette: The Command is available but no Kernels are being presented. It's very weird because console log says "Kernel: connected (099ad007-dbfd-48c6-ab30-003320fe07a9)" but the icons don't change, it keeps saying "Python3: Not Started". Note: I had two packages installed: Python v2020.10.33 (OpenVSX) and Jupyter v2021.3.0 (from Marketplace).

@code-asher
Copy link
Member

code-asher commented Apr 28, 2021

Oh maybe that's it! I actually forgot to mention I had a similar problem. I tried to uninstall the Python and Jupyter extensions and then install the OpenVSX Jupyter extension (it contains both Python and Jupyter from before they were split) but I ended up having to wipe the extensions in ~/.local/share/extensions and then install the OpenVSX one again.

VS Code doesn't actually remove extensions from disk when uninstalling so I think it causes weird issues when adding a different version of an uninstalled extension manually.

@gogobd
Copy link
Author

gogobd commented Apr 28, 2021

I was using docker and actually deleted the images and containers frequently for a fresh start; the ~/.local/share/code-server/extensions/ are not in my /app dir so I think that can't be it...
Thank you very much for your help, it's very appreciated!

@gogobd
Copy link
Author

gogobd commented Apr 28, 2021

Oh, and I can't find a dedicated "Jupyter" Extension on OpenVSX!

@code-asher
Copy link
Member

Ah right that makes sense.

The Python extension on OpenVSX includes both Python and Jupyter.

It was split into two extensions but OpenVSX still has the version from before the split.

@code-asher
Copy link
Member

I gave your Dockerfile a run and everything worked! My exact steps:

  1. Save Dockerfile as test.Dockerfile
  2. docker build -t code-server . -f test.Dockerfile
  3. docker run -e PASSWORD=test -p 8080:8080 code-server
  4. Browse to localhost:8080 and log in
  5. Open terminal
  6. Run wget https://open-vsx.org/api/ms-python/python/2020.10.332292344/file/ms-python.python-2020.10.332292344.vsix
  7. Extensions > Install from VSIX > Select downloaded VSIX
  8. Refresh the page
  9. Open command palette
  10. Select Create New Blank Jupyter Notebook
  11. Add print("hello") to the cell
  12. Click run

@gogobd
Copy link
Author

gogobd commented Apr 28, 2021

This is so weird, I was trying

docker build -t jupyter .
docker run -v $(pwd):/app -p 8080:8080 -it -d jupyter
docker exec -it <dontainer_id> cat /root/.config/code-server/config.yaml (to see the generated password)

Then follow 4, 5, 6, 7, 8, 9, 10, 11 and 12

And all I got is "Loading..." and then the ChunkLoadError. That was quite unexpected because we were using the same Dockerfile. My Docker host is macOS Big Sur 11.3; But my Broser is Brave - so i tried Safari and: The cell executed!

@gogobd
Copy link
Author

gogobd commented Apr 28, 2021

I turned off "Shields" for localhost:8080 but the cells are still not executing in Brave (still working fine in Safari). This whole thing is a browser issue!

@gogobd
Copy link
Author

gogobd commented Apr 28, 2021

After deleting all user data related to Brave and re-installing it cell execution works again like it should!

@gogobd
Copy link
Author

gogobd commented Apr 28, 2021

Thanks, @code-asher your help solved my issue!

@gogobd gogobd closed this as completed Apr 28, 2021
@code-asher
Copy link
Member

Very interesting! I'm glad we got it sorted! 😄

@gogobd
Copy link
Author

gogobd commented Apr 28, 2021

For completeness: after resetting Brave this issue is gone even when I use the Marketplace Extensions Jupyter v2021.3.0 and Python v2021.4.765268190 which are being installed as defaults (code server 3.9.3)!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working extension The issue needs to be fixed in the extension
Projects
None yet
Development

No branches or pull requests

2 participants