|
@@ -0,0 +1,133 @@
|
|
|
+---
|
|
|
+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: 01/06/2023 | Visual Studio Code for Ubuntu | PY Barriat
|
|
|
+_footer: ""
|
|
|
+paginate: true
|
|
|
+_paginate: false
|
|
|
+math: true
|
|
|
+---
|
|
|
+
|
|
|
+Visual Studio Code for Ubuntu<!--fit-->
|
|
|
+===
|
|
|
+
|
|
|
+https://gogs.elic.ucl.ac.be/pbarriat/learning-vscode
|
|
|
+
|
|
|
+![h:250](assets/ubuntu_logo.png)![h:250](assets/logo_vscode.png)
|
|
|
+
|
|
|
+**Pierre-Yves Barriat**
|
|
|
+ELIC Training Sessions `June 13th, 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](https://code.visualstudio.com/download) for macOS, Windows and Linux :+1:
|
|
|
+
|
|
|
+---
|
|
|
+
|
|
|
+# VS Code
|
|
|
+
|
|
|
+You can install Visual Studio Code from the web link [here](https://code.visualstudio.com/download)
|
|
|
+
|
|
|
+`wget` the **deb** package then `dpkg -i code*.deb`
|
|
|
+
|
|
|
+That's it ! :smiley:
|
|
|
+
|
|
|
+---
|
|
|
+
|
|
|
+## Install extensions
|
|
|
+
|
|
|
+- Python
|
|
|
+- Jupyter
|
|
|
+
|
|
|
+![h:400](assets/vscode_extensions.png)
|
|
|
+
|
|
|
+---
|
|
|
+
|
|
|
+# Jupyter Notebook in VS Code
|
|
|
+
|
|
|
+Create a new Juyter Notebook
|
|
|
+
|
|
|
+![h:200](assets/new_ipynb.png)
|
|
|
+
|
|
|
+Fill the first cell
|
|
|
+
|
|
|
+```python
|
|
|
+import numpy as np
|
|
|
+```
|
|
|
+
|
|
|
+---
|
|
|
+
|
|
|
+Try to run the cell
|
|
|
+
|
|
|
+> you must choose a Python environment first (Python 3.6)
|
|
|
+>
|
|
|
+> ![h:100](assets/vscode_pyenv.png)
|
|
|
+
|
|
|
+If :boom: ... maybe you must install a missing extension !
|
|
|
+
|
|
|
+So open a **terminal** in VS Code an do
|
|
|
+
|
|
|
+```bash
|
|
|
+sudo apt install python3-pip
|
|
|
+```
|
|
|
+
|
|
|
+---
|
|
|
+
|
|
|
+Now, install the missing Python extension ...
|
|
|
+
|
|
|
+```bash
|
|
|
+pip instal numpy
|
|
|
+```
|
|
|
+
|
|
|
+![h:350](assets/vscode_add_ext.png)
|
|
|
+
|
|
|
+... 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**
|
|
|
+
|
|
|
+```bash
|
|
|
+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
|
|
|
+
|
|
|
+```bash
|
|
|
+pip install netCDF4
|
|
|
+sudo apt install libgeos-dev libgdal-dev
|
|
|
+pip install cartopy
|
|
|
+```
|
|
|
+
|
|
|
+Now, try to run all the cells of this notebook :exclamation:
|
|
|
+
|
|
|
+---
|
|
|
+
|
|
|
+# Visual Studio Code for Ubuntu :speech_balloon:
|