Cannot run source activate with conda in Fish-shell

99封情书 提交于 2019-12-02 17:08:43

As of fish 2.6.0 conda 4.3.27: the following steps may change as issue is addressed

update config

Take note of your conda's location

conda info --root
/Users/mstreeter/anaconda    # this is my <PATH_TO_ROOT>

Add line to ~/.config/fish/config.fish

 source <PATH_TO_ROOT>/etc/fish/conf.d/conda.fish

update convention

Typically you'd run the following from bash

source activate <environment>
source deactivate <environment>

Now you must run the following from fish

conda activate <environment>
conda deactivate <environment>

issues

so after doing this I'm not able to set fish as my default shell and have it still work properly with conda. Currently, I must first enter my default shell, and enter fish and the shell works as expected. I'll update this after I find out how to get it working completely without the need to explicitly choose fish each time I log into my terminal

If you follow https://github.com/conda/conda/issues/2611, the steps are (from start):

[root@6903a8d80f9b ~]# fish
root@6903a8d80f9b ~# echo $FISH_VERSION 
2.4.0
root@6903a8d80f9b ~# bash Miniconda2-4.3.11-Linux-x86_64.sh -b -p /conda
root@6903a8d80f9b ~# source /conda/etc/fish/conf.d/conda.fish
root@6903a8d80f9b ~# conda activate root
root@6903a8d80f9b ~# conda create -yn fishtest                              (root) 
Fetching package metadata .........
Solving package specifications: 
Package plan for installation in environment /conda/envs/fishtest:

#
# To activate this environment, use:
# > source activate fishtest
#
# To deactivate this environment, use:
# > source deactivate fishtest
#

root@6903a8d80f9b ~# conda activate fishtest                                (root) 
root@6903a8d80f9b ~#                                                    (fishtest) 
root@6903a8d80f9b ~# conda deactivate fishtest                          (fishtest) 

Adding conda's bin directory to PATH isn't recommended as of conda 4.4.0 https://github.com/conda/conda/blob/master/CHANGELOG.md#440-2017-12-20

All you need to do is adding source <path-to-anaconda>/etc/fish/conf.d/conda.fish to config.fish.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!