Difference between revisions of "Google Colab"

From PrattWiki
Jump to navigation Jump to search
(Created page with "== Printing to PDF == '''Pre-script:''' The second, more complicated method below generally comes up with much better PDFs than the first one... It just takes more work. * S...")
 
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
== Printing to PDF ==
+
== Introduction ==
 +
Google Colab will allow you to use your Google account / Google Drive folder to create, execute, and save Jupyter Notebook (.ipynb) files!
 +
 
 +
=== Create / Log-in to a Google Account ===
 +
* Go to [https://www.google.com https://www.google.com] and sign in; if you do not have a Google account, create one
 +
 
 +
=== Log-in to Google Drive ===
 +
* In another tab in the same browser, go to [https://drive.google.com https://drive.google.com]
 +
 
 +
=== Log-in to Google Colab ===
 +
* In another tab in the same browser, go to [https://colab.research.google.com https://colab.research.google.com]
 +
** In the Colab tab, click File and select "New notebook" - among other things, if you haven't gone here before, this will create a "Colab Notebooks" folder in your Google Drive
 +
 
 +
== Support ==
 +
=== Printing to PDF ===
 
'''Pre-script:''' The second, more complicated method below generally comes up with much better PDFs than the first one...  It just takes more work.
 
'''Pre-script:''' The second, more complicated method below generally comes up with much better PDFs than the first one...  It just takes more work.
  
 
* Sometimes using the File->Print command with a PDF-based destination will work fine!  Check out the preview to see if it does.  Be careful though - the issues might not creep up until deep within the notebook.  Take a look at particularly large output formatted output cells.
 
* Sometimes using the File->Print command with a PDF-based destination will work fine!  Check out the preview to see if it does.  Be careful though - the issues might not creep up until deep within the notebook.  Take a look at particularly large output formatted output cells.
 
* If that doesn't work, try this (note: this assumes that you have the Google Drive app installed such that your file system can directly see your Google Drive):
 
* If that doesn't work, try this (note: this assumes that you have the Google Drive app installed such that your file system can directly see your Google Drive):
** Make sure that you have run and saved the notebook(s) that you want to your Google Drive and that you know where they are
+
** Make sure that you have run and saved the notebook(s) that you want to your Google Drive and that you know where they are; also - '''make sure your file name has no spaces in it''' (if it does, you can rename it at a later step)
** Go to [https://colab.research.google.com/drive/1YhFLX4S8l3E_Pl_7DAYc-IuNA7e0OY1y?usp=sharing ToHTML_local.ipynb]  
+
** Go to [https://colab.research.google.com/drive/1YhFLX4S8l3E_Pl_7DAYc-IuNA7e0OY1y?usp=sharing ToHTML_local.ipynb] ([[:File:ToPDF01.png|picture]])
** Open the local files panel by clicking the folder icon at left (bottom icon) and wait for the runtime to connect - there should be a '''''sample_data''''' folder when this is done
+
** Open the local files panel by clicking the folder icon at left (bottom icon) and wait for the runtime to connect - there should be a '''''sample_data''''' folder when this is done.  ([[:File:ToPDF02.png|picture]])
 
** Click the "Upload to session storage" icon (first icon of the four above the file list; piece of paper with an up arrow)
 
** Click the "Upload to session storage" icon (first icon of the four above the file list; piece of paper with an up arrow)
** Navigate to where the .ipynb file is that you want to print and upload it to local storage
+
** Navigate to where the .ipynb file is that you want to print and upload it to local storageRepeat this for any notebooks that you want to print (you can shift-click to get multiple files from the same folder).  This will make local copies in the current runtime. ([[:File:ToPDF03.png|picture]]). '''This is where you will need to make absolutely sure your file names have no spaces'''
** Repeat this for any notebooks that you want to print (you can shift-click to get multiple files from the same folder).  This will make local copies in the current runtime
+
** Run the one cell in the ToHTML_local.ipynb - this will make an HTML version of any .ipynb files in the runtimeOnce you have done that for all the files, you can click the Refresh icon (second icon of the four above the file list; folder with a circular arrow); you can also just wait for the list to refresh itself. ([[:File:ToPDF04.png|picture]])
** Run the one cell in the ToHTML_local.ipynb - this will make an HTML version of any .ipynb files in the runtime
+
** Hover over the HTML version of the file(s) you want, click the menu button that comes up (three dots), and then choose Download.  ([[:File:ToPDF05.png|picture]])
** Once you have done that for all the files, you can click the Refresh icon (second icon of the four above the file list; folder with a circular arrow); you can also just wait for the list to refresh itself
+
** Open the HTML version of the files you want in a browser, then use the browser's print command to create a PDF.  ([[:File:ToPDF06.png|picture]])
** Hover over the HTML version of the file(s) you want, click the menu button that comes up (three dots), and then choose download
+
** There may be a great deal of extra space between cells - for this class that will be fine.
** Open the HTML version of the files you want in a browser, then use the browser's print comm end to create a PDF
 

Latest revision as of 18:54, 17 October 2023

Introduction

Google Colab will allow you to use your Google account / Google Drive folder to create, execute, and save Jupyter Notebook (.ipynb) files!

Create / Log-in to a Google Account

Log-in to Google Drive

Log-in to Google Colab

  • In another tab in the same browser, go to https://colab.research.google.com
    • In the Colab tab, click File and select "New notebook" - among other things, if you haven't gone here before, this will create a "Colab Notebooks" folder in your Google Drive

Support

Printing to PDF

Pre-script: The second, more complicated method below generally comes up with much better PDFs than the first one... It just takes more work.

  • Sometimes using the File->Print command with a PDF-based destination will work fine! Check out the preview to see if it does. Be careful though - the issues might not creep up until deep within the notebook. Take a look at particularly large output formatted output cells.
  • If that doesn't work, try this (note: this assumes that you have the Google Drive app installed such that your file system can directly see your Google Drive):
    • Make sure that you have run and saved the notebook(s) that you want to your Google Drive and that you know where they are; also - make sure your file name has no spaces in it (if it does, you can rename it at a later step)
    • Go to ToHTML_local.ipynb (picture)
    • Open the local files panel by clicking the folder icon at left (bottom icon) and wait for the runtime to connect - there should be a sample_data folder when this is done. (picture)
    • Click the "Upload to session storage" icon (first icon of the four above the file list; piece of paper with an up arrow)
    • Navigate to where the .ipynb file is that you want to print and upload it to local storage. Repeat this for any notebooks that you want to print (you can shift-click to get multiple files from the same folder). This will make local copies in the current runtime. (picture). This is where you will need to make absolutely sure your file names have no spaces
    • Run the one cell in the ToHTML_local.ipynb - this will make an HTML version of any .ipynb files in the runtime. Once you have done that for all the files, you can click the Refresh icon (second icon of the four above the file list; folder with a circular arrow); you can also just wait for the list to refresh itself. (picture)
    • Hover over the HTML version of the file(s) you want, click the menu button that comes up (three dots), and then choose Download. (picture)
    • Open the HTML version of the files you want in a browser, then use the browser's print command to create a PDF. (picture)
    • There may be a great deal of extra space between cells - for this class that will be fine.