Attach to python interpreter that's inside docker installed on WSL2

Answered

There's an awesome feature of attaching to python interpreter from docker/docker-compose. However I'm currently setting up my WSL2 environment and can't see such function.

I have my PyCharm installed on Windows, then the Docker, git and the repository itself lives in WSL2. When I attach to WSL, there's some PyCharm EAP “backend” booting up and everything works fine, but I can't find usual interpreter options in the Settings.

Is there a way to accomplish that? Or is my system-wise setup not optimal? Note that for example docker for windows is not free for bigger companies which mine happens to be.

0
3 comments

Unfortunately, this is a known regression in that WSL-based projects seem to don't have the local interpreter options. 

Additional details here - https://youtrack.jetbrains.com/issue/PY-57827/No-option-to-add-local-SSH-interpreter-in-WSL-based-project - Use the thumbs-up next to subscribe and receive updates

The latest version with your current setup that the option would show is 2022.2 but there are some workarounds mentioned in the comments by other users to use WSL 2.

Hope this helps.

0

Miguel Monteiro 
Interestingly, I found that under “File > Manage IDE Settings > Settings sync > Project” I can set add a project interpreter on Docker Compose which is exactly what I was looking for. (You must have mistaken my question for running modules/debugger directly from PyCharm which is actually far less required than the autocompletion and code inspection.)

0

Jakub Nowakowski indeed I understood that you wanted to add a local interpreter on WSL. Thank you for letting me know the solution and sorry for any confusion :)

0

Please sign in to leave a comment.