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 install --global partially installs in ~/.local #1475

Closed
viscruocco opened this issue Jul 12, 2024 · 3 comments · Fixed by #1476
Closed

pipx install --global partially installs in ~/.local #1475

viscruocco opened this issue Jul 12, 2024 · 3 comments · Fixed by #1476
Labels
bug Something isn't working

Comments

@viscruocco
Copy link
Contributor

Describe the bug

When executing pipx install --global:

  • It correctly installs the venvs to /opt/pipx/venvs and the binaries and manual pages to /usr/local/bin and /usr/local/man.
  • The shared-libs are mistakenly installed to ~/.local/share/pipx.
  • Empty and unused ~/.local/bin and ~/.local/share/man directories are created. (This can be a problem if there are no write permissions to ~/.local, e.g. in a docker container without a proper user home directory.)

How to reproduce

$ docker run -it --rm python:3 bash
$$ pip install git+https://github.com/pypa/pipx.git
$$ pipx install --global cowsay
$$ which cowsay
/usr/local/bin/cowsay   # --> good
$$ ls /opt/pipx/venvs
cowsay                  # --> good
$$ ls /opt/pipx/
venvs                   # --> bad: bin and share should be here
$$ ls ~/.local/
bin  share  state       # --> bad: bin and share should NOT exist here; good: state/pipx/log is ok here
$ ls ~/.local/bin/
                        # --> bad: ~/.local/share/bin is empty
$ ls ~/.local/share/
man  pipx               # --> bad: ~/.local/share/pipx is actually created and used here

Expected behavior

$ docker run -it --rm python:3 bash
$$ pip install git+https://github.com/pypa/pipx.git
$$ pipx install --global cowsay
$$ which cowsay
/usr/local/bin/cowsay
$$ ls /opt/pipx/venvs
cowsay
$$ ls /opt/pipx/
bin  share  venvs
$$ ls ~/.local/
state
@viscruocco
Copy link
Contributor Author

After some consideration I noticed that the log files should also be written into the global directories instead of ~/.local. As mentioned above ~/.local might not be writeable after all. Since there is no configuration variable for the log directory it would be especially problematic to place it outside of PIPX_HOME. (The same goes for the cache and trash directories.)

@chrysle chrysle added the bug Something isn't working label Jul 17, 2024
@Denney-tech
Copy link

Encountering similar bug/behavior with pipx --global upgrade <spec> --install, but it does install apps to ~/.local/bin/ even though they are already found in /usr/local/bin.

@viscruocco
Copy link
Contributor Author

[...] pipx --global upgrade <spec> --install [...]

That's most likely related to #1443. Try putting --global after upgrade instead:
pipx upgrade --global <spec> --install

uranusjr pushed a commit that referenced this issue Jul 30, 2024
Co-authored-by: chrysle <96722107+chrysle@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
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

Successfully merging a pull request may close this issue.

3 participants