Ubuntu on Windows

Today I was struggling to work on python virtual environment and realised that running a Python Virtual env in windows is not as simple and easy as compared to Linux, the difficulty here is attributed to two major things.

  • How to activate the virtual env (including installing and setting up python)
  • Where goes your virtualenv

Unlilke Linux, where the projects directory is in my home dir, in windows it could possible be technically anywhere if you are the only user of your system. So I decided to install Ubuntu on my windows Laptop. I have heard earlier that Ubuntu comes compaitable with Windows 10. Installing and settingup Ubuntu on Windows is fairly easy but Before i jump on telling how you should set up Ubuntu on Linux here is my quick guide of setting up python development environment on windows.

To Setup Ubuntu Desktop Let’s quickly go to Microsoft Store installed on your windows machine and Search for Ubuntu – I got the latest Ubuntu image as Ubuntu 20.04

Ubuntu 20.4 in microsoft store

Downloading Ubuntu doesn’t really make it work. We need to do some tweaking with our windows machine, before we can actually launch Ubuntu Linux.

While I clicked on the Launch Button, I got this error

Here we need to enable the Linux Subsystem for Windows, a detailed guide on how to enable the subsytem is provided by Microsoft here.

Step 1 – Enable the Windows Subsystem for Linux

Open PowerShell as Administrator and run:

dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart

Step 2 – Enable Virtual machine feature

dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart

and thats it. Though i later on went ahead and got WLS2 enabled. The command and guide for that also given with the above document from Microsoft.

%d bloggers like this: