Google Colab wont connect to local runtime after update - python

I recently updated jupter_over_ws to version 0.0.7 and now Google Colab refuses to connect my local runtime.
I have tried multiple iterations of launching the localhost in chrome, running with --no-browser etc and keep receiving a 'Forbidden' 403.
The last iteration I got to in an attempt to connect to the notebook was:
jupyter notebook --NotebookApp.allow_origin='https://colab.research.google.com' --NotebookApp.port_retries=0 --notebook-dir="" --no-browser --allow-root --NotebookApp.token='' --NotebookApp.disable_check_xsrf=True --port=8888
Any help much appreciated

Colab recently updated it's local runtime connection instructions.
In particular, you'll need to provide the URL printed in the console when starting the local runtime.
Clicking the "More Details" button in the local connection dialog will provide additional instructions.

After update, you need first upgrade jupyter_http_over_ws:
pip install --upgrade jupyter_http_over_ws
And second, everytime you start the server with this code:
jupyter notebook --NotebookApp.allow_origin='https://colab.research.google.com' --port=8888 --NotebookApp.port_retries=0
It will show a new token in Anaconda's prompt, you need to copy.
When you click in Connect to local runtime in Colab, a box will ask for the token, then paste there.

I solved this by removing the password from the jupyter .config file, then copy and pasting the token url as you have outlined in the answers above, and as outlined in the official colab documentation:
https://research.google.com/colaboratory/local-runtimes.html

If you use Anaconda, you can follow the instructions:
Open cmd.exe as Administrator
Run pip install --upgrade jupyter_http_over_ws>=0.0.7 && jupyter serverextension enable --py jupyter_http_over_ws
Run jupyter notebook --NotebookApp.allow_origin='https://colab.research.google.com' --port=8892 --NotebookApp.port_retries=0
Copy the URL from the command prompt printed console ex: http://localhost:8892/?token=fecaca2501d00f89971ab8fb4a5add3ff682ade7e63f7265
Paste the URL including token in Google Colab connection settings as Backend URL

Related

Connection to the notebook server cannot be established

I used to work with Jupyter notebook normally, but after formatting my laptop and reinstall it again, notebooks take a lot of time to be charged and the connection to the notebook server cannot be established.
Also when I look at my cmd, I recognize that Jupyter tries to call some libraries which are not in this particular notebook I opened, for example, the Cose library which I used in another notebook which I didn't even open after the installation!
And I always get the following message on my notebook:
Connection to the notebook server cannot be established. The notebook will continue its attempts. Check your network connection or the settings of the notebook server.
So what should I do, I really need your help and I will be so thankful.
Two options:
You can try installing cose module - it shows ModuleNotFoundError. Probably when you reformatted your laptop, the library could have been uninstalled.
You can try re-installing conda and jupyter notebook

Invalid token when trying to login into Jupyter notebook with Docker jupyter/tensorflow-notebook

I pulled a (seemingly popular, supported by Jupyter) jupyter-tensorflow Docker image using
docker pull jupyter/tensorflow-notebook
and started it successfully with
docker run -p 8888:8888 jupyter/tensorflow-notebook
However, upon navigating to http://127.0.0.1:8888/?token=177a...., I am prompted for a password or token (despite the token already being present in the URL).
I know of no password to use, and the token 177a... does not work.
Any suggestions?
The answer turned out to be quite easy: there was an other Jupyter notebook server I wasn't aware of running. Closing it did the trick.

Installing Anaconda on Server

I have a Unix server where I have Python3 installed. I ssh to the server from my mac.
I was wondering if it possible to install Anaconda and Jupyter (will come with Anaconda) on the server so that I can just pull up Jupyter on the server terminal and run codes on jupyter running on the server.
Is it possible? And if yes, could someone guide me to the right link?
in a terminal on your remote server:
#download anaconda (change version if you want)
wget https://repo.continuum.io/archive/Anaconda3-2018.12-Linux-x86_64.sh
# run the installer
bash Anaconda3-5.1.0-Linux-x86-64.sh
# so changes in your path take place in you current session:
source ~/.bashrc
#To run a remote notebook, replace XXXX with your choice of four numbers like 9191
jupyter notebook --no-browser --port=XXXX
#copy the url that you get as a result
Then in your local machine, open up a terminal and write:
#XXXX is the port you specified in the previous step, YYYY is a local port, for example 9999 to keep it simple
ssh -f [USER]#[SERVER] -L YYYY:localhost:XXXX -N
Then copy the url from the previous step, paste it in a browser, since you used the same port, you don't have to change anything on the url
you can download anaconda using:wget https://repo.continuum.io/archive/Anaconda3-5.1.0-Linux-x86_64.sh
and install using: bash Anaconda3-5.1.0-Linux-x86_64.sh
After that just source the path of Anaconda in .bashrc file, it should work.
To access jupyter notebook, you can use ssh and run notebook in your browser on your host. Steps are mentioned in this link
Yes you can install anaconda on your linux machine (Server) and manage the python environment. But if just need Jupyter hosted in a server, just install Jupyter only and start the service which will server Jupyter Notebook. Access Jupyter notebook using your browser on any other PC.
Make a google search that how to install anaconda on Linux machine (Centos/Ubuntu etc)
After installation run following command
conda info
and then configure the Jupyter and run.
Simple way (Install Jupyter on a server): Install, Run, and Connect to Jupyter Notebook on a Remote Server

jupyter notebook command can not run correctly

After i install anaconda3 and open Jupyter,
it open by IE, i copy the url "http://localhost:8889/tree" and paste to Chrome, then it show this page
page picture link
I follow instruction enter
jupyter notebook list
but it response this error
File "", line 1
jupyter notebook list
^
SyntaxError: invalid syntax
why this error happen?
Notebook 4.3.0 has enabled login security by default. The token to enter in the password field is printed in the output of the notebook server during startup (or can be included directly in the URL)
The Jupyter Notebook is running at:
http://0.0.0.0:8888/?token=f3e7fa23fb7e347ad05914368b625416b7a95a674dc078f7
See http://jupyter-notebook.readthedocs.io/en/latest/security.html#server-security for more info, including disabling the feature.
However, this would not explain why you get the password prompt when running on one port but not on another.
same problem was asked
How to disable password request for a Jupyter notebook session?

Jupyter note notebook is not giving token while starting

Jupyter note notebook is not giving token while starting. I try to run it on cloud machine and since no token is given anyone having ip address:port can access it.
I start my notebook in docker image using
jupyter notebook
Try this?
I would recommend running Jupyter as its own docker container. With this you should just be able to do a docker pull and docker run with the correct commands

Categories