Been a few years since I had to make a new dev environment in WSL2, and my previous article is a little outdated from 2021.
# Update apt-get if this is a fresh Linux distro install
sudo apt update && sudo apt upgrade
# Install Git and zsh
sudo apt-get install git zsh tree
# Install oh my zsh
sh -c "$(wget https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh -O -)"
# Install powerlevel10k
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
# Configure p10k
source ~/.zshrc
p10k configure
touch ~/.personal_macros
echo 'source ~/.personal_macros' >> ~/.zshrc
echo 'alias open="explorer.exe"' >> ~/.personal_macros
Starting with pyenv, see this gist
# On Debian/Ubuntu/Linux Mint ------------
sudo apt install curl git-core gcc make zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev libssl-dev
Then poetry
follows this checklist: Poetry Checklist Gist
Most everything went smoothly, but I ran into some issues with getting my WSL2 setup for python development using both poetry
and pyenv
.
After having pyenv
and poetry
installed, I went to use pyenv install 3.10.12
to install a new python version and it resulted in an error saying _tkinter not found
and _libffi not found
. I would try to go and do sudo apt-get install libffi-dev
and sudo apt-get install tk-dev
but it would mess up saying something like:
sudo apt-get install libffi-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package libffi-dev
The solution was to go back and go back to the system python and delete the newly created python version with pyenv uninstall 3.10.12
and then:
# Make sure you're in the original system python
sudo apt-get update && sudo apt-get upgrade
sudo apt-get install libffi-dev tk-dev
# Now we should be able to install without errors, i.e.
# pyenv install 3.10.12
Reference: pyenv/pyenv#94