Can't get remote wsl interpreter to work with pytest

Answered

Whenever I try to run a test via pytest in pycharm 2020.2 using an interpreter in WSL, I get a file not found error as below. It looks like the path to the test file is somehow getting mangled.

 

Testing started at 5:02 PM ...
C:\Users\lminer\AppData\Local\Microsoft\WindowsApps\ubuntu2004.exe run "export PYTEST_RUN_CONFIG=True && export PYTHONPATH=\\wsl$\Ubuntu-20.04\home\lminer\git\separate:/mnt/c/Users/lminer/AppData/Local/JetBrains/Toolbox/apps/PyCharm-P/ch-1/202.5792.43/plugins/python/helpers/pycharm_matplotlib_backend:/mnt/c/Users/lminer/AppData/Local/JetBrains/Toolbox/apps/PyCharm-P/ch-1/202.5792.43/plugins/python/helpers/pycharm_display:/mnt/c/Users/lminer/AppData/Local/JetBrains/Toolbox/apps/PyCharm-P/ch-1/202.5792.43/plugins/python/helpers/pycharm && export PYCHARM_DISPLAY_PORT=63342 && export PYTHONIOENCODING=UTF-8 && export PYTHONUNBUFFERED=1 && export PYCHARM_HELPERS_DIR=/mnt/c/Users/lminer/AppData/Local/JetBrains/Toolbox/apps/PyCharm-P/ch-1/202.5792.43/plugins/python/helpers/pycharm && export PYCHARM_HOSTED=1 && export PYTHONDONTWRITEBYTECODE=1 && cd \\wsl$\Ubuntu-20.04\home\lminer\git\separate\tests\separate && /home/lminer/anaconda3/envs/separate2/bin/python /mnt/c/Users/lminer/AppData/Local/JetBrains/Toolbox/apps/PyCharm-P/ch-1/202.5792.43/plugins/python/helpers/pycharm/_jb_pytest_runner.py --target 'test_separate_train.py::test_fit_unet_waveform_time_mae_attention'"
zsh:cd:1: no such file or directory: \wsl$Ubuntu-20.04homelminergitseparatetestsseparate

Process finished with exit code 1

Empty suite

0
4 comments

Do you store your project inside WSL? It's not supported and moving the project to a local drive should solve the problem.

It looks similar to https://youtrack.jetbrains.com/issue/PY-43023

0
Avatar
Permanently deleted user

That is exactly the problem. Are there plans to support editing projects inside WSL? Editing projects locally is a non-starter for me as I do a lot in the CLI and I don't want to have to deal with DOS.

0

Same problem here, I thought it would work like it does on Visual Studio Code, but I can't enjoy the full functionalities of Pycharm with the WSL interpreter.

 

Do you plan to support it in a near future ?

0

@Matthieu Desprez

Yes, we do. The feature request https://youtrack.jetbrains.com/issue/PY-43023 is in progress and we plan to add it to PyCharm 2021.1

0

Please sign in to leave a comment.