Check the official blog first: https://docs.microsoft.com/en-us/windows/wsl/install-win10
ENSURE THAT YOUR WINDOWS VERSION IS SUPPORTED
- Open PowerShell as Administrator and run:
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
- You may also need to enable Hyper-V by:
- Right-clicking uninstall on any classic programs installed, which will jump you to the classic programs & functionalities panel.
- Look to the left. Click on "Activate or Deactivate Windows Functionalities"
- Tick Hyper-V and Apply.
-
Restart your Windows!
-
Download and install the update from: https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_x64.msi
-
Open PowerShell as Administrator and run:
wsl --set-default-version 2
- Visit the page to get and install the WSL compatible NVIDIA driver:https://developer.nvidia.com/cuda/wsl/download
NOTE: mindless updates to the driver may cause trouble
-
Use this link to install Windows Terminal from the Store: https://www.microsoft.com/en-us/p/windows-terminal/9n0dx20hk701
-
Use this link to install Ubuntu 18.04 LTS as a Windows Store App: https://www.microsoft.com/store/apps/9N9TNGVNDL3Q
After Ubuntu installation, initialize the system by clicking on the Ubuntu application icon in the Start menu.
With the help of the navigation panel on the left of Explorer, clone the sh files in this repo to somewhere inside your created /home/
.
-
Run Windows Terminal. Use the downward arrow button to initialize a terminal with Ubuntu.
-
cd
to the folder where the.sh
files are at. -
Install
dos2unix
in case of any trouble:
sudo apt install dos2unix
- Then convert the
.sh
files to unix encoding:
dos2unix *.sh
- Get CUDA, CuDNN and python-3.8 configured by:
sudo bash WSL2_init.sh
Key-in your password. This would install cuda 10.2 and 11.2 with their corresponding cudnns. Modify to suit your needs.
Optionally, create a virtual environment at ~/ENV/
by
bash WSL2_python.sh
No sudo
this time. Then:
source ~/ENV/bin/activate
pip install --upgrade pip
pip install --upgrade tensorflow # get tensorflow + cuda 11
pip install torch torchvision torchaudio # get pytorch + cuda 10.2
Change the corresponding versions of cuda for the libraries if you would like. Test with:
source ~/ENV/bin/activate
python
When in Python:
import tensorflow as tf, torch
tf.zeros(1)
torch.zeros(1).cuda()
Check for errors. If none, enjoy!
sudo ln -s /usr/local/cuda-11.2/targets/x86_64-linux/lib/libcusolver.so.11 ~/ENV/lib/python3.8/site-packages/tensorflow/python/libcusolver.so.11