Set Up VS Code

Install Visual Studio Code - a free, popular editor that puts your code, files, and a terminal in one window - and configure it for Python on any operating system.

🟒 Beginner ⏱️ ~30 min 🧩 Optional tool πŸ’» Windows Β· macOS Β· Linux

Where this fits

You can do everything on this site without a local editor - Google Colab runs in your browser, and RStudio comes with R. But many people prefer a proper desktop editor for writing scripts, organizing project files, and running a terminal all in one place. VS Code is one popular, free choice. This page is entirely optional - pick the workspace that suits you.

Honest framing: it's one option among several

There's no single "correct" editor. Plenty of bioinformaticians happily use Colab, Jupyter, RStudio, or VS Code - or several depending on the task. We're showing VS Code because it's free, cross-platform, and works well for Python and the command line. If you're happy in Colab or RStudio, you can skip this and lose nothing.

Pick your workspace (a neutral comparison)

ColabBrowser-based, zero install, great for learning and sharing. Needs internet; best for notebooks.
JupyterLocal notebooks (install with pip install jupyter). Excellent for step-by-step, exploratory analysis.
RStudioThe natural home for R. Tailored to R projects, plots, and packages.
VS CodeA general editor for scripts and projects in many languages, with a built-in terminal. This page sets it up.

Step 1 - Download & install VS Code

Get it from the official site: code.visualstudio.com. Then follow your OS below.

πŸͺŸ Windows Windows 10/11

  1. Download the Windows installer (.exe) from code.visualstudio.com.
  2. Run it. On the "Select Additional Tasks" screen, tick "Add to PATH" and "Open with Code" options - they make life easier later.
  3. Launch VS Code from the Start menu.

🍎 macOS Intel & Apple Silicon

  1. Download the Mac build (it's universal - works on both Intel and Apple Silicon).
  2. Unzip it and drag Visual Studio Code into your Applications folder.
  3. Open it from Applications (right-click β†’ Open the first time if macOS warns about an internet-downloaded app).

🐧 Linux Ubuntu / Debian / Fedora

  1. On Ubuntu/Debian, download the .deb and install it (double-click, or sudo apt install ./code_*.deb).
  2. On Fedora, download the .rpm and install with sudo dnf install ./code-*.rpm.
  3. Launch from your applications menu or by typing code in a terminal.

Step 2 - Open a folder for your work

VS Code works best when you open a folder (a project), not just a single file. Make a folder for your BioNexus work, then in VS Code: File β†’ Open Folder… and select it. The left sidebar (the Explorer) now shows your files.

Step 3 - Open the built-in terminal

One of VS Code's best features: a terminal lives right inside it. Open it with Terminal β†’ New Terminal (or Ctrl+`, the backtick key). This is the same command line from the Bash lessons - now docked next to your code.

Why one window matters

Editor, files, and terminal in a single place means you can write a script, run it, and read the output without switching apps. That tight loop is exactly why many people like VS Code for everyday work.

Step 4 - Add the Python extension

VS Code becomes Python-aware once you add one free extension:

  1. Click the Extensions icon in the left bar (the four-squares icon), or press Ctrl/Cmd+Shift+X.
  2. Search "Python" and install the one published by Microsoft.
  3. It pulls in helpful tools automatically (including support for Jupyter notebooks).

If you created the bionexus virtual environment earlier, VS Code will detect it. Pick it via the environment selector at the bottom of the window or the command palette (Ctrl/Cmd+Shift+P β†’ "Python: Select Interpreter").

Working in R instead?

There's also an R extension for VS Code if you'd like to use it for R - though for R specifically, many people find RStudio more comfortable out of the box. Use whichever you prefer.

Step 5 - Run your first file

  1. In your folder, create a file called hello.py (File β†’ New File, or the + in the Explorer).
  2. Type:
dna = "ATGCGT"
print("GC count:", dna.count("G") + dna.count("C"))
  1. Click the β–Ά Run button (top-right), or right-click β†’ "Run Python File in Terminal". The output appears in the terminal below.

Bonus - notebooks inside VS Code

Prefer the notebook style from the lessons? With the Python extension installed, VS Code opens .ipynb notebook files directly - same cells-and-output experience as Colab and Jupyter, just on your desktop. Create a file ending in .ipynb and start adding cells.

βœ… You're set up when…

VS Code opens your project folder, the integrated terminal works, the Microsoft Python extension is installed, and running hello.py prints output in the terminal.

Stuck? Common snags

"Run" doesn't use my bionexus environment

Press Ctrl/Cmd+Shift+P, type "Python: Select Interpreter", and choose your bionexus environment. VS Code remembers it per folder.

Typing code in the terminal does nothing (Mac)

Open VS Code, press Cmd+Shift+P, run "Shell Command: Install 'code' command in PATH", then reopen your terminal.

It looks overwhelming with lots of panels

That's normal at first. You really only need three things: the Explorer (files, left), the editor (middle), and the terminal (bottom). Ignore the rest until you need it.

Check your understanding

What is VS Code?
Which extension do you add so VS Code understands Python?
According to the lesson, why does VS Code work best when you open a folder rather than a single file?
VS Code is built around projects, so opening a folder lets the Explorer sidebar show and manage all the files for your work in one place.
What is one big advantage of VS Code's built-in terminal that the lesson highlights?
Having the editor, files, and terminal in one window means a tight write, run, read loop without app switching, which is why many people like VS Code.
The lesson is clear that VS Code is:
There is no single correct editor; the lesson presents VS Code as one free, cross-platform option, and says you lose nothing by staying in Colab or RStudio if you prefer.
Back to the foundations

Return to "Set up your toolkit" β†’