3

Reinstall pipx apps after Homebrew Python upgrade

 2 weeks ago
source link: https://akrabat.com/reinstall-pipx-apps-after-homebrew-python-upgrade/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Reinstall pipx apps after Homebrew Python upgrade

I install Python apps on my Mac using pipx like this:

pipx install rst2pdf

This will then install rst2pdf into its own isolated environment so that its dependencies do not affect and are not affected by any other Python app I have installed.

Internally, it creates a venv at /.local/pipx/venvs/rst2pdf with symlinks to the currently installed python in the bin directory:

lrwxrwxr-x@  1 rob  staff     10 24 May  2023 python -> python3.11
lrwxrwxr-x@  1 rob  staff     10 24 May  2023 python3 -> python3.11
lrwxrwxr-x@  1 rob  staff     96 24 May  2023 python3.11 -> /opt/homebrew/Cellar/[email protected]/3.11.3/Frameworks/Python.framework/Versions/3.11/bin/python3.11

All is good.

However, when the Homebrew version of Python is updated, the old version is removed.

Running rst2pdf now fails with “cannot execute: required file not found” as the linked python no longer exists.

It’s easy enough to fix when you work out what’s happened:

pipx reinstall-all

I wish this situation was handled a little bit better though.

This article was posted on 2 April 2024 in Computing, rst2pdf


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK