I am curious about my terminal inside the Pycharm after I have established the virtual environment. The screenshot is as follow. Is that normal to have (venv) and (base) in the front? Thanks.
My bet is (venv)
comes from PyCharm auto-activating the virtual environment you have configured as a project interpreter and (base)
is likely conda
base environment activated in ~/.bashrc
(or similar place). I guess in the terminal outside of PyCharm you only have (base)
.
Let me explain what is happening in more detail (Ubuntu and Bash as an example)
~/.bashrc
, e.g. cat ~/.bashrc
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/home/parallels/miniconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "/home/parallels/miniconda3/etc/profile.d/conda.sh" ]; then
. "/home/parallels/miniconda3/etc/profile.d/conda.sh"
else
export PATH="/home/parallels/miniconda3/bin:$PATH"
fi
fi
unset __conda_setup
# <<< conda initialize <<<
(conda)
as Bash sources ~/.bashrc
to start a new shell sessionconda
command as it was added to the PATH
environment variable$ which conda
/home/parallels/miniconda3/bin/conda
python
command in the terminal will invoke Python from Miniconda as again the PATH
environment variable was patched$ which python
/home/parallels/miniconda3/bin/python
~/.bashrc
, activates conda and you get (conda)
activate
script of the virtual environment and you get (venv) (conda)
$ which python
/home/parallels/.virtualenvs/venv/bin/python
The question is - should you care?
Probably not, apart from visual clutter, it doesn't affect you much. There are some environment variables left after conda activation which were not overridden by the venv activation but they are unlikely to affect you.
You can remove conda activation logic from ~/.bashrc
if (base)
bothers you too much. You can always activate it back manually. I believe it only make sense to leave the activation logic in place if you work with conda a lot in the terminal and want to save time re-activating it manually.