How to run a Jupyter/iPython notebook (.ipynb) with VS Code
Contents
How to run a Jupyter/iPython notebook (.ipynb) with VS Code#
Step 1. Download VS Code#
Step 2. Get the code on your computer somehow#
Note
Do EITHER Method 1 OR Method 2 (doing both is redundant)
Method 1 (Beginner/Easy mode) - Download the repository from the web page#
Note
This method involves manually downloading the class repository from the GitHub website.
Its simple and straightforward, and the recommended option for folks who want to get things up and running as quickly as possible.
Go to : https://github.com/Biol2299-Matthis-Fall2022/Biol2299-Matthis-Fall2022
Click on
CodebuttonSelect
Download ZIPUnzip it somewhere on your computer
PROCEED TO STEP 3
Method 2 (Advanced/Cool kid hacker mode) - Clone the repo to your PC with git#
Note
This method involves cloning the repository from the command line using git.
It’s rather more advanced, but it will provide XP in the powerful magicks of git and ‘command line’/’terminal’ usage - which are important skills to master if you want to be a fancy pants comp sci hacker type 👽
Clone the repository via Git and the command line
Open your favorite command line interface (CLI)
Mac/Linux -
press
Command+spaceand search for and open a program calledTerminal
Windows
Press
Windowskey and search for/openCommand Prompt
Type
gitand press enter to check if you havegitinstalledif it says
Git not foundor something:Install Git: https://git-scm.com/downloads (just pick all the default options in the installer)
Navigate to the place you want to download the repository with
cd(‘change directory’) commandsEnter this command to download the repo to your computer
git clone https://github.com/Biol2299-Matthis-Fall2022/Biol2299-Matthis-Fall2022
Wow you did it probably! so cool 😎
PROCEED TO STEP 3
3. Open the ipynb file in VS Code#
Note
Usually, we would want to open the entire folder in the software IDE (e.g. VS Code or PyCharm) rather than openning a single ipynbfile.
…but this option is similar and I’m tired of writing this how to guide lol
In VS Code, in the top bar (aka the Menu bar)
File > ‘Open File’
Select/Open the
freemocap_center_of_mass_analysis.ipynbfile in the folder you downloaded/cloned in Step 2
Note
The path to t will be called something like:
[path_to_the_location_of_the_repo]/Biol2299-Matthis-Fall2022\jupyter_book/jupyter_ipython_notebooks/freemocap_center_of_mass_analysis.ipynb
where path_to_the_location_of_the_repo is, like, the path to the location of the repository on your computer.
For me, it looks like:
C:\Users\jonma\OneDrive\Desktop\Biol2299-Matthis-Fall2022\jupyter_book\jupyter_ipython_notebooks\freemocap_center_of_mass_analysis.ipynb
Success?!
If all went well, your VS Code window will look roughly similar to the equivalent page on the lab website:
Did it work?#
Probably not, honestly lol.
I feel like I’m probably missing some stpes here, so it’ll take some work to make this how-to actually viable.
Also, at the very least, you’ll need to remove the:
from google.colab import drive
drive.mount('/content/drive')
…part and alter the freemocap_data_folder_path variable to point towards the data folder (which you’ll also need to’ve downloaded onto your computer)
We’ll get there 😅