Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pixi add a command line app from within a pixi shell is not immediately available #977

Closed
2 tasks done
synapticarbors opened this issue Mar 13, 2024 · 2 comments
Closed
2 tasks done
Labels
🐞 bug Something isn't working

Comments

@synapticarbors
Copy link
Contributor

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 init test1
✔ Initialized project in /Users/xyz/opt/pixienvs/test1
❯ which rg
/Users/xyz/.pixi/bin/rg
❯ rg --version
ripgrep 14.1.0

features:-simd-accel,+pcre2
simd(compile):+SSE2,+SSSE3,-AVX2
simd(runtime):+SSE2,+SSSE3,+AVX2

PCRE2 10.42 is available (JIT is available)
❯ cd test1
❯ pixi shell
 . "/var/folders/ld/gx_9s3_n55g1dkhj59zjlxww0000gn/T/pixi_env_OJF.sh". "/var/folders/ld/gx_9s3_n55g1dkhj59zjlxww0000gn/T/pixi_env_OJF.sh"
❯ which rg
/Users/xyz/.pixi/bin/rg
❯ pixi add "ripgrep=14.0.3"
✔ Added ripgrep=14.0.3
❯ which rg
/Users/xyz/.pixi/bin/rg
❯ ls -l .pixi/envs/default/bin/rg
-rwxrwxr-x  1 xyz  staff  5142352 Dec  4 06:44 .pixi/envs/default/bin/rg
❯ rg --version
ripgrep 14.1.0

features:-simd-accel,+pcre2
simd(compile):+SSE2,+SSSE3,-AVX2
simd(runtime):+SSE2,+SSSE3,+AVX2

PCRE2 10.42 is available (JIT is available)
❯ exit
❯ pixi shell
 . "/var/folders/ld/gx_9s3_n55g1dkhj59zjlxww0000gn/T/pixi_env_J4t.sh". "/var/folders/ld/gx_9s3_n55g1dkhj59zjlxww0000gn/T/pixi_env_J4t.sh"
❯ which rg
/Users/xyz/opt/pixienvs/test1/.pixi/envs/default/bin/rg
❯ rg --version
ripgrep 14.0.3

features:-simd-accel,+pcre2
simd(compile):+SSE2,+SSSE3,-AVX2
simd(runtime):+SSE2,+SSSE3,+AVX2

PCRE2 10.42 is available (JIT is available)

Issue description

If you pixi add a command line tool (in this example ripgrep), while in a pixi shell for that project, the tool is not immediately available even though it's on $PATH. In the example I gave above, I have ripgrep installed in a global environment, and that continues to be one that's available after I get a different version using pixi add, even though it should take precedence in the path, which is:

echo $PATH
/Users/xyz/opt/pixienvs/test1/.pixi/envs/default/bin:...<lots of other stuff>...:/Users/xyz/.pixi/bin

I have to exit the pixi shell and then restart it before I get access to the one that is in that environment.

I discovered this with pip, when I was trying to do an editable install. I had forgotten to add pip to my environment, so when I was in the pixi shell, I ran pixi add pip and then pip install -e ., and the package ended up in a different environment (actually a conda environment that I had activated before starting the shell).

Expected behavior

If I'm in a pixi shell and add a command line tool, it should be immediately available since it's on the $PATH in a bin directory with highest precedence.

@synapticarbors synapticarbors added the 🐞 bug Something isn't working label Mar 13, 2024
@wolfv
Copy link
Member

wolfv commented Mar 14, 2024

This is a duplicate of #326

I think we need to add a "hook" to call re-source the shell (or re-hash) after an installation, indeed.

@wolfv
Copy link
Member

wolfv commented Mar 20, 2024

I am closing this for now as it should be (partially) fixed with the next release. I've also added a new issue for a more complete fix here: #1018

@wolfv wolfv closed this as completed Mar 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants