Issue in Terminal with redirecting to Jupyter Notebook

Hi all, I am wanting learn how to use Jupyter Notebook to help with some bioinformatic work. I have followed the instructions by downloading it, and get to this point:

But it does not redirect me, nor does that “click here to go to Jupyter” work. I am sure I’m doing something silly, but I’ve followed it as closely as I could. I have even tried to load it with

jupyer notebook --no-browser

Which gives me the following response:

[I 14:09:54.530 NotebookApp] The port 8888 is already in use, trying another port.
[I 14:09:54.530 NotebookApp] The port 8889 is already in use, trying another port.
[I 14:09:54.539 NotebookApp] Loading IPython parallel extension
[I 14:09:55.114 NotebookApp] JupyterLab extension loaded from /home/FM/ktaube/miniconda3/lib/python3.8/site-packages/jupyterlab
[I 14:09:55.114 NotebookApp] JupyterLab application directory is /home/FM/ktaube/miniconda3/share/jupyter/lab
[I 14:09:55.117 NotebookApp] Serving notebooks from local directory: /home/FM/ktaube
[I 14:09:55.117 NotebookApp] Jupyter Notebook 6.2.0 is running at:
[I 14:09:55.117 NotebookApp] http://localhost:8890/?token=3be22f770b98c6d3b247e48b91781cfd8286700813c26e97
[I 14:09:55.117 NotebookApp]  or http://127.0.0.1:8890/?token=3be22f770b98c6d3b247e48b91781cfd8286700813c26e97
[I 14:09:55.117 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 14:09:55.119 NotebookApp]

    To access the notebook, open this file in a browser:
        file:///home/FM/ktaube/.local/share/jupyter/runtime/nbserver-3359-open.html
    Or copy and paste one of these URLs:
        http://localhost:8890/?token=3be22f770b98c6d3b247e48b91781cfd8286700813c26e97
     or http://127.0.0.1:8890/?token=3be22f770b98c6d3b247e48b91781cfd8286700813c26e97

And none of those 3 options above work for me either. Please help!

Are you trying to use Jupyter from a text-based browser? I don’t think we support that.

1 Like

Hi, I am trying to use Jupyter from Chrome, if possible. Is there something in a setting that I’ve not switched on or something that makes you say that?

I think the concern about a text-based browser is because at the bottom of your screenshot you have navigation instructions that look like browser navigation directions.

Also it seems you are trying to use JupyterLab. Is your Chrome browser 100% up to date? I’ve seen JupyterLab not work if your browser is too old.

My advice is to reboot your computer so you aren’t already serving sessions on multiple ports. Then follow the basic directions. Verify you are copying the correct, long URL with the full token by pasting it in a text editor first to examine that you have it. A very basic text editor, not anything with Microsoft in the name unless it is VS Code (Visuasl Studio Code). Open Chrome and turn off any ad blockers or any fancy browser extensions. Then paste the verified URL into the address bar of your newly opened Chrome browser and hit return.

1 Like

Hi, so I went ahead and updated Chrome and restarted my PC. I tried both jupyter notebookand jupyter lab and both gave me the same results :frowning: I tried to move ahead as best as I could, and got to here. Is this informative?

I couldn’t figure out where to go or what to do, so I hit Q to quit, and saw this:

[I 10:11:19.179 LabApp] The port 8888 is already in use, trying another port.
[I 10:11:19.189 LabApp] Loading IPython parallel extension
[I 10:11:19.714 LabApp] JupyterLab extension loaded from /home/FM/ktaube/miniconda3/lib/python3.8/site-packages/jupyterlab
[I 10:11:19.714 LabApp] JupyterLab application directory is /home/FM/ktaube/miniconda3/share/jupyter/lab
[I 10:11:19.716 LabApp] Serving notebooks from local directory: /home/FM/ktaube
[I 10:11:19.716 LabApp] Jupyter Notebook 6.2.0 is running at:
[I 10:11:19.716 LabApp] http://localhost:8889/?token=e0fec0b31619db675390bc0a213408cffc6fab02f1735aca
[I 10:11:19.716 LabApp]  or http://127.0.0.1:8889/?token=e0fec0b31619db675390bc0a213408cffc6fab02f1735aca
[I 10:11:19.716 LabApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 10:11:19.720 LabApp]

    To access the notebook, open this file in a browser:
        file:///home/FM/ktaube/.local/share/jupyter/runtime/nbserver-140174-open.html
    Or copy and paste one of these URLs:
        http://localhost:8889/?token=e0fec0b31619db675390bc0a213408cffc6fab02f1735aca
     or http://127.0.0.1:8889/?token=e0fec0b31619db675390bc0a213408cffc6fab02f1735aca
^C[I 10:13:25.896 LabApp] interrupted
Serving notebooks from local directory: /home/FM/ktaube
0 active kernels
Jupyter Notebook 6.2.0 is running at:
http://localhost:8889/?token=e0fec0b31619db675390bc0a213408cffc6fab02f1735aca
 or http://127.0.0.1:8889/?token=e0fec0b31619db675390bc0a213408cffc6fab02f1735aca
Shutdown this notebook server (y/[n])? No answer for 5s: resuming operation...

So it looks like SOMETHING is happening, but none of those links worked for me. I get one of three errors when I put those links given into Chrome:

Is there anything in what I’ve mentioned that sticks out to you as something I can fix? I do not think my ad blocker is on or any extensions. How can I verify I am copying the correct URL and token, do I just look at it?

Yes, it is informative. It is running in your screenshot. It says Jupyter Notebook right at the top and is trying to render in some form the main toolbar or menu. However, just as @jasongrout was concerned about, you are trying to run it in a text based browser. Why? It tells you at the top it needs javascript. Make Chrome your default browser on your machine (verify by this by opening a page like from a local newspaper from some other application on your computer and make sure you see pictures and a rich web experience so there is a non-text based experience), and do what you did to get to that screenshot point all again. I suspect it will then work.

I suspect for security reasons you cannot have the two connections running at same time (maybe?) , and so your text-based browser is blocking access from Chrome even though you paste in that link http://127.0.0.1:8889/?token=e0fec0b31619db675390bc0a213408cffc6fab02f1735aca. You need that text based browser to be gone out of this loop.

What you should see at the end can be experienced by pasting the URL https://jupyter.org/try, which links to here, in your CHROME browser and pressing on ‘Try Classic Notebook’. JupyterNotebook should launch in classic notebook interface in Chrome. In fact, it would be nice you verified you can see that work well in Chrome before trying much more.

Ahh, I see. My thinking was this: I use the command line (ubuntu 20.04 LTS) from my Windows machine to start it up, and then without me needing to close out of my command line, the notebook will open up and I can use it. Chrome is my default web browser, and I checked to make sure of it. I am not sure I understand what you are instructing when you say “verify by this by opening a page like from a local newspaper from some other application on your computer and make sure you see pictures so there is a non-text based experience”, but I did check and Chrome is my default browser. I also checked my Chrome settings, and JavaScript is set to “Allowed (recommended)”.

One thing maybe worth noting is that I AM running from a server. I am using ssh and am connected to a VPN. The way I am understanding what you are telling me to do is to 1. make chrome my default browser (which it is), 2. enable javascript (it is enabled), and then 3. don’t use my command line? It’s unclear to me what to do here. I type: jupyter lab in the command line, which brings up that screenshot point. Nothing happens, and I try clicking out of the command line and trying again but nothing happens then either. Am I doing something stupid here, because I just don’t understand what I should be doing to fix this problem. Thank you for being so patient with me!!!

Definitely worth noting. You need to do a whole different level of things, if I am understanding properly. Did the directions you followed discuss this or were they for a simple local installation on a physical computer?

And I’m still unclear what all is involved here in your situation, and so to avoid further issues could you confirm or add to this list below:

  • You are connecting to a remote server machine from your local Windows-based computer via SSH in Ubuntu on Windows Subsystem for Linux (WSL) starting notebook on a remote server.
  • Chrome is your local browser default.
  • Some text based browser is the browser on the remote server.
  • Jupyter notebook is running on the remote server and you want to access the Jupyter notebook running on the remote machine via your local Chrome.

If I understand things correctly, this assumption is where you went off the rails. Good news though is now that you shared what you are doing, it may be easy to get you back on track. Maybe. It depends what permissions you have on this remote server or what ports are open, if you know the IP address of that machine, etc…

So the screenshots and URLs you have been sharing are written as if that is the local computer. The physical computer you are working on though is the computer with Chrome, right? The remote machine has some text based browser and is trying to use that to run the Jupyter notebook, which won’t work. You need to be using your local Chrome to render what the Jupyter notebook server is streaming out. And what you have been pasting into the Chrome address bar on your machine that begin like http://127.0.0.1:8889/... or http://localhost:8889/... assumes you have a computer and monitor connected to that machine. You don’t have that. localhost or 127.0.0.1 (IP address) is the local host on the Windows machine you are running. So when you paste that complex URL into the address bar on your local machine, Chrome tries to access the local server on the machine you are running Chrome on and isn’t seeing anything. (This is because your local machine actually isn’t where Jupyter is running.) You’d need to point Chrome somehow at the remote machine. You aren’t doing that. Yet.

I commonly run a Jupyter Notebook server on a remote Amazon EC2 machine and I think this is like what you are trying to do. (It sort of seems like you are using directions meant for installing locally on the same machine though? And not something like that?)

So confirm this is getting closer to describing your situation and let me (or us) know via a reply. And start considering what I described that you’d need to know if you want to get back on track.

Yes, that sounds right to me! I am working from home on my Windows and am connected to a server (the Phoebe server from the Field Museum here in Chicago). I am trying to install and run Jupyter by following these instructions: https://jupyterlab.readthedocs.io/en/stable/getting_started/installation.html#conda and here I am! I typically type in order

bash
ssh <myemail>@phoebe.fm.pri
(then enter my password and I’m connected to the server then, assuming I connect to the Field Museums VPN from home as well)

And then I’m in! I could type jupyter lab at that point, and there I’d be stuck. Did that help describe things further?

Yes, those directions assume you are installing and running locally.
The SSH you are using only gets your terminal there. Chrome still has no way to access the remote machine.
If you know the IP address of the remote machine, you can try substituting that in for the localhost.

The more reliable way though is to open an ssh tunnel. This is the general idea here but I find usually I just need the -L option. What I use for a tunnel is here in condensed form towards the bottom under the ‘remote instructions’ section. Key part:

Then open a new terminal window and type:
ssh -i ~/xxx.pem -L 8888:localhost:8756 ubuntu@xxx.amazon.com

(I actually start the notebook server with jupyter notebook --no-browser --port 8756 in the step before that. I think you should include --no-browser to avoid that text-based browser you know the remote machine is trying to use.)

If your remote machine has the ports you want to try open and allows http or https access, after establishing the ssh tunnel, you should be able to paste the full URL the remote machine says and point Chrome on your machine at localhost. The tunnel will take care of forwarding that localhost to the localhost of the remote machine. Make sure to use correct ports in correct spots in the tunnel command and then in the URL, if what you used doesn’t quite match the directions I shared.

Here is a more detailed resource. I don’t use the same options in my tunnel but the idea is the same.

I see, I got it to work! I’m not exactly sure what I did, or how to replicate what I just did, but I’m in! I THINK what I had to do was:

ipython notebook --no-browser --port=8889

Then, I opened up a new window without connecting to the server, and typed:

ssh -N -f -L localhost:8888:localhost:8889 <myemail>@phoebe.fm.pri

And then my password.

THEN, I went into Chrome, and typed in manually:

localhost:8888

Which then brought me to a kind of login page where I had to enter a password or token. I used the value to the right of the ?token= as the token value, and then logged in! At least, that’s what I think I did. Does that sound about right?

Yup, that all sounds right.
The ssh tunnel to connect the localhost on remote machine to localhost on your machine was what you were missing. And I think you could supply the token via the URL or add it in when you try to login like you did.

That’s great, I was able to replicate it following those instructions. I wish jupyter had t-shirts, I’d totally buy one to support this! Either way, you’re a wizard – thank you so much.

1 Like