Set up VS Code - spacemedicinelab/public-wiki GitHub Wiki
After setting up the VS Code packages once, for each new notebook script you just need to do step 5 to get it up and running with py-11
1. Download the latest VS Code
https://code.visualstudio.com/
If you are on a Mac, you may need to manually move the executable Visual Studio Code.app from the Downloads to your Applications folder.
Just drag the file over like so:
2. Install Python extensions
In the Extensions page (left sidebar, icon looks like 4 squares), search python
Install the first one, which should be the latest official Python extension published by Microsoft.
Also install the extension Pylance.
3. Install Jupyter Notebook extensions
Search Jupyter in Extensions, install the first one which should also be the official extension pack published by Microsoft.
This includes 4 extensions.
4. Open project in VS Code
Go back to the home page or the 1st tab "Explorer" on the sidebar, open the project folder
(or the folder containing the .ipynb notebook that you are intended to edit/run, create a separate folder if you haven't already):
5. Change Python kernel
Open your notebook file .ipynb and select the python kernel to use (you'll need to do this each time you open a new notebook...)
Click "Select Kernel" and go through the menu like this:
- Select Another Kernel...
- Python Environments...
py-11(Python 3.11.0) ←⎯ the conda environment (py-11orhbot-dev) we created in the previous step Set up Conda Environment
- Python Environments...
If the kernel is changed successfully, you should see the name of the conda environment and its Python version in place of "Select Kernel".
[FIN] Run Python code blocks
Now you should be able to run the code by clicking the ⏩ Run All or the ▶️ button in each cell.
The two ▶️ buttons at the top right corner are also useful to know: "run all the code above this point" and "run all the code after this point."
If the code ran without errors, you should see a green checkmark at the bottom of the cell (and how long did it take to run that block of code) ✅ 4.5s