My default python interpreter has been set to conda's base environment python interpreter. I would want my default /usr/bin/python3 to be the default.
I've looked at this question which suggests that changing the ordering in PATH would work. However I'm a fish user, so the task becomes a bit more tedious.
Just changing the PATH environment variable using set -U PATH <my path> doesn't work probably because of the following section in my config.fish
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
if test -f /home/cmaspi/miniconda3/bin/conda
eval /home/cmaspi/miniconda3/bin/conda "shell.fish" "hook" $argv | source
end
# <<< conda initialize <<<
Here conda "shell.fish" "hook" is probably the culprit that changes PATH, but I'm not sure. How do I change the path such that my good old /usr/bin/python3 becomes my default?
In short:
fish_add_pathcan be told to move a path to the front of $PATH:("--move" tells it to move already included paths, "--path" tells it to operate on $PATH directly)
This will take care to only leave one /usr/bin in $PATH, and if it already is in front it won't do anything.
If you have a $PATH of
and conda sets it to
this will turn it into
You could also store your old $PATH and move all those parts to the front:
Or you could move the conda components to the back of $PATH with
--append(using the actual paths my installation uses):The
condainvocation here isn't doing anything magic.It prints code, and
sourcethen reads that code. You can just inspect it by running/path/to/conda shell.fish hook, and see what it prints.The important bit here is
conda activate baseright at the end.condais a function that the hook defines, and if you follow it you see thatconda activate basewould end up running(where $CONDA_EXE is the path to conda)
This is another command that ends up printing fish code, and you can run it and see that
conda shell.fish activate baseprints, among other things:where "/opt/miniconda3/bin" and "/opt/miniconda3/condabin" are new and the rest is my old $PATH. So it really just adds these components in front.