My work defaults to tcsh for all linux and mac machines for unknown 'historical' reasons. We are trying to get a bunch of our code out to the public using Conda. But Conda appears to be bash only implementation which for the rest of the world is not a problem. I was not able to get it to install in a tcsh shell and I found some references to zsh in the Conda troubleshooting guide but I can't tell if Conda is a bash only implementation or if it will actually work in other shells. While I can easily start bash from a tcsh terminal window, it is a minor annoyance.
So what I want to know is: does Conda work in other shell types, if not, why?
This is a really late add-on to the whole discussion. But it might help other people running into the same problems. Unfortunately, I have only tried this in a tcsh shell.
As stated in the conda installation guidelines, it is not much of an issue anymore to run conda in other shells than bash (i.e. using bash installer.sh). As of conda 4.4. there seems to be now a conda activate myenv
function.
And with conda 4.6. there is a conda init
script, which should add all the necessary things to use conda activate myenv
(rather than source activate myenv) in the necessary profile files (~/.bashrc, ~/.tcshrc, etc.). So that it can be run with multiple shells.
However, this still doesn't seem to work flawlessly with Miniconda3 and conda 4.6 (conda init tcsh, throwing an error, there is an issue open on github).
But I found a possible solution on github. By adding source <prefix>/minicondaX/etc/profile.d/conda.csh
to your ~/.tcshrc file you should be able to use conda activate myenv
in tcsh.
The main problem with using conda
outside of bash or zsh is that it requires the activate
and deactivate
scripts to modify the local environment, meaning that they must be sourced rather than executed in a subshell. The second statement in activate
checks that you are running from one of the supported shells:
# Determine the directory containing this script
if [[ -n $BASH_VERSION ]]; then
_SCRIPT_LOCATION=${BASH_SOURCE[0]}
elif [[ -n $ZSH_VERSION ]]; then
_SCRIPT_LOCATION=${funcstack[1]}
else
echo "Only bash and zsh are supported"
return 1
fi
There is nothing much you can do about that. However, I have had luck using an existing conda environment when I manually set the PATH
variable in tcsh
: if you prefix the bin
folder of your root or custom environment to PATH
, you should be able to get things going.
I am not sure if you can (never tried to) install conda or modify environments outside of bash
though.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With