Skip to content

Latest commit

 

History

History
242 lines (162 loc) · 6.71 KB

1.2.2_tool_setup_wsl.md

File metadata and controls

242 lines (162 loc) · 6.71 KB

DU Class Notes Table of Contents



DU AI Bootcamp Windows WSL Tool Setup

0. Other articles on setting up WSL for python envirnments

1. WSL linux command prompt.

Insure that you have installed windows terminal. See instructions here:

2. install python

Install python on WSL

This will install python and pip on WSL. PIP is a package manager for Python packages.

sudo apt upgrade
sudo apt install python3 python3-pip
sudo ln -s /usr/bin/python3 /usr/bin/python

Then verify the install and check python version

python --version

3. install anaconda

There are two options - Anaconda and miniconda.

  • Anaconda and Miniconda are both Python distributions.
  • Anaconda includes hundreds (~3000) of packages, whereas Miniconda includes just a few.
  • conda is an open source tool that comes with both Anaconda and Miniconda, and it functions as both a package manager and an environment manager.

3.1 Install Anaconda

3.2 Alternate - Install Miniconda to save HD space

Miniconda Install Summary:

These four commands quickly and quietly install the latest 64-bit version of the installer and then clean up after themselves. To install a different version or architecture of Miniconda for Linux, change the name of the .sh installer in the wget command.

mkdir -p ~/miniconda3
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda3/miniconda.sh
bash ~/miniconda3/miniconda.sh -b -u -p ~/miniconda3
rm -rf ~/miniconda3/miniconda.sh

After installing, initialize your newly-installed Miniconda.

# Replace <PATH_TO_CONDA> with the path to your conda install
#source <PATH_TO_CONDA>/bin/activate

source ~/miniconda/bin/activate
conda init

The following commands initialize for bash and zsh shells:

~/miniconda3/bin/conda init bash
~/miniconda3/bin/conda init zsh

Verify Miniconda version:

conda --version

Add conda-forge to support some newer versions of packages

conda config --add channels conda-forge
conda config --set channel_priority strict

3.1 Create conda environment

conda create --name dev
conda activate dev

4. install git

Follow the instructions for installing git on linux

Summary:

 sudo apt install git-all

then check the git version

git --version

5. github token

See the github token section of the windows tool install. The difference for wsl is that you will use windows terminal with wsl instead of git-bash.

6. gitlab ssh key

See the gitlab SSH key section of the windows tool install. The difference for wsl is that you will use windows terminal with wsl instead of git-bash.

Summary:

install xclip

sudo apt install xclip

See any existing keys

ls –al ~/.ssh

Generate a new key

ssh-keygen –t rsa
# enter a passphrase

Link your key to your machine

eval `ssh-agent -s`
ssh-add ~/.ssh/id_rsa

To copy your public key:

xclip < ~/.ssh/id_rsa.pub

Alternate - to copy your public key:

cat id_rsa.pub
#copy string starting with SHA256 to end of line.

Go to GitLab's SSH key preferences

  • This is under your profile -> SSH keys

6.5 Git reset local repo

Reset the local repo to match the remote repo.

This typically works:

git reset HEAD~

For a full reset to match the remote repo

git fetch origin
git reset --hard origin/master

7. VSCode

Install VSCode on windows. This VSCode instance can connect to WSL for your windows python environment. In this case VSCode extensions will be installed either for your windows environment or for your connected WSL connected environment.

In order to get the maximum usefulness out of this setup, you need to install a couple of extensions:

In VSCode click on the remote connection iscon in the lower left corner of the VSCode window.

  • Select the WSL installation to use.

Extensions

Extensions may be installed in the default area of VSCode for the native windows use. They may also be installed in a WSL Connection area for use with the WSL environment.

Extensions in WSL area:

  • python
  • python debugger
  • Jupyter
  • Jupyter Cell Tags
  • Jupyter Notebook Renderers
  • Supyter Slide Show
  • Jupyter Keymap
  • markdownlint
  • rainbow csv