PyCharm WSL Terminal not activating venv
In my old setup I had a Linux VM running remotely, and I used the remote development feature which worked fine, but I want to switch to WSL running on my local PC instead.
I have the tick enabled that says activate virtualenv, see the attached screenshot.
If I do source .venv/bin/activate while in the terminal it all works.
Should I just add that line to my ~/.bashrc? That might mess with other things since it won't work if I open a terminal in a directory that doesn't have a .venv, right?
I'm not sure if this is a known bug, of I am missing another kind of config, but help would be appreciated.
Thank you.
-Julian


请先登录再写评论。
Julian Herbst, the terminal not activating the environment in a WSL project is a known bug, not a missing setting: PY-45773.
The bug shows on PyCharm 2026.3 when the interpreter was added with On WSL. The status bar then shows
WSL (Ubuntu): …, and new terminal tabs open without the environment.On 2026.3 the terminal does activate
.venvin one case: a WSL project with a.venvfolder and no interpreter is opened, and PyCharm picks.venvas the interpreter by itself. The status bar then shows the interpreter as.venv [3.9.19], and new terminal tabs start with(.venv).Which PyCharm version is installed, and what does the status bar show as the interpreter?
Hello,
I'm on 2026.2.4 262.11879.98, and here is the interpreter from the status bar.
I'm not exactly sure how to set them all up on the WSL version of PyCharm and/or IntelliJ.
It also added an extra /./ in there, it should just be
/home/herbst/ideaprojects/zebrascanner-backend/.venv/bin/python.Julian Herbst, The status bar confirms the known bug: the interpreter was added with On WSL (the
WSL (Debian):prefix), and the terminal does not activate the environment for this interpreter kind. Nothing is misconfigured. The bug is present in 2026.2.4 and in the current 2026.3. The fix is tracked in PY-45773.PY-45773 lists a workaround that avoids a global change to
~/.bashrc:1) In Settings | Tools | Terminal, under Environment variables, add
VIRTUALENVwith the value/home/herbst/ideaprojects/zebrascanner-backend/.venv/bin/activate2) Add this line to
~/.bashrc:if [[ -n ${VIRTUALENV} ]]; then source ${VIRTUALENV}; fiThe
sourceline runs only when the variable is set, so terminals in other folders and outside PyCharm are not affected. Does it help in your case?The extra “/./” in the path is harmless: Linux resolves
zebrascanner-backend/./.venvandzebrascanner-backend/.venvto the same file