Skip to content

Pixi shell - various issues #3525

Closed
Closed

Description

@noamgot

Checks

  • I have checked that this issue has not already been reported.

  • I have confirmed this bug exists on the latest version of pixi, using pixi --version.

Reproducible example

pixi shell

additional info:

I use Ubuntu 22.04.3 with ZSH + oh-my-zsh

Issue description

I tried activating a shell using pixi shell and encountered several issues:

  1. When the activation takes longer than 1 second, pixi gives a warning.
    1.1 The docs URL is wrong: https://pixi.sh/advanced/pixi_shell/#issues-with-pixi-shell
    it should be https://pixi.sh/latest/advanced/pixi_shell/#issues-with-pixi-shell
    1.2 IMHO, 1 second is reasonable, as pixi validates the lock file, but maybe I just have low standards... maybe we can allow the user to ignore it? e.g., using a flag and/or environment variable

  2. The warning above disappears quite quickly (it seems the script that's being run clears the terminal). we should consider leaving it on the screen. This also affects debugging - I tried running with -vvv, but many of the logs are gone...

  3. Diving into the suggested URL, one of the proposed solutions is using pixi shell-hook)
    3.1 There's a problem with this example:

function pixi_activate() {
    # default to current directory if no path is given
    local manifest_path="${1:-.}"
    eval "$(pixi shell-hook --manifest-path '$manifest_path')" # <-- does not work with the single quotes around manifest_path
    # eval "$(pixi shell-hook --manifest-path $manifest_path)" # <-- this one worked for me
}

3.2 It's not mentioned how one can deactivate the environment using this method (ctrl+D completely closes the shell, which is unwanted)

Expected behavior

see above

Activity

  1. added
    bug
    on Apr 7, 2025
  2. gzm55 commented on Apr 7, 2025

    @gzm55
    Contributor

    from document, there is no deactivate function:

    That also means that, instead of conda deactivate, it's enough to just exit the current shell, e.g. by pressing Ctrl+D.

    eval "$(pixi shell-hook --manifest-path '$manifest_path')"

    this should be fixed with double quotes as eval "$(pixi shell-hook --manifest-path "$manifest_path")"

  3. noamgot commented on Apr 7, 2025

    @noamgot
    ContributorAuthor

    from document, there is no deactivate function

    That's true for pixi shell, I asked about the equivalent for running eval "$(pixi shell-hook)"

    this should be fixed with double quotes

    If it works, either of the fixes we proposed should appear in the docs

  4. gzm55 commented on Apr 7, 2025

    @gzm55
    Contributor

    from document, there is no deactivate function

    it seems there is still no deactivate designed for shell-hook

    this should be fixed with double quotes

    If it works, either of the fixes we proposed should appear in the docs

    no quotes parameter in shell may fail if path contains spaces.

  5. wolfv commented on Apr 7, 2025

    @wolfv
    Member

    Would you be able to send a PR to the docs? That would be very helpful!

  6. wolfv commented on Apr 7, 2025

    @wolfv
    Member

    I think we shoudl introduce a second option to shell-hook for deactivation. That would be useful in this scenario, and the implementation would be quite straight-forward.

  7. noamgot commented on Apr 7, 2025

    @noamgot
    ContributorAuthor

    Would you be able to send a PR to the docs? That would be very helpful!

    I'll try to address the docs issues

  8. gzm55 commented on Apr 7, 2025

    @gzm55
    Contributor

    I think we shoudl introduce a second option to shell-hook for deactivation. That would be useful in this scenario, and the implementation would be quite straight-forward.

    if we define deactivation function, in pixi shell mode, deactivation should be exit the shell. whereas used as eval "$(pixi shell-hook)", the deactivation function should works like deactivation in conda or pip venv to restore the PATH env.

  9. wolfv commented on Apr 7, 2025

    @wolfv
    Member

    For sure. We already have all the code in place to also generate a "deactivation shell hook" we just don't expose it yet.

  10. Hofer-Julian commented on Apr 14, 2025

    @Hofer-Julian
    Member

    Closing in favor of a more specific issue: #3589

  11. noamgot commented on Apr 14, 2025

    @noamgot
    ContributorAuthor

    2. The warning above disappears quite quickly (it seems the script that's being run clears the terminal). we should consider leaving it on the screen. This also affects debugging - I tried running with -vvv, but many of the logs are gone...

    @Hofer-Julian has that been fixed...?

  12. Hofer-Julian commented on Apr 14, 2025

    @Hofer-Julian
    Member

    We didn't push a pull request recently, however, we try to avoid big issues addressing multiple separate problems. If you still encounter this problem, then please open a separate issue 🙂

  13. removed
    bug
    on Apr 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions