conda / conda/constructor

`.sh` installer errors for `conda init` step when called directly or via `sh`

Open
#995 2 comments 0 reactions 0 assignees View on GitHub
type::bug
Dominant language
Python
Stars
497
Forks
181
Avg merge
1d 16h
Merged PRs (30d)
17

Description

### Checklist

- [x] I added a descriptive title
- [x] I searched open reports and couldn't find a duplicate

### What happened?

If I call my constructor-generated Linux installer directly, as in `./my-package-0.1-Linux.sh`, or via `sh`, as in `sh my-package-0.1-Linux.sh`, and chose to update the shell profile "Do you wish to update your shell profile to automatically ...", then the installer generates the following message:

```
no change /home/runner/Scientific-Python/condabin/conda
no change /home/runner/Scientific-Python/bin/conda
no change /home/runner/Scientific-Python/bin/conda-env
no change /home/runner/Scientific-Python/bin/activate
no change /home/runner/Scientific-Python/bin/deactivate
no change /home/runner/Scientific-Python/etc/profile.d/conda.sh
no change /home/runner/Scientific-Python/etc/fish/conf.d/conda.fish
no change /home/runner/Scientific-Python/shell/condabin/Conda.psm1
no change /home/runner/Scientific-Python/shell/condabin/conda-hook.ps1
no change /home/runner/Scientific-Python/lib/python3.13/site-packages/xontrib/conda.xsh
no change /home/runner/Scientific-Python/etc/profile.d/conda.csh
modified /home/runner/.bashrc

==> For changes to take effect, close and re-open your current shell. <==

error libmamba Please provide a shell type.
Run with --help for more information.

critical libmamba Unknown shell type. Aborting.
```

I don't get this message if I call the installer with `bash`, as in `bash my-package-0.1-Linux.sh`.

The error appears to be because the installer is executing the second of [these two lines](https://github.com/conda/constructor/blob/7558141203ac998a873b25cb56614ccbc830d820/constructor/header.sh#L692-L693):

```
*zsh) "$PREFIX/bin/python" -m conda init zsh ;;
*) "$PREFIX/bin/python" -m conda init ;;
```

Superficially, it seems that this second line should be `"$PREFIX/bin/python" -m conda init $SHELL`, and that the case statement there is redundant - but I'm sure I'm missing something ...

See https://github.com/scientific-python/installer/issues/5 for original discovery.

### Additional Context

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.