'Add conda to path in fish
~> conda install pandas
fish: Unknown command 'conda'
I understand that I need to add conda to PATH, but no matter what combinations of commands I tried, I could get it to work. I still get the above error.
Solution 1:[1]
Install Anaconda
Run
conda init fishIn your
~/.config/fish/config.fishyou should see some lines added by Anaconda:#>>> conda initialize >>> # !! Contents within this block are managed by 'conda init' !! eval your/path/to/anaconda3/bin/conda "shell.fish" "hook" $argv | source # <<< conda initialize <<<Restart the terminal. You should see now Anaconda activating the
(base)environment. Check runningecho $CONDA_PREFIXthe loaded environment is pointing in the right place.
Hope this helps. Let us know if you still have problems
Solution 2:[2]
Where is conda installed? If it's in ~/anaconda/bin, then you want to run this:
Try set -U fish_user_paths ~/anaconda/bin $fish_user_paths
Modifying PATH is discussed in the fish tutorial
Hope that helps!
Solution 3:[3]
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 mush 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!
Solution 4:[4]
I assume you have 'config.fish'(create if you don't have) file in ~/.config/fish/ directory. Now add the following to the file 'config.fish':
set PATH /home/<user>/anaconda3/bin $PATH
Then save the file. Close the current terminal (fish shell) and open again. Now you can use Anaconda's python.
To check: run python3 and you will see:
Python 3.7.1 (default, Dec 14 2018, 19:28:38)
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
To use conda activate env command
Enter this command on your fish shell:
conda init fish
Now, restart the terminal and use any conda command you like.
Solution 5:[5]
If running conda init fish prevents fish from running (as it did for me), it would be better to just remove whatever conda has added to the ~/.config/fish/config.fish file and just add the following line.
source /Users/yourname/anaconda3/etc/fish/conf.d/conda.fish
assuming Anaconda is installed in /Users/yourname/
Solution 6:[6]
Conda command will not work until you run the conda init fish. but on fish terminal it will also not work.
- Open Fish/bash terminal
it will open the bash inside fish, incase you opened fish
$ bash
- then init the conda
conda init fish
You are done
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 | nicdelillo |
| Solution 2 | ridiculous_fish |
| Solution 3 | moraei |
| Solution 4 | nicdelillo |
| Solution 5 | Ébe Isaac |
| Solution 6 | CodePerfectPlus |
