22
~> 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.

7 Answers 7

37
  1. Install Anaconda

  2. Run conda init fish

  3. In your ~/.config/fish/config.fish you 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 <<<
    
  4. Restart the terminal. You should see now Anaconda activating the (base) environment. Check running echo $CONDA_PREFIX the loaded environment is pointing in the right place.

Hope this helps. Let us know if you still have problems

2
  • 2
    Since the conda command wasn't in PATH you'll maybe have to execute conda with it's full path. It can for example be found by which conda. For me it was at /opt/anaconda/bin/conda or at /opt/anaconda/condabin/conda.
    – vstollen
    Nov 2, 2020 at 15:49
  • As of now, conda init fish prevents fish from opening.
    – Ébe Isaac
    Nov 13, 2020 at 16:50
35

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!

0
17

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!

0
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.

1

Conda command will not work until you run the conda init fish. but on fish terminal it will also not work.

  1. Open Fish/bash terminal

it will open the bash inside fish, incase you opened fish

$ bash
  1. then init the conda
conda init fish

You are done

1

If you have installed conda prior to installing fish, you most likely installed it using zsh which comes as default since macOS Catalina. In this case you do not need to reinstall conda, simply switch back to the zsh shell, like so:

zsh

then init conda from zsh

conda init fish

Then you can go ahead and open a new terminal window. If the fish shell is automatically opening, you should be able to use the conda command.

To verify, type

which conda

and if it's available, you should see the path to the installation.

0

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/

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.