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

Pipx ensurepath sets environment in the active shell, not other shells #1290

Open
TeaDrinkingProgrammer opened this issue Mar 13, 2024 · 0 comments
Labels
bug Something isn't working upstream Bug in dependency

Comments

@TeaDrinkingProgrammer
Copy link

TeaDrinkingProgrammer commented Mar 13, 2024

Describe the bug

When running pipx ensurepath, it sets the variable in the shells "rc" file. This causes issues when you run the command in one shell, but use another one later or use /bin/sh. A practical example of where this becomes an issue is docker: it uses /bin/sh to run commands, so the pipx ensurepath command sets the bashrc file and the path is still not set for subsequent Docker commands. This means that pipx ensurepath is essentially broken in Docker.

How to reproduce

  1. Run `/bin/sh pipx ensurepath
  2. Try to run an application with Pipx
  3. The shell returns command not found

Expected behavior

I know that there is a debate about what the correct place is to set environment variables, but I think we can all agree that ./~bashrc is not one of those. I personally use /etc/environment, but I leave it up to the maintainers' discretion to pick an option.

Edit:
The issue seems that the userpath library has chosen to add to shell rc files, so it seems that wether to add to the RC file or not is not as clearcut as I thought. If you choose to leave the current behaviour, I think it would be a good idea to add the caveats of ensurepath in the documentation (and maybe add that you need to run the command at all in the installation guide).

@Gitznik Gitznik added bug Something isn't working upstream Bug in dependency labels Mar 13, 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 upstream Bug in dependency
Projects
None yet
Development

No branches or pull requests

2 participants