Skip to content

Git bash on windows no longer supports pixi shell #417

Closed

Description

@tony-p

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

on windows in git bash

pixi shell

Issue description

On windows in a git bash terminal, pixi shell fails with error

$ pixi shell
  x Unsupported shell: Bash(Bash)

Expected behavior

pixi shell should work as expected

Activity

  1. ruben-arts commented on Nov 14, 2023

    @ruben-arts
    Contributor

    Hey, sorry for the late reaction.

    I've been debugging this and it is not as easy as thought on first glance. The issue is that our current implementation for bash is depending on some unix specific dependencies. (PtySession) Which isn't available, so we have to write this interaction ourself. Which is easy for PowerShell and nushell because the except a source file on start. But for bash you have to send a command to the running instance.

    I'll look at it some more very soon, but if you have any ideas let me know!

  2. wolfv commented on Mar 12, 2024

    @wolfv
    Member

    I wonder if one workaround can be to use

    pixi run bash.exe
    

    That should start a bash shell inside an activated environment. Would love to hear if that works - we could add it to our docs, or make that the default behavior on Windows (if it works well enough).

  3. tony-p commented on Mar 20, 2024

    @tony-p
    Author

    sorry for slow reply (have been on leave). Just got around to testing and seems to work as desired for the a few test commands I threw at it. Thanks!

  4. jdblischak commented on Mar 21, 2024

    @jdblischak
    Contributor

    I went through the steps in the Basic usage page in both Ubuntu 22.04 (via WSL) and Git Bash. My observations:

    • I confirmed the error with pixi shell
    • I confirmed that pixi run bash.exe is a good substitute
    • I noticed that the step pixi add python was noticeably slower in Git Bash compared to Ubuntu (despite running on the same hardware)
  5. wolfv commented on Mar 21, 2024

    @wolfv
    Member

    @jdblischak thanks! About your last point - I think that might be related to the Windows file system just being slower? Although I am not sure how that maps to WSL.

  6. jdblischak commented on Mar 21, 2024

    @jdblischak
    Contributor

    I think that might be related to the Windows file system just being slower?

    That is also my guess. My experience is that any code that touches the file system is noticeably slower on Windows. Just wanted to report to note that Windows users can't expect the same amazing speeds from pixi as those on a Unix file system (though of course pixi is still much faster than alternatives like conda on Windows, so they should still switch 🙂)

    Although I am not sure how that maps to WSL.

    That's the beauty of WSL. For the most part it behaves like you are running your code directly on Ubuntu, so pixi is super fast

  7. tony-p commented on Mar 22, 2024

    @tony-p
    Author

    I believe windows defender might play a role in the speed as well as it wants to scan everything that is downloaded. Could be that WSL is able to sidestep Windows defender.

  8. W1M0R commented on May 30, 2024

    @W1M0R

    When I run pixi shell-hook --shell bash in a Git bash terminal on Windows, I get the following output (redacted for simplicity):

    ❯ pixi shell-hook --shell bash
    export PATH="/c/Users/user2/myproj/.pixi/envs/default;/c/Users/user2/myproj/.pixi/envs/default/Library/mingw-w64/bin;/c/Users/user2/myproj/.pixi/envs/default/Library/usr/bin"

    The PATH is exported incorrectly and needs to look like this for it to work in Git Bash:

    export PATH="/c/Users/user2/myproj/.pixi/envs/default:/c/Users/user2/myproj/.pixi/envs/default/Library/mingw-w64/bin:/c/Users/user2/myproj/.pixi/envs/default/Library/usr/bin"

    In short, the PATH separator must be corrected from ; to :.

    Git Bash comes with a utility called cygpath, that can translate Windows path lists to the correct format:

    ❯ cygpath -u -p "C:\Users\user2\myproj\.pixi\envs\default;C:\Users\user2\myproj\.pixi\envs\blabla"
    /c/Users/user2/myproj/.pixi/envs/default:/c/Users/user2/myproj/.pixi/envs/blabla

    The cygpath utility can also translate the other way around:

    ❯ cygpath -w -p "/c/Users/user2/myproj/.pixi/envs/default:/c/Users/user2/myproj/.pixi/envs/blabla"
    C:\Users\user2\myproj\.pixi\envs\default;C:\Users\user2\myproj\.pixi\envs\blabla

    Perhaps pixi shell-hook --shell bash should detect if the cygpath.exe executable is in the path, and if so, then use it to normalize the PATH variable first.

    Here is one method that implements this suggestion.

    I also found the following related content:

    1. feat: add shell-hook command #672
    2. let result = activator
      .activation(ActivationVariables {
      conda_prefix,
      path,
      path_modification_behavior: PathModificationBehavior::default(),
      })
      .into_diagnostic()?;

    That path_modification_behavior argument sounds promising.

    A good enough solution might not even need to call into cygpath: just replace all ; with : in the PATH environment variable.

    A workaround is as follows:

    ❯  eval "$(pixi shell-hook --shell bash | sed 's/^export [Pp][Aa][Tt][Hh]=/export PATH=/I; s/;/:/g')"
    ❯  echo $PATH
    /c/Users/user2/myproj/.pixi/envs/default:/c/Users/user2/myproj/.pixi/envs/default/Library/mingw-w64/bin:/c/Users/user2/myproj/.pixi/envs/default/Library/usr/bin
  9. traversaro commented on Aug 22, 2024

    @traversaro
    Contributor

    If you need to use Git Bash with pixi shell, a (definitely non perfect) workaround is the one that I explain in #514 (comment) .

  10. traversaro commented on Aug 22, 2024

    @traversaro
    Contributor

    Follow up from #514 (comment) . If I run pixi shell-hook --shell path, the PATH is not correctly set for the reason specified by @W1M0R in #417 (comment) . fyi @ruben-arts

  11. maphew commented on Aug 22, 2024

    @maphew

    I believe windows defender might play a role in the speed as well as it wants to scan everything that is downloaded. Could be that WSL is able to sidestep Windows defender.

    Perhaps try exclude the pixi folders. Powershell as admin:

    #show existing exclusions
    Get-MpPreference | Select-Object -ExpandProperty ExclusionPath
    
    # add new ones
    Add-MpPreference -ExclusionPath "D:\apps\pixi\bin"
    
    # remove
    Remove-MpPreference -ExclusionPath "C:\path\to\directory"

    This can be overriden by group policy from the domain admin. There's no error when adding/removing in this case, so always finish with 'show existing' to see what took hold.

    If you're on Win 11 try setting up a Dev Drive. I've done this at home and it improves things that use thousands of files (which is most any cross-platform project that includes linux).

  12. added theissue type on Aug 1, 2025
  13. traversaro commented on Aug 18, 2025

    @traversaro
    Contributor

    Thanks a lot @mwiebe @ruben-arts !

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

    cliwindowsRelated to MS Windows

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions