pipx
pipx copied to clipboard
Uncaught exception after python upgrade
Commands upgrade and upgrade-all (and possibly others) have an uncaught exception when they are called on a package that was installed with different python version (and probably different virtual environment) than they were installed with.
When calling pipx list, it correctly catches the issue and advices the use of pipx reinstall-all, which fixes the issue.
How to reproduce
Tested on two Manjaro systems:
inxi --admin --verbosity=7 --filter --no-host --width
System:
Kernel: 6.6.65-1-MANJARO arch: x86_64 bits: 64 compiler: gcc v: 14.2.1
clocksource: tsc avail: kvm-clock,acpi_pm
parameters: BOOT_IMAGE=/@/boot/vmlinuz-6.6-x86_64
root=UUID=9806d341-d411-49c8-b2c3-2f739a42d7d4 rw rootflags=subvol=@ quiet
cryptdevice=UUID=3fbd3ab4-9527-47e0-8177-91906119196f:luks-3fbd3ab4-9527-47e0-8177-91906119196f
root=/dev/mapper/luks-3fbd3ab4-9527-47e0-8177-91906119196f splash
resume=/dev/mapper/luks-af2f83dd-cddb-40cc-80af-2d801f9b9a0e
udev.log_priority=3
Desktop: KDE Plasma v: 6.2.5 tk: Qt v: N/A info: frameworks v: 6.10.0
wm: kwin_x11 vt: 2 dm: SDDM Distro: Manjaro base: Arch Linux
Machine:
Type: Virtualbox System: innotek GmbH product: VirtualBox v: 1.2
serial: <superuser required> Chassis: Oracle Corporation type: 1
serial: <superuser required>
Mobo: Oracle model: VirtualBox v: 1.2 serial: <superuser required>
uuid: <superuser required> BIOS: innotek GmbH v: VirtualBox date: 12/01/2006
Battery:
ID-1: BAT0 charge: 50.0 Wh (100.0%) condition: 50.0/50.0 Wh (100.0%)
volts: 10.0 min: 10.0 model: innotek 1 type: Unknown serial: N/A status: full
Memory:
System RAM: total: 5 GiB available: 4.8 GiB used: 1.75 GiB (36.4%)
RAM Report: message: No RAM data found using udevadm.
CPU:
Info: model: Intel Core i5-8350U bits: 64 type: MCP arch: Coffee Lake
gen: core 8 level: v3 note: check built: 2017 process: Intel 14nm family: 6
model-id: 0x8E (142) stepping: 0xA (10) microcode: 0xF6
Topology: cpus: 1x dies: 1 clusters: 4 cores: 4 smt: <unsupported> cache:
L1: 256 KiB desc: d-4x32 KiB; i-4x32 KiB L2: 1024 KiB desc: 4x256 KiB
L3: 24 MiB desc: 4x6 MiB
Speed (MHz): avg: 1896 min/max: N/A cores: 1: 1896 2: 1896 3: 1896 4: 1896
bogomips: 15175
Flags: 3dnowprefetch abm adx aes apic arat arch_capabilities avx avx2 bmi1
bmi2 clflush clflushopt cmov constant_tsc cpuid cx16 cx8 de f16c flush_l1d
fma fpu fsgsbase fxsr ht hypervisor invpcid lahf_lm lm mca mce md_clear
mmx movbe msr mtrr nonstop_tsc nopl nx pae pat pcid pclmulqdq pge pni
popcnt pse pse36 pti rdrand rdseed rdtscp rep_good sep sse sse2 sse4_1
sse4_2 ssse3 syscall tsc tsc_known_freq vme x2apic xsave xtopology
Vulnerabilities:
Type: gather_data_sampling status: Unknown: Dependent on hypervisor status
Type: itlb_multihit status: KVM: VMX unsupported
Type: l1tf mitigation: PTE Inversion
Type: mds mitigation: Clear CPU buffers; SMT Host state unknown
Type: meltdown mitigation: PTI
Type: mmio_stale_data mitigation: Clear CPU buffers; SMT Host state unknown
Type: reg_file_data_sampling status: Not affected
Type: retbleed status: Vulnerable
Type: spec_rstack_overflow status: Not affected
Type: spec_store_bypass status: Vulnerable
Type: spectre_v1 mitigation: usercopy/swapgs barriers and __user pointer
sanitization
Type: spectre_v2 mitigation: Retpolines; STIBP: disabled; RSB filling;
PBRSB-eIBRS: Not affected; BHI: Retpoline
Type: srbds status: Unknown: Dependent on hypervisor status
Type: tsx_async_abort status: Not affected
Graphics:
Device-1: VMware SVGA II Adapter driver: vmwgfx v: 2.20.0.0 ports:
active: Virtual-1 empty: Virtual-2, Virtual-3, Virtual-4, Virtual-5,
Virtual-6, Virtual-7, Virtual-8 bus-ID: 00:02.0 chip-ID: 15ad:0405
class-ID: 0300
Display: x11 server: X.Org v: 21.1.14 with: Xwayland v: 24.1.4
compositor: kwin_x11 driver: X: loaded: vmware unloaded: modesetting
alternate: fbdev,vesa gpu: vmwgfx display-ID: :0 screens: 1
Screen-1: 0 s-res: 1916x997 s-dpi: 96 s-size: 506x263mm (19.92x10.35")
s-diag: 570mm (22.45")
Monitor-1: Virtual-1 mapped: Virtual1 res: mode: 1916x997 hz: 60
scale: 100% (1) size: N/A modes: max: 1916x997 min: 640x480
API: EGL v: 1.5 platforms: gbm: drv: kms_swrast surfaceless: drv: swrast
x11: drv: swrast inactive: wayland
API: OpenGL v: 4.5 vendor: mesa v: 24.3.4-arch1.1 glx-v: 1.4
direct-render: yes renderer: llvmpipe (LLVM 19.1.7 256 bits)
device-ID: ffffffff:ffffffff memory: 4.69 GiB unified: yes
API: Vulkan Message: No Vulkan data available.
Info: Tools: api: clinfo, eglinfo, glxinfo, vulkaninfo
de: kscreen-console,kscreen-doctor wl: wayland-info
x11: xdpyinfo, xprop, xrandr
Audio:
Device-1: Intel 82801AA AC97 Audio vendor: Dell driver: snd_intel8x0
v: kernel bus-ID: 00:05.0 chip-ID: 8086:2415 class-ID: 0401
API: ALSA v: k6.6.65-1-MANJARO status: kernel-api with: aoss
type: oss-emulator tools: alsactl,alsamixer,amixer
Server-1: JACK v: 1.9.22 status: off tools: N/A
Server-2: PipeWire v: 1.2.7 status: active with: 1: pipewire-pulse
status: active 2: wireplumber status: active 3: pipewire-alsa type: plugin
tools: pactl,pw-cat,pw-cli,wpctl
Network:
Device-1: Intel 82540EM Gigabit Ethernet driver: e1000 v: kernel port: d020
bus-ID: 00:03.0 chip-ID: 8086:100e class-ID: 0200
IF: enp0s3 state: up speed: 1000 Mbps duplex: full mac: <filter>
IP v4: <filter> type: dynamic noprefixroute scope: global
broadcast: <filter>
IP v6: <filter> type: dynamic noprefixroute scope: global
IP v6: <filter> type: noprefixroute scope: link
Device-2: Intel 82371AB/EB/MB PIIX4 ACPI type: network bridge
driver: piix4_smbus v: N/A port: N/A bus-ID: 00:07.0 chip-ID: 8086:7113
class-ID: 0680
Info: services: NetworkManager,systemd-timesyncd
WAN IP: <filter>
Bluetooth:
Message: No bluetooth data found.
Logical:
Message: No logical block device data found.
Device-1: luks-3fbd3ab4-9527-47e0-8177-91906119196f maj-min: 254:0
type: LUKS dm: dm-0 size: 81 GiB
Components:
p-1: sda1 maj-min: 8:1 size: 81 GiB
Device-2: luks-af2f83dd-cddb-40cc-80af-2d801f9b9a0e maj-min: 254:1
type: LUKS dm: dm-1 size: 8.8 GiB
Components:
p-1: sda2 maj-min: 8:2 size: 8.8 GiB
RAID:
Message: No RAID data found.
Drives:
Local Storage: total: 89.81 GiB used: 25.23 GiB (28.1%)
SMART Message: Required tool smartctl not installed. Check --recommends
ID-1: /dev/sda maj-min: 8:0 vendor: VirtualBox model: VBOX HARDDISK
size: 89.81 GiB block-size: physical: 512 B logical: 512 B speed: 3.0 Gb/s
tech: N/A serial: <filter> fw-rev: 1.0 scheme: MBR
Optical-1: /dev/sr0 vendor: VBOX model: CD-ROM rev: 1.0 dev-links: cdrom
Features: speed: 32 multisession: yes audio: yes dvd: yes rw: none
state: running
Partition:
ID-1: / raw-size: 81 GiB size: 81 GiB (100.00%) used: 25.16 GiB (31.1%)
fs: btrfs dev: /dev/dm-0 maj-min: 254:0
mapped: luks-3fbd3ab4-9527-47e0-8177-91906119196f label: N/A
uuid: 9806d341-d411-49c8-b2c3-2f739a42d7d4
ID-2: /home raw-size: 81 GiB size: 81 GiB (100.00%) used: 25.16 GiB (31.1%)
fs: btrfs dev: /dev/dm-0 maj-min: 254:0
mapped: luks-3fbd3ab4-9527-47e0-8177-91906119196f label: N/A
uuid: 9806d341-d411-49c8-b2c3-2f739a42d7d4
ID-3: /media/sf_SharedFolder raw-size: N/A size: 944.77 GiB
used: 805.99 GiB (85.3%) fs: vboxsf remote: SharedFolder
ID-4: /var/cache raw-size: 81 GiB size: 81 GiB (100.00%)
used: 25.16 GiB (31.1%) fs: btrfs dev: /dev/dm-0 maj-min: 254:0
mapped: luks-3fbd3ab4-9527-47e0-8177-91906119196f label: N/A
uuid: 9806d341-d411-49c8-b2c3-2f739a42d7d4
ID-5: /var/log raw-size: 81 GiB size: 81 GiB (100.00%)
used: 25.16 GiB (31.1%) fs: btrfs dev: /dev/dm-0 maj-min: 254:0
mapped: luks-3fbd3ab4-9527-47e0-8177-91906119196f label: N/A
uuid: 9806d341-d411-49c8-b2c3-2f739a42d7d4
Swap:
Kernel: swappiness: 60 (default) cache-pressure: 100 (default) zswap: yes
compressor: zstd max-pool: 20%
ID-1: swap-1 type: partition size: 8.8 GiB used: 67.6 MiB (0.8%)
priority: -2 dev: /dev/dm-1 maj-min: 254:1
mapped: luks-af2f83dd-cddb-40cc-80af-2d801f9b9a0e label: swap
uuid: 965f5567-d25f-4e1b-8d4f-d538e00e85bd
Unmounted:
Message: No unmounted partitions found.
USB:
Hub-1: 1-0:1 info: full speed or root hub ports: 12 rev: 1.1
speed: 12 Mb/s (1.4 MiB/s) lanes: 1 mode: 1.1 chip-ID: 1d6b:0001
class-ID: 0900
Device-1: 1-1:2 info: VirtualBox USB Tablet type: HID
driver: hid-generic,usbhid interfaces: 1 rev: 1.1 speed: 12 Mb/s (1.4 MiB/s)
lanes: 1 mode: 1.1 power: 100mA chip-ID: 80ee:0021 class-ID: 0300
Hub-2: 2-0:1 info: full speed or root hub ports: 12 rev: 2.0
speed: 480 Mb/s (57.2 MiB/s) lanes: 1 mode: 2.0 chip-ID: 1d6b:0002
class-ID: 0900
Sensors:
Src: lm-sensors+/sys Message: No sensor data found using /sys/class/hwmon or
lm-sensors.
Info:
Processes: 212 Power: uptime: 25m states: freeze,mem,disk suspend: s2idle
wakeups: 0 hibernate: shutdown avail: reboot,suspend,test_resume
image: 1.91 GiB services: org_kde_powerdevil,upowerd Init: systemd v: 257
default: graphical tool: systemctl
Packages: 1266 pm: pacman pkgs: 1259 libs: 355 tools: pamac pm: flatpak
pkgs: 7 Compilers: gcc: 14.2.1 Shell: Zsh v: 5.9 default: Bash v: 5.2.37
running-in: konsole inxi: 3.3.37
I've installed few packages when my system was on Python 3.12. Then upgraded with sudo pacman -Syyu This pushed by python version to Python 3.13
Now the packages wouldn't run, then the natural reaction is to upgrade the packages before running them, but this throws uncaught exception:
pipx upgrade selenium ✔ 10m 56s
Traceback (most recent call last):
File "/usr/bin/pipx", line 8, in <module>
sys.exit(cli())
~~~^^
File "/usr/lib/python3.13/site-packages/pipx/main.py", line 1176, in cli
return run_pipx_command(parsed_pipx_args, subparsers)
File "/usr/lib/python3.13/site-packages/pipx/main.py", line 333, in run_pipx_command
return commands.upgrade(
~~~~~~~~~~~~~~~~^
venv_dirs,
^^^^^^^^^^
...<7 lines>...
python_flag_passed=python_flag_passed,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "/usr/lib/python3.13/site-packages/pipx/commands/upgrade.py", line 213, in upgrade
_ = _upgrade_venv(
venv_dir,
...<8 lines>...
python_flag_passed=python_flag_passed,
)
File "/usr/lib/python3.13/site-packages/pipx/commands/upgrade.py", line 173, in _upgrade_venv
versions_updated += _upgrade_package(
~~~~~~~~~~~~~~~~^
venv,
^^^^^
...<4 lines>...
upgrading_all=upgrading_all,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "/usr/lib/python3.13/site-packages/pipx/commands/upgrade.py", line 45, in _upgrade_package
venv.upgrade_package(
~~~~~~~~~~~~~~~~~~~~^
package_name,
^^^^^^^^^^^^^
...<5 lines>...
suffix=package_metadata.suffix,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "/usr/lib/python3.13/site-packages/pipx/venv.py", line 459, in upgrade_package
pip_process = self._run_pip(["--no-input", "install"] + pip_args + ["--upgrade", package_or_url])
File "/usr/lib/python3.13/site-packages/pipx/venv.py", line 476, in _run_pip
return run_subprocess(cmd, run_dir=str(self.root))
File "/usr/lib/python3.13/site-packages/pipx/util.py", line 183, in run_subprocess
completed_process = subprocess.run(
cmd_str_list,
...<6 lines>...
cwd=run_dir,
)
File "/usr/lib/python3.13/subprocess.py", line 554, in run
with Popen(*popenargs, **kwargs) as process:
~~~~~^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.13/subprocess.py", line 1036, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pass_fds, cwd, env,
^^^^^^^^^^^^^^^^^^^
...<5 lines>...
gid, gids, uid, umask,
^^^^^^^^^^^^^^^^^^^^^^
start_new_session, process_group)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.13/subprocess.py", line 1966, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: '/home/user/.local/share/pipx/venvs/selenium/bin/python'
Same result for upgrading other packages and for passing pipx upgrade-all.
Expected behavior
Generally, I think there should never be an uncaught exception. The ideal situation is what happens when I pass pipx list
pipx list
venvs are in /home/user/.local/share/pipx/venvs
apps are exposed on your $PATH at /home/user/.local/bin
manual pages are exposed at /home/user/.local/share/man
⚠ package selenium has invalid interpreter /usr/bin/python3.12
⚠ package yt-dlp has invalid interpreter /usr/bin/python3.12
One or more packages have a missing python interpreter.
To fix, execute: pipx reinstall-all
This is very clear output that explains what I need to do.