pipx icon indicating copy to clipboard operation
pipx copied to clipboard

pipx upgrade from 1.0.0 to 1.1.0 breaks python executable symlinks and breaks all installed apps

Open tddschn opened this issue 3 years ago • 3 comments

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

  1. Installed pipx 1.0.0 on an Intel Mac with Homebrew.
  2. run pipx install pycallgraph2 and verify that pycallgraph is installed and in your $PATH, and works fine.
  3. Upgrade pipx to 1.1.0 with Homebrew.
  4. Verify that pycallgraph stops 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.

tddschn avatar Aug 17 '22 02:08 tddschn

Could you try to run pipx reinstall-all?

dukecat0 avatar Aug 17 '22 05:08 dukecat0

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. :)

tddschn avatar Aug 17 '22 06:08 tddschn

@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:

image

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

image

wtfzambo avatar Sep 16 '22 16:09 wtfzambo