'conda - PATH order in fish shell
I'm using miniconda on Ubuntu 20.04 with fish shell. I was able to create and activate my specific environment. My problem is with Python version which is related with $PATH.
- When I start clean fish shell, conda set it up for (base) environment
$PATHlooks like this:
PATH=/opt/conda/bin:/opt/conda/condabin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/opt/conda/bin:/snap/bin:/opt/conda/bin
it means, when I start Python it uses /opt/conda/bin/python version - conda (base) version.
- When I start my environment
conda activate XXXit switch to XXX (more precisely, switch from base to XXX) and my$PATHlooks like this:
PATH=/opt/conda/condabin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/USER/.conda/envs/XXX/bin:/snap/bin:/opt/conda/bin
it means, when I start Python it uses /usr/bin/python. It is system version of Python.
- When I start new fish shell, deactivate (base) environment and and activate created one (XXX),
$PATHlooks like:
PATH=/home/USER/.conda/envs/XXX/bin:/opt/conda/condabin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/opt/conda/bin
it means, when I start Python it uses /home/USER/.conda/envs/XXX/bin/python
Problems:
Whenever I use XXX environment I expect to use
/home/USER/.conda/envs/XXX/bin/pythonwhich is not true when I switch from (base) to (XXX). To use above python I need to deactivate base and then switch to (XXX). It seams,/home/USER/...should always be at the beginning of $PATH to choose appropriate python version.I would like to not use (base) as a default when I start new shell. I'v tried
config --set auto_activate_base falsewhich addauto_activate_base: falseto./condarcbut it seams to be ignored.
My conda version is 4.8.3. My ~/.config/fish/config.fish contains: eval /opt/conda/bin/conda "shell.fish" "hook" $argv | source.
What I'm do wrong? How can I correct it?
Solution 1:[1]
you can do it in one Line and don't bother yourself (MacOS and Linux)
/(your conda installation path)/bin/conda init fish
your condo installation usually in '/Users/- your UserName -/anaconda3'
if someone want to know about install fish, best way is Homebrew. after brew install fish you must add fish to supportable shells in /etc/shells. and then with chsh change default shell to fish.
if it's not clear ask in comment!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
