After a user suggestion, I'm revising the question to more narrowly focus on the question "why can't I run conda commands from a shell script".
My default conda environment is named "py37". Shell starts, I am able to deactivate:
(py37) pauljohn@delllap-16:Desktop$ conda deactivate
pauljohn@delllap-16:Desktop$
I want to create a shell script with a short name, to do same work. I've tried several variants, e.g., a file called "noconda.sh":
$ cat noconda.sh
#!/bin/bash
eval "conda deactivate"
That's a fail, clearly:
pauljohn@delllap-16:bin$ noconda.sh
CommandNotFoundError: Your shell has not been properly configured to use 'conda deactivate'.
To initialize your shell, run
$ conda init <SHELL_NAME>
Currently supported shells are:
- bash
- fish
- tcsh
- xonsh
- zsh
- powershell
See 'conda init --help' for more information and options.
IMPORTANT: You may need to close and restart your shell after running 'conda init'.
I find that quite a few of the other projects I use don't work correctly if conda features are active.
You might ask what is in my .bashrc
:
# added by Anaconda3 2018.12 installer
# >>> conda init >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$(CONDA_REPORT_ERRORS=false '/home/pauljohn/LinuxDownloads/anaconda3/bin/conda' shell.bash hook 2> /dev/null)"
if [ $? -eq 0 ]; then
\eval "$__conda_setup"
else
if [ -f "/home/pauljohn/LinuxDownloads/anaconda3/etc/profile.d/conda.sh" ]; then
. "/home/pauljohn/LinuxDownloads/anaconda3/etc/profile.d/conda.sh"
CONDA_CHANGEPS1=false conda activate base
else
\export PATH="/home/pauljohn/LinuxDownloads/anaconda3/bin/:$PATH"
fi
fi
unset __conda_setup
# <<< conda init <<<
# help with conda bug accessing gsettings:
# https://github.com/conda-forge/glib-feedstock/issues/19
export GIO_EXTRA_MODULES=/usr/lib/x86_64-linux-gnu/gio/modules/
conda deactivate
conda activate py37