You can use Google Colab in VS Code . Now , You can learn how to setup Google Colab in VS Code.
There are two ways to do it :
- Colab connecting to local runtime in VS Code
- Installing Jupiter and
google.colab
modules
Colab connecting to local runtime in VS Code
Install Jupyter on your local machine.
Install and enable the
jupyter_http_over_ws
jupyter extension (one-time)
Thejupyter_http_over_ws
extension is authored by the
Colaboratory team and available on GitHub.
pip install jupyter_http_over_ws
jupyter serverextension enable --py jupyter_http_over_ws
Start server and authenticate
New notebook servers are started normally, though you will need to set a flag to explicitly trust WebSocket connections from the Colaboratory frontend.
jupyter notebook \ --NotebookApp.allow_origin='https://colab.research.google.com' \ --port=8888 \ --NotebookApp.port_retries=0
Once the server has started, it will print a message with the initial backend URL used for authentication. Make a copy of this URL as you'll need to provide this in the next step.Connect to the local runtime
In Colaboratory, click the "Connect" button and select "Connect to local runtime...". Enter the URL from the previous step in the dialog that appears and click the "Connect" button. After this, you should now be connected to your local runtime.Install Jupyter Extension in VS Code.
Setup colab in VS Code.
PressF1
to open command palette , and typeJupyter: Specify Jupyter server for connections
than select that option.
Then Click onExisting
. Enter the URL from the previous step-4 , you copied.
**Yahoo!** , You connected colab to VS Code. You can use all modules that you use in colab.
Here we have Full Advantages , No Disadvantages.
😵 This is the Long method to install and setup in VS Code.
But second way is very easy.
Installing Jupiter and google.colab
modules
This is very east to setup from fist one. Here we have Advantages and Disadvantages , there are :
Advantages - Full use of colab in VS Code.
Disadvantages - google.colab
module will be not supported to some computer or python versions in this method.
Ready To Go -->
Install Jupyter Extension in VS Code .
Install Jupyter on your computer. Than you want to install some modules manually to prevent error in vscode , there are :
--> DONE ! , you setup is completed.
😎 YA! , This was very very easy .
Now , Open your project and get into it!
There methods are tested and expreienced by Me (Junaid)
Writer : Junaid
Publisher : Junaid
Top comments (2)
Hi there,
For step 3 of Colab connecting, what server are you referring to starting and authenticating? The Jupyter server? If so, could you walk through steps 3 and 4?
Thanks!
Answers
pip install jupyter_http_over_ws
jupyter serverextension enable --py jupyter_http_over_ws
to enable jupyter to run a local host server.jupyter notebook \ --NotebookApp.allow_origin='https://www.example.com' \ --port=8081
ola! Done!
Simple Explanation
This post tells about that how to connect google colab to your local computer and connect jupyter to VS Code.
TESTED AND VERIFIED By Junaid.