I want to know if it's possible to work in a virtual environment while ssh'ed to google colab. I tried ssh'ing to google colab and did it but when I was going to code a .ipynb file I needed to select the kernel and when I tried selecting the one from my Conda Virtual Environment it did nothing. Wanted to know if it's possible or if I did something wrong. If you know some guide or video that teaches how to do this link it if possible, I already searched but found nothing. Thanks
After ssh'ing to google colab i tried inserting my conda env kernel in the VS Code kernel button but it did nothing so i couldn't run my .ipynb file
I'm not sure if it helps, but if you want to work on a running Jupyter server using VScode, you need to connect to that remote jupyter server.
Here's the link to doc https://code.visualstudio.com/docs/datascience/jupyter-notebooks#_connect-to-a-remote-jupyter-server
But also I'm not sure if collab supports plugins which vscode needs to install to run Jupyter remotely. But you should definitely try and install the Jupyter add-on first.
On my windows PC, i have Anaconda installed, but today i could not open Jupyter Notebook correctly. When i use these commands to set up an enviornment, i can open the Jupyter notebook.
conda activate [name_of_the_environment]
jupyter notebook
The error occurs when internet explorer opens the Jupyter notebook, because i can't access to my ipynb files or any other. The page just stays like this (in blanc, like it does not end loading):
Internet explorer general site
Trying to open a file
I am not having any connection problems and this happens regardless of the file size.
I also tried updating Anaconda, but it didn´t work.
Code written in the terminal:
Code
I'm trying to move my data science Environment to VSCODE, it seems a really powerfull IDE to deal with multiple languages and with great versatility,
But currently I'm dealing with an annoying issue with the python and jupyter extension,
Expected behaviour
Using command palette 'Jupyter: Create blank new Jupyter notebook' it should open a .ipynb file with all the features of a jupyter notebook.
(source: https://code.visualstudio.com/docs/datascience/jupyter-notebooks)
Actual behaviour
Using command palette 'Jupyter: Create new blank notebook' it opens a jupyter notebook with all the features and the proper jupyter notebook layout, but with extension .txt.
I tried to save it as .ipynb but returns and error and don't let me save it.
When I create a file manually with 'filename.ipynb' it creates a file with the jupyter icon, but without all the features of a jupyter notebook.. it is a simple plain script file like a .py file.
I already have done a lot of web search looking for some solution, but without success.
already tried reinstall vscode and downgrade some versions of the python and jupyter extensions, but all without success.
Any help to solve this would be appreciated.
Environment data
VS Code version: 1.59.0
Extension version : Python v2021.8.1105858891, Jupyter v2021.8.1195043623
OS and version: Windows 10 64bit
Python version : Python 3.9.6 64bit
This might be a dumb question but I'm using Google Colab to host notebooks for my students. I create the notebooks in a local Anaconda Python 3 environment, and when I upload them to Google Colab this warning pops up:
I know that it won't cause problems, and the notebook will run just fine. But is there a way to change the the notebook runtime to Python 3 so my students don't see this message and panic?
You can open the notebook with a text editor. It's just a json file.
You can edit it, change conda-env-py3-py to python3
I have a Google Colaboratory Notebook for Data Analysis that I want to output as a HTML file as currently not everything loads within the Colab environment such as large Folium Heatmaps. Is it possible to export the notebook as a html file as opposed to the ipynb and py options?
Method using Google Colab only
Download your .ipynb file
You can actually do it using only Google Colab. File -> Download .ipynb
Reupload it so Colab can see it
Click on the Files icon on the far left:
Then Upload to session storage:
Select & upload your .ipynb file you just downloaded.
Get your file's path
then obtain its path (you might need to hit the Refresh button before your file shows up):
Conversion using %%shell
Then, just as in Julio's answer, execute in a Colab cell:
%%shell
jupyter nbconvert --to html /PATH/TO/YOUR/NOTEBOOKFILE.ipynb
The %%shell lets the interpreter know that the following script is interpreted as shell. Don't write anything before %%shell, use a distinct cell for this.
The form of /PATH/TO/YOUR/NOTEBOOKFILE.ipynb will be something like /content/lightaberration3.ipynb.
Your file is ready
Might need to click Refresh again, but your notebook.html will appear in the files, so you can download it:
The great thing about this is that nothing python-related has to be installed on your computer, not conda, not pip, only a browser.
Google Colab doesn't currently have such a feature as a built-in.
Your best route is to first download it through File > Download .ipynb and then use the standard tool for Jupyter Notebook conversion, nbconvert:
jupyter nbconvert --to html notebook.ipynb
If you use an Anaconda Python distribution, nbconvert is most likely already installed. If not, refer to what is described in their install instructions to be able to convert:
pip install nbconvert
# OR
conda install nbconvert
to continue with "Method using only Google Colab"
" %%shell jupyter nbconvert --to html /PATH/TO/YOUR/NOTEBOOKFILE.ipynb" - as given
the following worked for me - type the following in Google Colab
!pip install nbconvert
%shell jupyter nbconvert --to html /content/testfile.ipynb
(instead of using %%shell in Google Colab, use %shell - this way, it worked for me)
Download your notebook and upload it back to the colab
Replace PATH_TO_THE_NOTEBOOK_IN_COLAB in the below command to the location of the reuploaded notebook.
Use this command to download the notebook as html => !jupyter nbconvert --to html PATH_TO_THE_NOTEBOOK_IN_COLAB.ipynb.
I tried the approach above but couldn't get it to work - for small jobs I log onto https://jupyter.org/try , upload the downloaded ipynb file from Google Colab and then I opened the file, from here you will have the functionality in jupyter.org to download as html or whatever other format you require. It took the pain out of trying to get it to work.