Error message with conda deactivate

hi,

I get this error message when I submit jobs that require me to activate a conda environment.
In my sbatch file I have

module load miniconda
source activate myenv_py37

The message I get is the following, what should I do? Thanks.

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

Hi @antoinearnoud,

In the past we recommended using the source activate, but with recent versions of our miniconda modules you can now use conda activate without having to run conda init. If you have run conda init previously, use the following command to clean out your .bashrc file (where conda adds some code specific to a single install location):

sed -i.bak -ne '/# >>> conda init/,/# <<< conda init/!p' ~/.bashrc

See our conda page for up-to-date info on how to use conda on the Yale Clusters.

TLDR -

# Make sure this is inside a job, 
# i.e. after starting an interactive job or in an sbatch script.
module load miniconda
conda activate myenv_py37
1 Like

Thank you very much.
I processed as you suggested, but I now get this:
he following modules were not unloaded:
(Use “module --force purge” to unload all):

  1. StdEnv
    /usr/share/lmod/lmod/init/bash: line 70: conda: command not found

This is what is on my sbatch file

module purge
module load miniconda
conda activate myenv_py37

thanks

You may need to log out and back in? I was able to log in as you (because I’m YCRC staff, not a hacker) and successfully activate that environment in an interactive session and in a batch job with conda activate.

Hi, thank you very much. I am now using conda activate but I am still getting this message in my output files:

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

Is there anything I coul do?
Thanks