Visual Studio Code, Python linting with WSL (Windows Subsystem for Linux)

From what I can tell, if you're using WSL, the shell is a separate environment from VSCode. That's why the git extension won't work unless you install the Windows version, even if you've installed it in WSL. And while it is possible to invoke WSL from Windows, I've not been able to get it working.

So for linting, install Python and flake8 in Windows (e.g. pip install flake8 in Git Bash) and you should be fine.

P.S. If someone can tell me otherwise, I'd love to know! It's a bit annoying having to essentially download stuff twice (once in Windows, once in WSL).


Visual Studio Code just released a tutorial to properly run the application with WSL.

Remote development in WSL


I've been struggling with this myself after switching back to windows , I found this: https://github.com/Microsoft/vscode-python/issues/67

Which is the open issue that covers this exact scenario, there are a couple hacks and work arounds in the comments but as it is now a visible and high priority issue the real solution is to wait for a fix in vs code.

Alternatively you can install VS Code in the WSL environment using this guide: https://nickjanetakis.com/blog/using-wsl-and-mobaxterm-to-create-a-linux-dev-environment-on-windows

This would be running the linux version of VS code so it would be linting using the environments installed there.