The package upsetr was installed with conda. It **works** in my **terminal**

    conda activate upsetr
    conda deactivate

I was trying to invoke conda in a **Makefile** , something like

    SHELL=/bin/bash
    test:
          conda activate upsetr &&  conda deactivate

but it doesn't work:

    CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'.
    To initialize your shell, run
    
        $ conda init <SHELL_NAME>
    
    Currently supported shells are:

I can reproduce this error by piping the command into bash


    $ echo 'conda activate upsetr && conda deactivate' | bash
    
    CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'.
    To initialize your shell, run
    
        $ conda init <SHELL_NAME>


Why does it fail ?

Non-interactive shells [do not run *.bashrc*](https://www.gnu.org/software/bash/manual/html_node/Bash-Startup-Files.html#Bash-Startup-Files).

So you could e.g. add the `conda init` stuff to $BASH_ENV, or alternatively make your sub-shell interactive (with all the side-effects that implies) by piping into `… | bash -i` or in the *Makefile* use `SHELL = /bin/bash -i`.

For the (GNU) *Makefile*, probably the best bet would be to avoid those side-effects via

```make
SHELL = /bin/bash
export BASH_ENV = $(HOME)/.conda.bash_env
```

Where *~/.conda.bash_env* is a one-liner: `eval "$(/path/to/bin/conda shell.bash hook)"`

Finally, you will need to ensure each command in a Make recipe that uses `conda` is actually executed via $(SHELL) rather than spawned directly by `make` via `exec(2)`/etc. The easiest way to do that is to make sure that each of those command lines contains at least one shell meta-character, e.g., just by putting a semicolon on the end.

As your `conda activate …` commands will be setting $PATH for the following commands in the recipe, this will somewhat take care of itself as you will want to ensure that both commands are run by the same shell, either using `.ONESHELL` or the usual syntax for shell script snippets:

```make
analyse:
    conda activate upsetr; \
    upsetr foo bar
```