Developing in the WSL with VSCode

Sun October 10, 2021
development wsl vscode

The Windows Subsystem for Linux lets developers run a Linux environment on a Windows OS, which is considerably lighter than VMs. The following is the first post of a series that will detail the deployment of python applications in a Linux container on Azure.

I use VSCode as my preferred IDE, and a couple of extensions are necessary on this platform:

Connecting to the Windows Subsystem for Linux from VSCode is then very easy.

connectvscode

Upon selecting a project folder and opening (or creating) a python file, VSCode will ask to install the recommended extensions for python in this subsystem. Once the Python extensions are installed, the relevant interpreter can be selected.

Being a ‘new’ subsystem, python libraries must be installed. As we now have a ‘new’ subsystem, we must install python libraries. It is recommended to execute the following steps if the pip command does not work:

This should enable commands like pip install numpy to work.

As a test, we use the following simple program that adds two numpy arrays.

import numpy as  np

a=np.random.rand(3,3)
b=np.random.rand(3,3)
 
print(a)
print(b)
print(a+b)

The application can be executed by using the usual command Python: Run Python file in terminal or by keying in python3 «filename.py» in the terminal.




comments powered by Disqus


machine-learning 27 python 21 fuzzy 14 azure-ml 11 hugo_cms 11 linear-regression 10 gradient-descent 9 type2-fuzzy 8 type2-fuzzy-library 8 type1-fuzzy 5 cnc 4 dataset 4 datastore 4 it2fs 4 excel 3 paper-workout 3 r 3 c 2 c-sharp 2 experiment 2 hyperparameter-tuning 2 iot 2 model-optimization 2 programming 2 robotics 2 weiszfeld_algorithm 2 arduino 1 automl 1 classifier 1 computation 1 cost-functions 1 development 1 embedded 1 fuzzy-logic 1 game 1 javascript 1 learning 1 mathjax 1 maths 1 mxchip 1 pandas 1 pipeline 1 random_walk 1 roc 1 tools 1 vscode 1 wsl 1