pypa / pipx

Install and Run Python Applications in Isolated Environments
https://pipx.pypa.io
MIT License
10.66k stars 418 forks source link

reinstall-all reinstalls everything but pipx #965

Closed jaraco closed 7 months ago

jaraco commented 1 year ago

Describe the bug I find I have to invoke reinstall-all after each Python update (https://github.com/pypa/pipx/issues/633). When I do, I see that pipx fails to reinstall with the error:

ā›” Error, the python executable would be deleted! Change it using the --python option or PIPX_DEFAULT_PYTHON environment variable.
...
The following package(s) failed to reinstall: pipx

This issue happened a few weeks ago and again today when I upgraded to Python 3.11.3 (using homebrew on macOS ARM).

Side note: I'm forced to pipx reinstall xonsh as that's the application that stops working after a Python upgrade. I notice that pipx still runs, and I didn't keep track of what happens to the other pipx-installed applications after the Python upgrade.

How to reproduce

``` $ pipx reinstall-all --verbose pipx >(setup:801): pipx version is 1.2.0 pipx >(setup:802): Default python interpreter is '/Users/jaraco/.local/pipx/venvs/pipx/bin/python' pipx >(upgrade:91): Upgrading shared libraries in /Users/jaraco/.local/pipx/shared upgrading shared libraries... pipx >(run_subprocess:173): running /Users/jaraco/.local/pipx/shared/bin/python -m pip --disable-pip-version-check install --upgrade pip setuptools wheel pipx >(uninstall:132): removed file /Users/jaraco/.local/bin/oathtool pipx >(rmdir:55): removing directory /Users/jaraco/.local/pipx/venvs/oathtool uninstalled oathtool! āœØ šŸŒŸ āœØ creating virtual environment... pipx >(run_subprocess:173): running /Users/jaraco/.local/pipx/venvs/pipx/bin/python -m venv --without-pip /Users/jaraco/.local/pipx/venvs/oathtool pipx >(run_subprocess:173): running /Users/jaraco/.local/pipx/venvs/oathtool/bin/python -c import sysconfig; print(sysconfig.get_path('purelib')) pipx >(run_subprocess:173): running /Users/jaraco/.local/pipx/shared/bin/python -c import sysconfig; print(sysconfig.get_path('purelib')) pipx >(run_subprocess:173): running /Users/jaraco/.local/pipx/venvs/oathtool/bin/python --version pipx >(_parsed_package_to_package_or_url:147): cleaned package spec: oathtool installing oathtool... pipx >(run_subprocess:173): running /Users/jaraco/.local/pipx/venvs/oathtool/bin/python -m pip install oathtool pipx >(run_subprocess:173): running pipx >(get_venv_metadata_for_package:316): get_venv_metadata_for_package: 38ms pipx >(_parsed_package_to_package_or_url:147): cleaned package spec: oathtool pipx >(_symlink_package_apps:111): Force is true. Removing /Users/jaraco/.local/bin/oathtool. installed package oathtool 2.3.1, installed using Python 3.11.3 These apps are now globally available - oathtool done! āœØ šŸŒŸ āœØ pipx >(uninstall:132): removed file /Users/jaraco/.local/bin/git-fame pipx >(rmdir:55): removing directory /Users/jaraco/.local/pipx/venvs/git-fame uninstalled git-fame! āœØ šŸŒŸ āœØ creating virtual environment... pipx >(run_subprocess:173): running /Users/jaraco/.local/pipx/venvs/pipx/bin/python -m venv --without-pip /Users/jaraco/.local/pipx/venvs/git-fame pipx >(run_subprocess:173): running /Users/jaraco/.local/pipx/venvs/git-fame/bin/python -c import sysconfig; print(sysconfig.get_path('purelib')) pipx >(run_subprocess:173): running /Users/jaraco/.local/pipx/venvs/git-fame/bin/python --version pipx >(_parsed_package_to_package_or_url:147): cleaned package spec: git-fame installing git-fame... pipx >(run_subprocess:173): running /Users/jaraco/.local/pipx/venvs/git-fame/bin/python -m pip install git-fame pipx >(run_subprocess:173): running pipx >(get_venv_metadata_for_package:316): get_venv_metadata_for_package: 56ms pipx >(_parsed_package_to_package_or_url:147): cleaned package spec: git-fame pipx >(_symlink_package_apps:111): Force is true. Removing /Users/jaraco/.local/bin/git-fame. installed package git-fame 2.0.1, installed using Python 3.11.3 These apps are now globally available - git-fame done! āœØ šŸŒŸ āœØ pipx >(uninstall:132): removed file /Users/jaraco/.local/bin/cherry_picker pipx >(rmdir:55): removing directory /Users/jaraco/.local/pipx/venvs/cherry-picker uninstalled cherry-picker! āœØ šŸŒŸ āœØ creating virtual environment... pipx >(run_subprocess:173): running /Users/jaraco/.local/pipx/venvs/pipx/bin/python -m venv --without-pip /Users/jaraco/.local/pipx/venvs/cherry-picker pipx >(run_subprocess:173): running /Users/jaraco/.local/pipx/venvs/cherry-picker/bin/python -c import sysconfig; print(sysconfig.get_path('purelib')) pipx >(run_subprocess:173): running /Users/jaraco/.local/pipx/venvs/cherry-picker/bin/python --version pipx >(_parsed_package_to_package_or_url:147): cleaned package spec: cherry-picker installing cherry-picker... pipx >(run_subprocess:173): running /Users/jaraco/.local/pipx/venvs/cherry-picker/bin/python -m pip install cherry-picker pipx >(run_subprocess:173): running pipx >(get_venv_metadata_for_package:316): get_venv_metadata_for_package: 65ms pipx >(_parsed_package_to_package_or_url:147): cleaned package spec: cherry-picker pipx >(_symlink_package_apps:111): Force is true. Removing /Users/jaraco/.local/bin/cherry_picker. installed package cherry-picker 2.1.0, installed using Python 3.11.3 These apps are now globally available - cherry_picker done! āœØ šŸŒŸ āœØ pipx >(uninstall:132): removed file /Users/jaraco/.local/bin/flake8 pipx >(rmdir:55): removing directory /Users/jaraco/.local/pipx/venvs/flake8 uninstalled flake8! āœØ šŸŒŸ āœØ creating virtual environment... pipx >(run_subprocess:173): running /Users/jaraco/.local/pipx/venvs/pipx/bin/python -m venv --without-pip /Users/jaraco/.local/pipx/venvs/flake8 pipx >(run_subprocess:173): running /Users/jaraco/.local/pipx/venvs/flake8/bin/python -c import sysconfig; print(sysconfig.get_path('purelib')) pipx >(run_subprocess:173): running /Users/jaraco/.local/pipx/venvs/flake8/bin/python --version pipx >(_parsed_package_to_package_or_url:147): cleaned package spec: flake8 installing flake8... pipx >(run_subprocess:173): running /Users/jaraco/.local/pipx/venvs/flake8/bin/python -m pip install flake8 pipx >(run_subprocess:173): running pipx >(get_venv_metadata_for_package:316): get_venv_metadata_for_package: 37ms pipx >(_parsed_package_to_package_or_url:147): cleaned package spec: flake8 pipx >(_symlink_package_apps:111): Force is true. Removing /Users/jaraco/.local/bin/flake8. installed package flake8 6.0.0, installed using Python 3.11.3 These apps are now globally available - flake8 done! āœØ šŸŒŸ āœØ ā›” Error, the python executable would be deleted! Change it using the --python option or PIPX_DEFAULT_PYTHON environment variable. pipx >(uninstall:132): removed file /Users/jaraco/.local/bin/reno pipx >(rmdir:55): removing directory /Users/jaraco/.local/pipx/venvs/reno uninstalled reno! āœØ šŸŒŸ āœØ creating virtual environment... pipx >(run_subprocess:173): running /Users/jaraco/.local/pipx/venvs/pipx/bin/python -m venv --without-pip /Users/jaraco/.local/pipx/venvs/reno pipx >(run_subprocess:173): running /Users/jaraco/.local/pipx/venvs/reno/bin/python -c import sysconfig; print(sysconfig.get_path('purelib')) pipx >(run_subprocess:173): running /Users/jaraco/.local/pipx/venvs/reno/bin/python --version pipx >(_parsed_package_to_package_or_url:147): cleaned package spec: reno installing reno... pipx >(run_subprocess:173): running /Users/jaraco/.local/pipx/venvs/reno/bin/python -m pip install reno pipx >(run_subprocess:173): running pipx >(get_venv_metadata_for_package:316): get_venv_metadata_for_package: 43ms pipx >(_parsed_package_to_package_or_url:147): cleaned package spec: reno pipx >(_symlink_package_apps:111): Force is true. Removing /Users/jaraco/.local/bin/reno. installed package reno 4.0.0, installed using Python 3.11.3 These apps are now globally available - reno done! āœØ šŸŒŸ āœØ pipx >(uninstall:132): removed file /Users/jaraco/.local/bin/xon.sh pipx >(uninstall:132): removed file /Users/jaraco/.local/bin/xonsh pipx >(uninstall:132): removed file /Users/jaraco/.local/bin/xonsh-uptime pipx >(uninstall:132): removed file /Users/jaraco/.local/bin/xonsh-cat pipx >(uninstall:132): removed file /Users/jaraco/.local/bin/xonsh-uname pipx >(rmdir:55): removing directory /Users/jaraco/.local/pipx/venvs/xonsh uninstalled xonsh! āœØ šŸŒŸ āœØ creating virtual environment... pipx >(run_subprocess:173): running /Users/jaraco/.local/pipx/venvs/pipx/bin/python -m venv --without-pip /Users/jaraco/.local/pipx/venvs/xonsh pipx >(run_subprocess:173): running /Users/jaraco/.local/pipx/venvs/xonsh/bin/python -c import sysconfig; print(sysconfig.get_path('purelib')) pipx >(run_subprocess:173): running /Users/jaraco/.local/pipx/venvs/xonsh/bin/python --version pipx >(_parsed_package_to_package_or_url:147): cleaned package spec: xonsh[ptk] installing xonsh from spec 'xonsh[ptk]'... pipx >(run_subprocess:173): running /Users/jaraco/.local/pipx/venvs/xonsh/bin/python -m pip install xonsh@git+https://github.com/xonsh/xonsh xonsh[ptk] pipx >(run_subprocess:173): running pipx >(get_venv_metadata_for_package:316): get_venv_metadata_for_package: 32ms pipx >(_parsed_package_to_package_or_url:147): cleaned package spec: xonsh[ptk] pipx >(_symlink_package_apps:111): Force is true. Removing /Users/jaraco/.local/bin/xonsh. pipx >(_symlink_package_apps:111): Force is true. Removing /Users/jaraco/.local/bin/xonsh-cat. pipx >(_symlink_package_apps:111): Force is true. Removing /Users/jaraco/.local/bin/xonsh-uname. pipx >(_symlink_package_apps:111): Force is true. Removing /Users/jaraco/.local/bin/xonsh-uptime. installed package xonsh 0.13.4, installed using Python 3.11.3 These apps are now globally available - xon.sh - xonsh - xonsh-cat - xonsh-uname - xonsh-uptime done! āœØ šŸŒŸ āœØ pipx >(_parsed_package_to_package_or_url:147): cleaned package spec: jaraco-clipboard installing jaraco-clipboard... pipx >(run_subprocess:173): running /Users/jaraco/.local/pipx/venvs/xonsh/bin/python -m pip install jaraco-clipboard pipx >(run_subprocess:173): running pipx >(get_venv_metadata_for_package:316): get_venv_metadata_for_package: 1142ms pipx >(_parsed_package_to_package_or_url:147): cleaned package spec: jaraco-clipboard injected package jaraco-clipboard into venv xonsh done! āœØ šŸŒŸ āœØ pipx >(_parsed_package_to_package_or_url:147): cleaned package spec: keyring installing keyring... pipx >(run_subprocess:173): running /Users/jaraco/.local/pipx/venvs/xonsh/bin/python -m pip install keyring pipx >(run_subprocess:173): running pipx >(get_venv_metadata_for_package:316): get_venv_metadata_for_package: 76ms pipx >(_parsed_package_to_package_or_url:147): cleaned package spec: keyring injected package keyring into venv xonsh done! āœØ šŸŒŸ āœØ pipx >(_parsed_package_to_package_or_url:147): cleaned package spec: xontrib-vox installing xontrib-vox... pipx >(run_subprocess:173): running /Users/jaraco/.local/pipx/venvs/xonsh/bin/python -m pip install xontrib-vox pipx >(run_subprocess:173): running pipx >(get_venv_metadata_for_package:316): get_venv_metadata_for_package: 46ms pipx >(_parsed_package_to_package_or_url:147): cleaned package spec: xontrib-vox injected package xontrib-vox into venv xonsh done! āœØ šŸŒŸ āœØ pipx >(uninstall:132): removed file /Users/jaraco/.local/bin/blurb pipx >(rmdir:55): removing directory /Users/jaraco/.local/pipx/venvs/blurb uninstalled blurb! āœØ šŸŒŸ āœØ creating virtual environment... pipx >(run_subprocess:173): running /Users/jaraco/.local/pipx/venvs/pipx/bin/python -m venv --without-pip /Users/jaraco/.local/pipx/venvs/blurb pipx >(run_subprocess:173): running /Users/jaraco/.local/pipx/venvs/blurb/bin/python -c import sysconfig; print(sysconfig.get_path('purelib')) pipx >(run_subprocess:173): running /Users/jaraco/.local/pipx/venvs/blurb/bin/python --version pipx >(_parsed_package_to_package_or_url:147): cleaned package spec: blurb installing blurb... pipx >(run_subprocess:173): running /Users/jaraco/.local/pipx/venvs/blurb/bin/python -m pip install blurb pipx >(run_subprocess:173): running pipx >(get_venv_metadata_for_package:316): get_venv_metadata_for_package: 24ms pipx >(_parsed_package_to_package_or_url:147): cleaned package spec: blurb pipx >(_symlink_package_apps:111): Force is true. Removing /Users/jaraco/.local/bin/blurb. installed package blurb 1.1.0, installed using Python 3.11.3 These apps are now globally available - blurb done! āœØ šŸŒŸ āœØ pipx >(uninstall:132): removed file /Users/jaraco/.local/bin/keyring pipx >(rmdir:55): removing directory /Users/jaraco/.local/pipx/venvs/keyring uninstalled keyring! āœØ šŸŒŸ āœØ creating virtual environment... pipx >(run_subprocess:173): running /Users/jaraco/.local/pipx/venvs/pipx/bin/python -m venv --without-pip /Users/jaraco/.local/pipx/venvs/keyring pipx >(run_subprocess:173): running /Users/jaraco/.local/pipx/venvs/keyring/bin/python -c import sysconfig; print(sysconfig.get_path('purelib')) pipx >(run_subprocess:173): running /Users/jaraco/.local/pipx/venvs/keyring/bin/python --version pipx >(_parsed_package_to_package_or_url:147): cleaned package spec: keyring installing keyring... pipx >(run_subprocess:173): running /Users/jaraco/.local/pipx/venvs/keyring/bin/python -m pip install keyring pipx >(run_subprocess:173): running pipx >(get_venv_metadata_for_package:316): get_venv_metadata_for_package: 37ms pipx >(_parsed_package_to_package_or_url:147): cleaned package spec: keyring pipx >(_symlink_package_apps:111): Force is true. Removing /Users/jaraco/.local/bin/keyring. installed package keyring 23.13.1, installed using Python 3.11.3 These apps are now globally available - keyring done! āœØ šŸŒŸ āœØ pipx >(uninstall:132): removed file /Users/jaraco/.local/bin/stubtest pipx >(uninstall:132): removed file /Users/jaraco/.local/bin/mypy pipx >(uninstall:132): removed file /Users/jaraco/.local/bin/mypyc pipx >(uninstall:132): removed file /Users/jaraco/.local/bin/dmypy pipx >(uninstall:132): removed file /Users/jaraco/.local/bin/stubgen pipx >(rmdir:55): removing directory /Users/jaraco/.local/pipx/venvs/mypy uninstalled mypy! āœØ šŸŒŸ āœØ creating virtual environment... pipx >(run_subprocess:173): running /Users/jaraco/.local/pipx/venvs/pipx/bin/python -m venv --without-pip /Users/jaraco/.local/pipx/venvs/mypy pipx >(run_subprocess:173): running /Users/jaraco/.local/pipx/venvs/mypy/bin/python -c import sysconfig; print(sysconfig.get_path('purelib')) pipx >(run_subprocess:173): running /Users/jaraco/.local/pipx/venvs/mypy/bin/python --version pipx >(_parsed_package_to_package_or_url:147): cleaned package spec: mypy installing mypy... pipx >(run_subprocess:173): running /Users/jaraco/.local/pipx/venvs/mypy/bin/python -m pip install mypy pipx >(run_subprocess:173): running pipx >(get_venv_metadata_for_package:316): get_venv_metadata_for_package: 46ms pipx >(_parsed_package_to_package_or_url:147): cleaned package spec: mypy pipx >(_symlink_package_apps:111): Force is true. Removing /Users/jaraco/.local/bin/dmypy. pipx >(_symlink_package_apps:111): Force is true. Removing /Users/jaraco/.local/bin/mypy. pipx >(_symlink_package_apps:111): Force is true. Removing /Users/jaraco/.local/bin/mypyc. pipx >(_symlink_package_apps:111): Force is true. Removing /Users/jaraco/.local/bin/stubgen. pipx >(_symlink_package_apps:111): Force is true. Removing /Users/jaraco/.local/bin/stubtest. installed package mypy 1.2.0, installed using Python 3.11.3 These apps are now globally available - dmypy - mypy - mypyc - stubgen - stubtest done! āœØ šŸŒŸ āœØ pipx >(uninstall:132): removed file /Users/jaraco/.local/bin/hg pipx >(rmdir:55): removing directory /Users/jaraco/.local/pipx/venvs/mercurial uninstalled mercurial! āœØ šŸŒŸ āœØ creating virtual environment... pipx >(run_subprocess:173): running /Users/jaraco/.local/pipx/venvs/pipx/bin/python -m venv --without-pip /Users/jaraco/.local/pipx/venvs/mercurial pipx >(run_subprocess:173): running /Users/jaraco/.local/pipx/venvs/mercurial/bin/python -c import sysconfig; print(sysconfig.get_path('purelib')) pipx >(run_subprocess:173): running /Users/jaraco/.local/pipx/venvs/mercurial/bin/python --version pipx >(_parsed_package_to_package_or_url:147): cleaned package spec: mercurial installing mercurial... pipx >(run_subprocess:173): running /Users/jaraco/.local/pipx/venvs/mercurial/bin/python -m pip install mercurial pipx >(run_subprocess:173): running pipx >(get_venv_metadata_for_package:316): get_venv_metadata_for_package: 29ms pipx >(_parsed_package_to_package_or_url:147): cleaned package spec: mercurial pipx >(_symlink_package_apps:111): Force is true. Removing /Users/jaraco/.local/bin/hg. installed package mercurial 6.4, installed using Python 3.11.3 These apps are now globally available - hg done! āœØ šŸŒŸ āœØ pipx >(_parsed_package_to_package_or_url:147): cleaned package spec: dulwich installing dulwich... pipx >(run_subprocess:173): running /Users/jaraco/.local/pipx/venvs/mercurial/bin/python -m pip install dulwich pipx >(run_subprocess:173): running pipx >(get_venv_metadata_for_package:316): get_venv_metadata_for_package: 39ms pipx >(_parsed_package_to_package_or_url:147): cleaned package spec: dulwich injected package dulwich into venv mercurial done! āœØ šŸŒŸ āœØ pipx >(_parsed_package_to_package_or_url:147): cleaned package spec: hg-evolve installing hg-evolve... pipx >(run_subprocess:173): running /Users/jaraco/.local/pipx/venvs/mercurial/bin/python -m pip install hg-evolve pipx >(run_subprocess:173): running pipx >(get_venv_metadata_for_package:316): get_venv_metadata_for_package: 26ms pipx >(_parsed_package_to_package_or_url:147): cleaned package spec: hg-evolve injected package hg-evolve into venv mercurial done! āœØ šŸŒŸ āœØ pipx >(_parsed_package_to_package_or_url:147): cleaned package spec: hg-git installing hg-git... pipx >(run_subprocess:173): running /Users/jaraco/.local/pipx/venvs/mercurial/bin/python -m pip install hg-git pipx >(run_subprocess:173): running pipx >(get_venv_metadata_for_package:316): get_venv_metadata_for_package: 40ms pipx >(_parsed_package_to_package_or_url:147): cleaned package spec: hg-git injected package hg-git into venv mercurial done! āœØ šŸŒŸ āœØ pipx >(_parsed_package_to_package_or_url:147): cleaned package spec: mercurial-keyring installing mercurial-keyring... pipx >(run_subprocess:173): running /Users/jaraco/.local/pipx/venvs/mercurial/bin/python -m pip install mercurial-keyring pipx >(run_subprocess:173): running pipx >(get_venv_metadata_for_package:316): get_venv_metadata_for_package: 52ms pipx >(_parsed_package_to_package_or_url:147): cleaned package spec: mercurial-keyring injected package mercurial-keyring into venv mercurial done! āœØ šŸŒŸ āœØ pipx >(uninstall:132): removed file /Users/jaraco/.local/bin/tox-to-nox pipx >(uninstall:132): removed file /Users/jaraco/.local/bin/nox pipx >(rmdir:55): removing directory /Users/jaraco/.local/pipx/venvs/nox uninstalled nox! āœØ šŸŒŸ āœØ creating virtual environment... pipx >(run_subprocess:173): running /Users/jaraco/.local/pipx/venvs/pipx/bin/python -m venv --without-pip /Users/jaraco/.local/pipx/venvs/nox pipx >(run_subprocess:173): running /Users/jaraco/.local/pipx/venvs/nox/bin/python -c import sysconfig; print(sysconfig.get_path('purelib')) pipx >(run_subprocess:173): running /Users/jaraco/.local/pipx/venvs/nox/bin/python --version pipx >(_parsed_package_to_package_or_url:147): cleaned package spec: nox installing nox... pipx >(run_subprocess:173): running /Users/jaraco/.local/pipx/venvs/nox/bin/python -m pip install nox pipx >(run_subprocess:173): running pipx >(get_venv_metadata_for_package:316): get_venv_metadata_for_package: 45ms pipx >(_parsed_package_to_package_or_url:147): cleaned package spec: nox pipx >(_symlink_package_apps:111): Force is true. Removing /Users/jaraco/.local/bin/nox. pipx >(_symlink_package_apps:111): Force is true. Removing /Users/jaraco/.local/bin/tox-to-nox. installed package nox 2022.11.21, installed using Python 3.11.3 These apps are now globally available - nox - tox-to-nox done! āœØ šŸŒŸ āœØ pipx >(uninstall:132): removed file /Users/jaraco/.local/bin/http pipx >(uninstall:132): removed file /Users/jaraco/.local/bin/httpie pipx >(uninstall:132): removed file /Users/jaraco/.local/bin/https pipx >(rmdir:55): removing directory /Users/jaraco/.local/pipx/venvs/httpie uninstalled httpie! āœØ šŸŒŸ āœØ creating virtual environment... pipx >(run_subprocess:173): running /Users/jaraco/.local/pipx/venvs/pipx/bin/python -m venv --without-pip /Users/jaraco/.local/pipx/venvs/httpie pipx >(run_subprocess:173): running /Users/jaraco/.local/pipx/venvs/httpie/bin/python -c import sysconfig; print(sysconfig.get_path('purelib')) pipx >(run_subprocess:173): running /Users/jaraco/.local/pipx/venvs/httpie/bin/python --version pipx >(_parsed_package_to_package_or_url:147): cleaned package spec: httpie installing httpie... pipx >(run_subprocess:173): running /Users/jaraco/.local/pipx/venvs/httpie/bin/python -m pip install httpie pipx >(run_subprocess:173): running pipx >(get_venv_metadata_for_package:316): get_venv_metadata_for_package: 87ms pipx >(_parsed_package_to_package_or_url:147): cleaned package spec: httpie pipx >(_symlink_package_apps:111): Force is true. Removing /Users/jaraco/.local/bin/http. pipx >(_symlink_package_apps:111): Force is true. Removing /Users/jaraco/.local/bin/httpie. pipx >(_symlink_package_apps:111): Force is true. Removing /Users/jaraco/.local/bin/https. installed package httpie 3.2.1, installed using Python 3.11.3 These apps are now globally available - http - httpie - https done! āœØ šŸŒŸ āœØ pipx >(uninstall:132): removed file /Users/jaraco/.local/bin/fab pipx >(rmdir:55): removing directory /Users/jaraco/.local/pipx/venvs/fabric uninstalled fabric! āœØ šŸŒŸ āœØ creating virtual environment... pipx >(run_subprocess:173): running /Users/jaraco/.local/pipx/venvs/pipx/bin/python -m venv --without-pip /Users/jaraco/.local/pipx/venvs/fabric pipx >(run_subprocess:173): running /Users/jaraco/.local/pipx/venvs/fabric/bin/python -c import sysconfig; print(sysconfig.get_path('purelib')) pipx >(run_subprocess:173): running /Users/jaraco/.local/pipx/venvs/fabric/bin/python --version pipx >(_parsed_package_to_package_or_url:147): cleaned package spec: fabric installing fabric... pipx >(run_subprocess:173): running /Users/jaraco/.local/pipx/venvs/fabric/bin/python -m pip install fabric pipx >(run_subprocess:173): running pipx >(get_venv_metadata_for_package:316): get_venv_metadata_for_package: 41ms pipx >(_parsed_package_to_package_or_url:147): cleaned package spec: fabric pipx >(_symlink_package_apps:111): Force is true. Removing /Users/jaraco/.local/bin/fab. installed package fabric 3.0.0, installed using Python 3.11.3 These apps are now globally available - fab done! āœØ šŸŒŸ āœØ pipx >(_parsed_package_to_package_or_url:147): cleaned package spec: jaraco-fabric installing jaraco-fabric... pipx >(run_subprocess:173): running /Users/jaraco/.local/pipx/venvs/fabric/bin/python -m pip install jaraco-fabric pipx >(run_subprocess:173): running pipx >(get_venv_metadata_for_package:316): get_venv_metadata_for_package: 49ms pipx >(_parsed_package_to_package_or_url:147): cleaned package spec: jaraco-fabric injected package jaraco-fabric into venv fabric done! āœØ šŸŒŸ āœØ pipx >(_parsed_package_to_package_or_url:147): cleaned package spec: keyring installing keyring... pipx >(run_subprocess:173): running /Users/jaraco/.local/pipx/venvs/fabric/bin/python -m pip install keyring pipx >(run_subprocess:173): running pipx >(get_venv_metadata_for_package:316): get_venv_metadata_for_package: 51ms pipx >(_parsed_package_to_package_or_url:147): cleaned package spec: keyring injected package keyring into venv fabric done! āœØ šŸŒŸ āœØ pipx >(uninstall:132): removed file /Users/jaraco/.local/bin/pyproject-build pipx >(rmdir:55): removing directory /Users/jaraco/.local/pipx/venvs/build uninstalled build! āœØ šŸŒŸ āœØ creating virtual environment... pipx >(run_subprocess:173): running /Users/jaraco/.local/pipx/venvs/pipx/bin/python -m venv --without-pip /Users/jaraco/.local/pipx/venvs/build pipx >(run_subprocess:173): running /Users/jaraco/.local/pipx/venvs/build/bin/python -c import sysconfig; print(sysconfig.get_path('purelib')) pipx >(run_subprocess:173): running /Users/jaraco/.local/pipx/venvs/build/bin/python --version pipx >(_parsed_package_to_package_or_url:147): cleaned package spec: build installing build... pipx >(run_subprocess:173): running /Users/jaraco/.local/pipx/venvs/build/bin/python -m pip install build pipx >(run_subprocess:173): running pipx >(get_venv_metadata_for_package:316): get_venv_metadata_for_package: 37ms pipx >(_parsed_package_to_package_or_url:147): cleaned package spec: build pipx >(_symlink_package_apps:111): Force is true. Removing /Users/jaraco/.local/bin/pyproject-build. installed package build 0.10.0, installed using Python 3.11.3 These apps are now globally available - pyproject-build done! āœØ šŸŒŸ āœØ pipx >(uninstall:132): removed file /Users/jaraco/.local/bin/virtualenv pipx >(rmdir:55): removing directory /Users/jaraco/.local/pipx/venvs/virtualenv uninstalled virtualenv! āœØ šŸŒŸ āœØ creating virtual environment... pipx >(run_subprocess:173): running /Users/jaraco/.local/pipx/venvs/pipx/bin/python -m venv --without-pip /Users/jaraco/.local/pipx/venvs/virtualenv pipx >(run_subprocess:173): running /Users/jaraco/.local/pipx/venvs/virtualenv/bin/python -c import sysconfig; print(sysconfig.get_path('purelib')) pipx >(run_subprocess:173): running /Users/jaraco/.local/pipx/venvs/virtualenv/bin/python --version pipx >(_parsed_package_to_package_or_url:147): cleaned package spec: virtualenv installing virtualenv... pipx >(run_subprocess:173): running /Users/jaraco/.local/pipx/venvs/virtualenv/bin/python -m pip install virtualenv pipx >(run_subprocess:173): running pipx >(get_venv_metadata_for_package:316): get_venv_metadata_for_package: 42ms pipx >(_parsed_package_to_package_or_url:147): cleaned package spec: virtualenv pipx >(_symlink_package_apps:111): Force is true. Removing /Users/jaraco/.local/bin/virtualenv. installed package virtualenv 20.21.0, installed using Python 3.11.3 These apps are now globally available - virtualenv done! āœØ šŸŒŸ āœØ pipx >(uninstall:132): removed file /Users/jaraco/.local/bin/black-primer pipx >(uninstall:132): removed file /Users/jaraco/.local/bin/blackd pipx >(uninstall:132): removed file /Users/jaraco/.local/bin/black pipx >(rmdir:55): removing directory /Users/jaraco/.local/pipx/venvs/black uninstalled black! āœØ šŸŒŸ āœØ creating virtual environment... pipx >(run_subprocess:173): running /Users/jaraco/.local/pipx/venvs/pipx/bin/python -m venv --without-pip /Users/jaraco/.local/pipx/venvs/black pipx >(run_subprocess:173): running /Users/jaraco/.local/pipx/venvs/black/bin/python -c import sysconfig; print(sysconfig.get_path('purelib')) pipx >(run_subprocess:173): running /Users/jaraco/.local/pipx/venvs/black/bin/python --version pipx >(_parsed_package_to_package_or_url:147): cleaned package spec: black installing black... pipx >(run_subprocess:173): running /Users/jaraco/.local/pipx/venvs/black/bin/python -m pip install black pipx >(run_subprocess:173): running pipx >(get_venv_metadata_for_package:316): get_venv_metadata_for_package: 44ms pipx >(_parsed_package_to_package_or_url:147): cleaned package spec: black pipx >(_symlink_package_apps:111): Force is true. Removing /Users/jaraco/.local/bin/black. pipx >(_symlink_package_apps:111): Force is true. Removing /Users/jaraco/.local/bin/blackd. installed package black 23.3.0, installed using Python 3.11.3 These apps are now globally available - black - black-primer - blackd done! āœØ šŸŒŸ āœØ pipx >(uninstall:132): removed file /Users/jaraco/.local/bin/pyoxidizer pipx >(rmdir:55): removing directory /Users/jaraco/.local/pipx/venvs/pyoxidizer uninstalled pyoxidizer! āœØ šŸŒŸ āœØ creating virtual environment... pipx >(run_subprocess:173): running /Users/jaraco/.local/pipx/venvs/pipx/bin/python -m venv --without-pip /Users/jaraco/.local/pipx/venvs/pyoxidizer pipx >(run_subprocess:173): running /Users/jaraco/.local/pipx/venvs/pyoxidizer/bin/python -c import sysconfig; print(sysconfig.get_path('purelib')) pipx >(run_subprocess:173): running /Users/jaraco/.local/pipx/venvs/pyoxidizer/bin/python --version pipx >(_parsed_package_to_package_or_url:147): cleaned package spec: pyoxidizer installing pyoxidizer... pipx >(run_subprocess:173): running /Users/jaraco/.local/pipx/venvs/pyoxidizer/bin/python -m pip install pyoxidizer pipx >(run_subprocess:173): running pipx >(get_venv_metadata_for_package:316): get_venv_metadata_for_package: 26ms pipx >(_parsed_package_to_package_or_url:147): cleaned package spec: pyoxidizer pipx >(_symlink_package_apps:111): Force is true. Removing /Users/jaraco/.local/bin/pyoxidizer. installed package pyoxidizer 0.24.0, installed using Python 3.11.3 These apps are now globally available - pyoxidizer done! āœØ šŸŒŸ āœØ The following package(s) failed to reinstall: pipx ```

I reproduced that over and over.

Expected behavior

Pipx should be able to reinstall itself, at least on non-Windows machines. Or if it's not possible for some technical reason, it should account for this edge case and direct the user with some way to reinstall it.

I see there is guidance about "Change the [python executable]", but I have no idea what I'd change it to, as I've never specified it before.

I've installed pipx using:

pip-run pipx -- -m pipx install pipx

Where pip-run resolves to the Python 3.11 bin directory where it's installed.

I can use pip-run to side-load pipx and use that to reinstall pipx:

 $ pip-run pipx -- -m pipx reinstall pipx
uninstalled pipx! āœØ šŸŒŸ āœØ
  installed package pipx 1.2.0, installed using Python 3.11.3
  These apps are now globally available
    - pipx
done! āœØ šŸŒŸ āœØ
jaraco commented 1 year ago

While revisiting #633, I observed that setting PIP_DEFAULT_PYTHON (https://github.com/pypa/pipx/issues/633#issuecomment-1501212124) appears to work around this issue too. After setting it to $(which python3), the error goes away and pipx reinstall-all now works without error.

Is that the best recommendation? If so, should pipx be advertising this setting as a recommended one for all users?