Pycharm cant run WSL 2 interpreter because Source Root is marked as a windows dir instead of WSL dir

Viewed 1379

When using the WSL python interpreter, Pycharm attempts to cd to the project Source root folder. However it is using the full windows path: \\wsl$\Ubuntu-18.04\home\ubuntu\code\my-repo
Instead of the needed WSL path: ~/code/my-repo

resulting the following error :

C:\Users\user\AppData\Local\Microsoft\WindowsApps\ubuntu1804.exe run "export PYTHONUNBUFFERED=1 && export PYTHONIOENCODING=UTF-8 && export PYTHONPATH=\\wsl$\Ubuntu-18.04\home\ubuntu\code\my-repo:/mnt/c/Users/user/AppData/Local/JetBrains/Toolbox/apps/PyCharm-P/ch-0/202.6397.98/plugins/python/helpers/pycharm_matplotlib_backend:/mnt/c/Users/user/AppData/Local/JetBrains/Toolbox/apps/PyCharm-P/ch-0/202.6397.98/plugins/python/helpers/pycharm_display && export PYCHARM_HOSTED=1 && export PYCHARM_DISPLAY_PORT=63342 && cd \\wsl$\Ubuntu-18.04\home\ubuntu\code\my-repo && /home/ubuntu/code/my-repo/venv/bin/python '//wsl$/Ubuntu-18.04/home/ubuntu/code/my-repo/code.py'"
/bin/bash: line 0: cd: \wsl$Ubuntu-18.04homeubuntucodemy-repo: No such file or directory

Pycharm Professional 2020.2

0 Answers
Related