VSCode_Ubuntu.md 2.8 KB


marp: true title: Visual Studio Code for Ubuntu author: P.Y. Barriat description: How to use VSCode with Ubuntu backgroundImage: url('assets/back.png') _backgroundImage: url('assets/garde.png') footer: 14/06/2023 | Visual Studio Code for Ubuntu | PY Barriat _footer: "" paginate: true _paginate: false

math: true

Visual Studio Code for Ubuntu

https://gogs.elic.ucl.ac.be/pbarriat/learning-vscode

Pierre-Yves Barriat ELIC Training Sessions June 14th, 2023


What is Visual Studio Code :question:

Visual Studio Code (VS Code) is a lightweight but powerful source code editor which runs on your desktop and is available for Windows, macOS and Linux.

It has a rich ecosystem of extensions for languages (such as C++, Fortran, Java, Python, etc) and runtimes (Git, Jupyter, etc)

VSC is one of the most popular and powerful text editors used by software engineers today

free, open-source and available for macOS, Windows and Linux :+1:


VS Code

You can install Visual Studio Code from the web link here

wget the deb package then dpkg -i code*.deb

That's it ! :smiley:


Install extensions

  • Python
  • Jupyter


Jupyter Notebook in VS Code

Create a new Juyter Notebook

Fill the first cell

import numpy as np

Try to run the cell

you must choose a Python environment first (Python 3.6)

If :boom: ... maybe you must install a missing extension !

So open a terminal in VS Code an do

sudo apt install python3-pip

Now, install the missing Python extension ...

pip instal numpy

... and run the cell again: great, it's OK now :smiley:


Let's try a full notebook example

Install Git : sudo apt install git -y

Now clone this Git repository

git clone https://gogs.elic.ucl.ac.be/pbarriat/learning-vscode

You don't already know what's Git :question: Shame on you ! :confounded:

It's not to late: take a look here https://gogs.elic.ucl.ac.be/TECLIM/Git_Training

Now open the file example.ipynb


The first cell implies you must install some requirements

To run this example, install the extensions below

pip install netCDF4
sudo apt install libgeos-dev libgdal-dev
pip install cartopy

Now, try to run all the cells of this notebook :exclamation:


VS Code nice extensions

  • Tabnine : code faster with AI code completions
  • Regex Previewer : shows the current regular expression's matches
  • Modern Fortran : Fortran syntax is missing in built-in version

Visual Studio Code for Ubuntu :speech_balloon: