pipx upgrade from 1.0.0 to 1.1.0 breaks python executable symlinks and breaks all installed apps
Describe the bug
I'm on macOS (Intel) and installed pipx from homebrew.
I installed pycallgraph2 (among many other apps, all of them broken by pipx upgrade) with pipx 1.0.0, and a virtual env was created for it at ~/.local/pipx/venvs/pycallgraph2.
When I invoke pycallgraph (~/.local/bin/pycallgraph, the executable that comes with the pacakge pycallgraph2) on the command line, it looks for the python interpreter in the shebang, which is ~/.local/pipx/venvs/pycallgraph2/bin/python, which is symlinked to /usr/local/Cellar/pipx/1.0.0/libexec/bin/python3.10.
The pipx upgrade removed /usr/local/Cellar/pipx/1.0.0/libexec/bin/python3.10 and created /usr/local/Cellar/pipx/1.1.0/libexec/bin/python3.10, but the installed apps still looks for the missing interpreter at /usr/local/Cellar/pipx/1.0.0/libexec/bin/python3.10, and all the apps stopped working.
How to reproduce
- Installed pipx 1.0.0 on an Intel Mac with Homebrew.
- run
pipx install pycallgraph2and verify thatpycallgraphis installed and in your$PATH, and works fine. - Upgrade pipx to 1.1.0 with Homebrew.
- Verify that
pycallgraphstops working, and throws the following error:
zsh: /Users/tscp/.local/bin/pycallgraph: bad interpreter: /Users/tscp/.local/pipx/venvs/pycallgraph2/bin/python: no such file or directory
Expected behavior
Automatically re-symlinked the python in shebangs to the new location.
Could you try to run pipx reinstall-all?
I made a script to resolve this issue by re-symlinking to the correct python executables: https://gist.github.com/tddschn/3f4f80fdcc385beabd68434087b5c6eb
Now my apps work fine again and I didn't have to run pipx reinstall-all. :)
@meowmeowmeowcat pipx reinstall-all works, altho one shoulnd't be forced to do so.
~Ideally, packages installed with pipx should point to a current directory symlinked to .*brew/Cellar/pipx/1.1.0 (assuming that pipx was installed with Brew), kind of like Scoop does.~
~But I guess this is an issue that should be solved on Brew side rather than pipx side.~
Edit:
Actually I stand corrected, Brew already does create "current" symlinks (altho they're not called current), however, it seems that packages installed with pipx point to the original directory, rather than the symlink.
This is poetry installed with pipx installed with Homebrew on Ubuntu20 running on WSL2:

It should be pointing instead to */.linuxbrew/bin/pipx:
