Skip to main content

v1.0

by z mbstaff

Introduction

Visual Studio Code (or VS Code) is a popular program for writing and running code. This guide shows how to set it up to run python on the ZMB virtual machines.

  1. Book and open any of the ZMB virtual machines. This guide currently works for all ZMB VMs except for ZMB Standard VM and ZMB High Performance Server
    • Book and open any of the ZMB virtual machines.

    • This guide currently works for all ZMB VMs except for ZMB Standard VM and ZMB High Performance Server

    • Open Visual Studio Code

  2. Open a folder where your code is/will be saved (File > Open Folder...) When prompted to allow Host, click Allow (only needed at 1st setup) Per default, any new folder is opened in restricted mode. To allow execution of code, specify that you trust this folder:
    • Open a folder where your code is/will be saved (File > Open Folder...)

    • When prompted to allow Host, click Allow (only needed at 1st setup)

    • Per default, any new folder is opened in restricted mode. To allow execution of code, specify that you trust this folder:

    • Below the top bar, click on Manage

    • Click Trust (if you trust the content of the selected folder)

  3. On the left side, you can browse files inside the selected folder The following steps are only needed at 1st setup:
    • On the left side, you can browse files inside the selected folder

    • The following steps are only needed at 1st setup:

    • When creating/opening a python (.py) file for the first time, VS Code will prompt you to install the recommended extension. Click Install

    • When prompted to install uv, click Don't ask again. (We only support using python via conda environments. See this guide for how to use/set up conda environments)

  4. With a python file open, click on Select Python Interpreter to choose a python interpreter for this folder (bottom right) Choose a conda environment from the list (either use a pre-installed one or set up your own. See this guide for how to use/set up conda environments.)
    • With a python file open, click on Select Python Interpreter to choose a python interpreter for this folder (bottom right)

    • Choose a conda environment from the list (either use a pre-installed one or set up your own. See this guide for how to use/set up conda environments.)

    • If no environments are listed, try to restart VS Code

    • Execute the python file by pressing the play button

    • The output will be shown in the integrated terminal

  5. You can run a jupyter notebook directly from VS Code Open a notebook
    • You can run a jupyter notebook directly from VS Code

    • Open a notebook

    • Click "Select Kernel" to choose the environment to use

    • Only during 1st setup: Install the suggested extensions

  6. To select a kernel, choose "Python Environments..." Select the conda environment you want to use Make sure the environment has IPyKernel installed
    • To select a kernel, choose "Python Environments..."

    • Select the conda environment you want to use

    • Make sure the environment has IPyKernel installed

    • If no conda environments are listed, try to restart VS Code. If still no environments are listed, go to "Create Python Environment" > "Enter Interpreter Path" and manually add the environment. Managed envs can be found in C:\Conda\managed-envs and custom installed envs in C:\Users\<username>\conda

    • Start interacting with your jupyter notebook. For more information see here: https://code.visualstudio.com/docs/datas...

Finish Line

z mbstaff

Member since: 5/6/19

5,774 Reputation

102 Guides authored

0 Comments

Add Comment



View Statistics:

Past 24 Hours: 0

Past 7 Days: 0

Past 30 Days: 5

All Time: 5