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 not shown on screen #4395

Open
RnoldR opened this issue Oct 25, 2021 · 34 comments
Open

Jupyter notebook not shown on screen #4395

RnoldR opened this issue Oct 25, 2021 · 34 comments
Labels
extension Extension related but not a request

Comments

@RnoldR
Copy link

RnoldR commented Oct 25, 2021

OS/Web Information

  • Web Browser: Firefox 93.0
  • Local OS: Ubuntu 21.04
  • Remote OS: same (running locally)
  • Remote Architecture: Installed anaconda (conda version 4.10.3)
  • code-server --version: 3.12.0

Steps to Reproduce

  1. Open an existing notebook
  2. The file kind of opens, meaning the contents are not shown, the wait indicator is running but the outline can be shown. It can be run as well but does not recognize the installed python interpreter (ms-python) or jupyter notebook (ms-toolsai). It asks again and again to install a python interpreter.
  3. New markdowns can be added, show up in the outline (without text) but not on the screen.
  4. The same happens when creating a new notebook
  5. Notebooks can be normally created, opened and run in local vscode (1.61.1)
  6. code-server has been removed and installed again to see if anything differed. That was not the case.

Python code runs as expected.

Expected

When opening an existing notebook, it shows the notebook on the screen that can be run using F5. Also it should be aware of already existing installed python environments.

I would like to see a jupyter notebook and be able to run the cells like in the local version.

Actual

Nothing.

Logs

Log files are added. There is no log activity to be seen on the screen (code-server.log) when I try to open and run a jupyter notebook.

Screenshot

Has been added. The editor shows a blank screen but the outline shows that a lot is present. The sidebar is identical as that of local vscode.

Notes

This issue can be reproduced in VS Code: No

code-server.log
exthost.log
remoteagent.log
telemetry.log
code-server

@HelloGithubC
Copy link

I have the same issue

@code-asher
Copy link
Member

Seems likely related to our recent extension issues in our marketplace in which case it would be fixed by our switch to Open VSX #4319.

Workarounds are to install the .vsix or switch to Open VSX early.

@code-asher code-asher added the extension Extension related but not a request label Oct 27, 2021
@cccs-jc
Copy link

cccs-jc commented Nov 8, 2021

I'm having the same issue. Could you elaborate a bit more on the workaround. I've tried to install the .vsix but they are incompatible requiring vscode 1.61.

@cccs-jc
Copy link

cccs-jc commented Nov 9, 2021

@code-asher would like to get more details on enabling jupyter notebooks. Thanks.

@code-asher
Copy link
Member

code-asher commented Nov 10, 2021 via email

@snowypeakxu
Copy link

I've installed the prereleased ver. 4.0.0, which uses OpenVSX by default, but the issue still persist. Do I miss anything to fix the issue? Or we need to wait for the stable ver. 4.0.0?

@code-asher
Copy link
Member

code-asher commented Jan 4, 2022 via email

@benz0li
Copy link
Contributor

benz0li commented Jan 27, 2022

See #4689 (comment)

[...] Do you access code-server in private/incognito mode? 👉 If so: Try disabling private/incognito mode or make an exception for your IP address/domain.

Service workers do not work in private/incognito mode. Accessing code-server via HTTP instead of HTTPS may cause further problems.

See https://demo.jupyter.b-data.ch for a reference deployment using JupyterHub and JupyterLab + code-server.

and #4689 (comment)

[...] as already mentioned in your screenshot, in both cases this issue is caused because the lack of https://. several features only work using https://

plus

[...] one must explicitly open a folder (File > Open Folder...) before opening a Jupyter notebook.

@benz0li
Copy link
Contributor

benz0li commented Jan 27, 2022

You may also docker run --rm -p 8888:8888 -e GEN_CERT=yes -v jupyter-user-jovyan:/home/jovyan [image] with any of the following images:

  • registry.gitlab.b-data.ch/jupyterlab/r/r-ver
  • registry.gitlab.b-data.ch/jupyterlab/r/tidyverse
  • registry.gitlab.b-data.ch/jupyterlab/r/verse
  • registry.gitlab.b-data.ch/jupyterlab/r/geospatial
  • registry.gitlab.b-data.ch/jupyterlab/julia/ver

@benz0li
Copy link
Contributor

benz0li commented Aug 9, 2023

@RnoldR Could you resolve this by now?

If yes, please close.

@rohit901
Copy link

rohit901 commented Sep 7, 2023

Im having same issue as OP. I've installed code server with:
curl -fsSL https://code-server.dev/install.sh | sh -s -- --method standalone

Do I have to change some extension to make notebooks work automatically and properly in code server?

@benz0li
Copy link
Contributor

benz0li commented Sep 7, 2023

Im having same issue as OP. I've installed code server with: curl -fsSL https://code-server.dev/install.sh | sh -s -- --method standalone

Do I have to change some extension to make notebooks work automatically and properly in code server?

@rohit901 Have you already installed the Jupyter extensions? https://open-vsx.org/extension/ms-toolsai/jupyter

@rohit901
Copy link

rohit901 commented Sep 7, 2023

@benz0li
thank you for the quick reply.
I have installed Jupyter extension from the extension sidebar in vs code server, should I try to install it in any other way?

To be clear, I'm running the server like this:
.local/bin/code-server --bind-addr 0.0.0.0:11000

this is the log generated:

[2023-09-07T10:23:01.832Z] info  code-server 4.16.1 94ef3776ad7bebfb5780dfc9632e04d20d5c9a6c
[2023-09-07T10:23:01.833Z] info  Using user-data-dir ~/.local/share/code-server
[2023-09-07T10:23:01.844Z] info  Using config file ~/.config/code-server/config.yaml
[2023-09-07T10:23:01.844Z] info  HTTP server listening on http://0.0.0.0:11000/
[2023-09-07T10:23:01.845Z] info    - Authentication is enabled
[2023-09-07T10:23:01.845Z] info      - Using password from ~/.config/code-server/config.yaml
[2023-09-07T10:23:01.845Z] info    - Not serving HTTPS
[2023-09-07T10:23:01.845Z] info  Session server listening on /home/rohit.bharadwaj/.local/share/code-server/code-server-ipc.sock
[14:23:04]




[14:23:04] Extension host agent started.
File not found: /home/rohit.bharadwaj/.local/lib/code-server-4.16.1/lib/vscode/out/vsda.js
File not found: /home/rohit.bharadwaj/.local/lib/code-server-4.16.1/lib/vscode/out/vsda_bg.wasm
[14:23:05] [][08d9405d][ManagementConnection] New connection established. 
[14:23:06] Using the in-memory credential store as the operating system's credential store could not be accessed. Please see https://aka.ms/vscode-server-keyring on how to set this up. Details: Could not connect: No such file or directory
[14:23:06] [][b6a5cae8][ExtensionHostConnection] New connection established.
[14:23:08] [][b6a5cae8][ExtensionHostConnection] <2265961> Launched Extension Host Process.

Then I go to the IP and that specific port in my browser to access code server.

please refer the attached figures.

Fig_1

Fig_2

@benz0li
Copy link
Contributor

benz0li commented Sep 7, 2023

Then I go to the IP and that specific port in my browser to access code server.

You are not using HTTPS. This is required for Jupyter notebooks.
ℹ️ Fully qualified domain name (FQDN) required, too. TLS for an IP is not sufficient.

HTTP only works for 127.0.0.1 / localhost.

Cross reference: #5475 (comment)

@benz0li
Copy link
Contributor

benz0li commented Sep 7, 2023

@rohit901 If you run this on your actual computer (i.e. localhost) you could

.local/bin/code-server --bind-addr 127.0.0.1:11000

and access either via http://127.0.0.1:11000 or http://localhost:11000

Then, Jupyter Notebooks will work.

@rohit901
Copy link

rohit901 commented Sep 7, 2023

I see thank you for your reply @benz0li.
Could you please suggest what is the fix in this case? In my last message I have updated the comment to output server logs and indeed it says [2023-09-07T10:23:01.845Z] info - Not serving HTTPS
how to make it serve HTTPS?

How can I fix this issue? Because I'm basically running code-server on my university workstations.
There is a SLURM process which first allocates a workstation to us, on that workstation, I run VS Code server, and then I open browser in my local machine and put the IP of allocated workstation with the port to access vs code server.

@rohit901
Copy link

rohit901 commented Sep 7, 2023

@benz0li since i'm not running on my actual computer and using a remote computer to run the server and I want to access VS code server in my local computer, what should be the fix for this jupyter notebook issues?

Currently this is the only way in which I can use VS Code on my remote university machine because of SLURM. Earlier I could directly use remote SSH extension in my local VS Code and directly SSH to remote workstation by IP. Now the workstation is allocated through SLURM, and to run jupyter notebooks this is the only way for me.

@benz0li
Copy link
Contributor

benz0li commented Sep 7, 2023

@rohit901 Is there Docker or Podman available on the remote workstation?

EDIT: Or could you install it yourself and already know how to use Docker/Podman?

@rohit901
Copy link

rohit901 commented Sep 7, 2023

@benz0li I'm afraid not.
We also do not have sudo access in our workstations.

My university IT team showed me a "hack", where they run a separate jupyter server in the code-server terminal like:
jupyter-lab --ip 0.0.0.0 --NotebookApp.allow_origin='*'

and then they open the notebook and click on existing jupyter server and try to put the server IP with token [ex: http://ip:8888/lab?token=aeea2bcab512e0d85450485348ce128e59bfb5a2dcd72501], but it does not work sometimes and they suggested to use chrome and give access to access clipboard, by going here:

chrome://flags/#unsafely-treat-insecure-origin-as-secure

and I have to add the IP of the remote machine on this list each time and relaunch chrome and run notebook and hope it takes the existing jupyter server running in code-server terminal.

basically this is a lengthy and long process which has lot of friction. I want it to be smooth like my local VS Code. Lot of students in my university are also facing same issues as me because we need to be able to use Jupyter notebooks to interactively debug/experiment. I want to use it inside VS Code itself so I can use extensions like CoPilot, I will later have to see how to install this extension manually.

@rohit901
Copy link

rohit901 commented Sep 7, 2023

is there any way to use HTTPS when i run code server if its possible? It will be an easy fix/solution right?

@benz0li
Copy link
Contributor

benz0li commented Sep 7, 2023

@rohit901 You may try .local/bin/code-server --cert --bind-addr 0.0.0.0:11000.

Otherwise see https://coder.com/docs/code-server/latest/guide#using-a-self-signed-certificate

@benz0li
Copy link
Contributor

benz0li commented Sep 7, 2023

@rohit901 Or ask the IT department of your university about deploying e.g. my/b-data's JupyterLab Python docker stack (which includes code-sever) do proper TLS termination (Caddy/Nginx/Træfik/whatever) and hook it up to the universities LDAP/AD server.

Demo environment: https://demo.jupyter.b-data.ch (with GitHub authentication).

@rohit901
Copy link

rohit901 commented Sep 7, 2023

@rohit901 You may try .local/bin/code-server --cert --bind-addr 0.0.0.0:11000.

Otherwise see https://coder.com/docs/code-server/latest/guide#using-a-self-signed-certificate

@benz0li
I tried your first method, and getting this error [refer the pic please]
Screenshot 2023-09-07 at 2 57 53 PM

Also it shows "Not secure" in my browser tab, and I had to manually click on "proceed (unsafe)" to access
Screenshot 2023-09-07 at 3 00 10 PM

@benz0li
Copy link
Contributor

benz0li commented Sep 7, 2023

@benz0li I tried your first method, and getting this error [refer the pic please]

Most likely due to the self-signed certificate.

Then you must use mkcert to create a self-signed certificate that's trusted by your operating system, then pass the certificate to code-server via the cert and cert-key config fields. (Check also code-server --help)

For known working solutions see #5671 (comment)

@rohit901
Copy link

rohit901 commented Sep 7, 2023

@benz0li Thank you for your efforts and time.
I explored mkcert and even installed pre compiled binary on my remote machine, however to use the command:
mkcert -install
it is asking for sudo access which I don't have.
Thus maybe I will have to follow the existing hack given by my IT team and as mentioned in your above comment as defining as secure origin in chrome://flags/#unsafely-treat-insecure-origin-as-secure

@benz0li
Copy link
Contributor

benz0li commented Sep 7, 2023

I explored mkcert and even installed pre compiled binary on my remote machine, however to use the command:
mkcert -install
it is asking for sudo access which I don't have.

@rohit901 mkcert is to be used on the local machine.

Copy the certificate and certificate key to the remote machine and pass them to code-sever via the --cert and --cert-key options.


--cert: Path to certificate.
--cert-key: Path to certificate key.

@benz0li
Copy link
Contributor

benz0li commented Sep 7, 2023

@rohit901 You may generate the locally-trusted certificate for whatever URL you want.

Then, add an entry to /etc/hosts (Linux/macOS) in order to direct this URL to the IP of the remote machine.

@rohit901
Copy link

rohit901 commented Sep 7, 2023

@benz0li this process of adding IP of each new remote machine can be bit cumbersome. Even in the chrome solution of adding IP to this box chrome://flags/#unsafely-treat-insecure-origin-as-secure in this link seems to fix the issue and maybe simpler, so would skip this way by mcert then. But thank you for your insights and for being patient and also helping me.
there are lot of remote machines with different IP in my university so I feel chrome way is easier.

@JohnLyonX
Copy link

I also encountered this problem. The version I downloaded is version 4.19.1. Can anyone tell me the solution or the reason?
截屏2023-11-30 15 51 18

@code-asher
Copy link
Member

code-asher commented Dec 4, 2023

@PoJohnX are you using a secure context (localhost or https)? Did you get any error messages or popups? Anything in the browser logs? What version of code-server and what version of the extensions?

Edit: whoops, sorry I missed that you are using version 4.9.1 of code-server. Let me know the answers to the other questions so we can debug!

@JohnLyonX
Copy link

@PoJohnX are you using a secure context (localhost or https)? Did you get any error messages or popups? Anything in the browser logs? What version of code-server and what version of the extensions?

Edit: whoops, sorry I missed that you are using version 4.9.1 of code-server. Let me know the answers to the other questions so we can debug!

I might have known it was because there was no SSL certificate. I really appreciate you taking the time to answer my questions. wish you a happy life.

@NarayanSchuetz
Copy link

NarayanSchuetz commented Jan 11, 2024

@rohit901 If you run this on your actual computer (i.e. localhost) you could

.local/bin/code-server --bind-addr 127.0.0.1:11000

and access either via http://127.0.0.1:11000 or http://localhost:11000

Then, Jupyter Notebooks will work.

At least for me this is the fix if you want to run it locally.
Note that the 127 is crucial for it to work, 0.0.0.0 or localhost did NOT work for me properly code-server --bind-addr 127.0.0.1:11000 (technically localhost should map to 127.0.0.1 but in my case it for some reason didn't).
Also for those trying to use this on remote machines, maybe you can ssh tunnel, and then do the above.

@rohit901
Copy link

At least for me this is the fix if you want to run it locally. Note that the 127 is crucial for it to work, 0.0.0.0 or localhost did NOT work for me properly code-server --bind-addr 127.0.0.1:11000 (technically localhost should map to 127.0.0.1 but in my case it for some reason didn't). Also for those trying to use this on remote machines, maybe you can ssh tunnel, and then do the above.

Thanks @NarayanSchuetz, I have managed to get Jupyter notebooks running on remote machine by using the chrome flag method described in #5671 (comment)

@scatkit
Copy link

scatkit commented Jan 24, 2024

The 127.0.0.1 ip address is the only working option for me now. I have my ubuntu deployed through Vultr. But I myself am on windows 10.
My steps:

  1. Add 8080 port to Windows firewall if you don't have it: netsh advfirewall firewall add rule name="AllowPort8080" dir=in action=allow protocol=TCP localport=8080
  2. Specify the Window's port you want to use (8080 in my case). Then the ip address you want to remote into (127.0.0.1:8080) with the same port. And your server (user@instance-ip) ssh -L 8080:127.0.0.1:8080 user@instance-ip
  3. Once you connect to your server, launch './code-server'
  4. Connect to 127.0.0.1:8080 in your browswer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
extension Extension related but not a request
Projects
None yet
Development

No branches or pull requests