Attempting to update or reinstall Python returns errors

A couple weeks ago I ran a routine pacman -Syu and there were a couple of troublesome packages (such as Python) that were making the whole thing not work, I got fed up and just skipped them over for update. Now I want to update Python because things that depend on it are no longer working, but it hasn't fixed itself. After uninstalling and reinstalling multiple times, and attempt to install returns

Installing selected packages...

****    
resolving dependencies...
looking for conflicting packages...
Packages (1) python8;5;243m-3.10.2-1
Installed Size: 53.85 MiB
checking keys in keyring
checking package integrity
checking for file conflicts
error: failed to commit transaction (conflicting files) 
Errors occurred, no packages were upgraded.
Packages (15) python-cachecontrol8;5;243m-1:0.12.6-4 python-contextlib28;5;243m-0.6.0.post1-6 python-cryptography8;5;243m-36.0.1-1
python-distlib8;5;243m-0.3.4-1 python-distro8;5;243m-1.6.0-4 python-html5lib8;5;243m-1.1-11 python-msgpack8;5;243m-1.0.3-1 python-pep5178;5;243m-0.12.0-4
python-progress8;5;243m-1.6-5 python-pyopenssl8;5;243m-21.0.0-5 python-resolvelib8;5;243m-0.5.5-4 python-retrying8;5;243m-1.3.3-13
python-toml8;5;243m-0.10.2-7 python-tomli8;5;243m-2.0.0-1 python-pip8;5;243m-20.3.4-4
Installed Size: 9.60 MiB
checking available disk space

:: Running pre-transaction hooks...

Performing snapper pre snapshots for the following configurations...
/usr/bin/env: 'python': No such file or directory
error: command failed to execute correctly 
error: failed to commit transaction (failed to run transaction hooks) 

Command finished with errors!

I've looked around and found people with similar error codes, but solutions seem to be specific and don't apply/work for me. What can I do? Several important things (my VPN for example) rely on this so I can't really ignore it.

sudo garuda-inxi:

System:
Kernel: 5.16.2-zen1-1-zen x86_64 bits: 64 compiler: gcc v: 11.1.0
parameters: BOOT_IMAGE=/@/boot/vmlinuz-linux-zen
root=UUID=64b67cc3-f910-4117-93c2-418b1e19eb8e rw [email protected]
quiet splash rd.udev.log_priority=3 vt.global_cursor_default=0
systemd.unified_cgroup_hierarchy=1 loglevel=3
Console: pty pts/1 wm: kwin_x11 DM: SDDM Distro: Garuda Linux
base: Arch Linux
Machine:
Type: Desktop Mobo: ASRock model: B450M Steel Legend serial: <filter>
UEFI-[Legacy]: American Megatrends v: P2.70 date: 08/22/2019
CPU:
Info: model: AMD Ryzen 7 2700X socket: AM4 bits: 64 type: MT MCP arch: Zen+
family: 0x17 (23) model-id: 8 stepping: 2 microcode: 0x800820D
Topology: cpus: 1x cores: 8 tpc: 2 threads: 16 smt: enabled cache:
L1: 768 KiB desc: d-8x32 KiB; i-8x64 KiB L2: 4 MiB desc: 8x512 KiB
L3: 16 MiB desc: 2x8 MiB
Speed (MHz): avg: 3700 min/max: 2200/3700 boost: enabled
base/boost: 3700/4350 scaling: driver: acpi-cpufreq governor: performance
volts: 1.2 V ext-clock: 100 MHz cores: 1: 3700 2: 3700 3: 3700 4: 3700
5: 3700 6: 3700 7: 3700 8: 3700 9: 3700 10: 3700 11: 3700 12: 3700
13: 3700 14: 3700 15: 3700 16: 3700 bogomips: 118384
Flags: avx avx2 ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3 svm
Vulnerabilities:
Type: itlb_multihit status: Not affected
Type: l1tf status: Not affected
Type: mds status: Not affected
Type: meltdown status: Not affected
Type: spec_store_bypass
mitigation: Speculative Store Bypass disabled via prctl
Type: spectre_v1
mitigation: usercopy/swapgs barriers and __user pointer sanitization
Type: spectre_v2 mitigation: Full AMD retpoline, IBPB: conditional,
STIBP: disabled, RSB filling
Type: srbds status: Not affected
Type: tsx_async_abort status: Not affected
Graphics:
Device-1: NVIDIA GP104 [GeForce GTX 1070] vendor: eVga.com. driver: nvidia
v: 495.46 alternate: nouveau,nvidia_drm bus-ID: 07:00.0 chip-ID: 10de:1b81
class-ID: 0300
Device-2: Logitech Webcam C270 type: USB driver: snd-usb-audio,uvcvideo
bus-ID: 3-4:4 chip-ID: 046d:0825 class-ID: 0102 serial: <filter>
Display: server: X.Org 1.21.1.3 compositor: kwin_x11 driver:
loaded: nvidia unloaded: modesetting alternate: fbdev,nouveau,nv,vesa
display-ID: :0 screens: 1
Screen-1: 0 s-res: 1920x1080 s-dpi: 93 s-size: 524x292mm (20.6x11.5")
s-diag: 600mm (23.6")
Monitor-1: HDMI-0 res: 1920x1080 hz: 60 dpi: 94
size: 521x293mm (20.5x11.5") diag: 598mm (23.5")
Message: Unable to show advanced data. Required tool glxinfo missing.
Audio:
Device-1: NVIDIA GP104 High Definition Audio vendor: eVga.com.
driver: snd_hda_intel v: kernel bus-ID: 07:00.1 chip-ID: 10de:10f0
class-ID: 0403
Device-2: AMD Family 17h HD Audio vendor: ASRock driver: snd_hda_intel
v: kernel bus-ID: 09:00.3 chip-ID: 1022:1457 class-ID: 0403
Device-3: Realtek ZINGYOU ZY-UD1 Audio Device type: USB
driver: snd-usb-audio bus-ID: 1-6:2 chip-ID: 0bda:49e3 class-ID: 0102
Device-4: Logitech Webcam C270 type: USB driver: snd-usb-audio,uvcvideo
bus-ID: 3-4:4 chip-ID: 046d:0825 class-ID: 0102 serial: <filter>
Sound Server-1: ALSA v: k5.16.2-zen1-1-zen running: yes
Sound Server-2: PulseAudio v: 15.0 running: no
Sound Server-3: PipeWire v: 0.3.43 running: yes
Network:
Device-1: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet
vendor: ASRock driver: r8169 v: kernel port: f000 bus-ID: 05:00.0
chip-ID: 10ec:8168 class-ID: 0200
IF: enp5s0 state: down mac: <filter>
Device-2: Intel Wireless 8265 / 8275 driver: iwlwifi v: kernel
bus-ID: 06:00.0 chip-ID: 8086:24fd class-ID: 0280
IF: wlp6s0 state: up mac: <filter>
Bluetooth:
Device-1: Intel Bluetooth wireless interface type: USB driver: btusb v: 0.8
bus-ID: 1-8:3 chip-ID: 8087:0a2b class-ID: e001
Report: bt-adapter ID: hci0 rfk-id: 0 state: up address: <filter>
Drives:
Local Storage: total: 4.14 TiB used: 1.39 TiB (33.7%)
ID-1: /dev/nvme0n1 maj-min: 259:0 vendor: A-Data model: SX8200PNP
size: 1.86 TiB block-size: physical: 512 B logical: 512 B speed: 31.6 Gb/s
lanes: 4 type: SSD serial: <filter> rev: 42A7T36A temp: 32.9 C
scheme: MBR
SMART: yes health: PASSED on: 96d 0h cycles: 354
read-units: 14,981,626 [7.67 TB] written-units: 14,055,914 [7.19 TB]
ID-2: /dev/sda maj-min: 8:0 model: T-FORCE 500GB size: 465.76 GiB
block-size: physical: 512 B logical: 512 B sata: 3.2 speed: 6.0 Gb/s
type: SSD serial: <filter> rev: 3A scheme: MBR
SMART: yes state: enabled health: PASSED on: 187d 12h cycles: 4288
read: 128.9 MiB written: 118 MiB
ID-3: /dev/sdb maj-min: 8:16 type: USB vendor: Western Digital
model: WD Game Drive drive model: WD20SMRW-59YNDS0 size: 1.82 TiB
block-size: physical: 4096 B logical: 512 B sata: 3.1 speed: 6.0 Gb/s
type: HDD rpm: 5400 serial: <filter> drive serial: <filter> rev: 4000
drive rev: 01.01A01 temp: 37 C scheme: GPT
SMART: yes state: enabled health: PASSED on: 7d 22h cycles: 68
Partition:
ID-1: / raw-size: 1.86 TiB size: 1.86 TiB (100.00%)
used: 373.39 GiB (19.6%) fs: btrfs block-size: 4096 B dev: /dev/nvme0n1p1
maj-min: 259:1
ID-2: /home raw-size: 1.86 TiB size: 1.86 TiB (100.00%)
used: 373.39 GiB (19.6%) fs: btrfs block-size: 4096 B dev: /dev/nvme0n1p1
maj-min: 259:1
ID-3: /var/log raw-size: 1.86 TiB size: 1.86 TiB (100.00%)
used: 373.39 GiB (19.6%) fs: btrfs block-size: 4096 B dev: /dev/nvme0n1p1
maj-min: 259:1
ID-4: /var/tmp raw-size: 1.86 TiB size: 1.86 TiB (100.00%)
used: 373.39 GiB (19.6%) fs: btrfs block-size: 4096 B dev: /dev/nvme0n1p1
maj-min: 259:1
Swap:
Kernel: swappiness: 133 (default 60) cache-pressure: 100 (default)
ID-1: swap-1 type: zram size: 15.55 GiB used: 610.8 MiB (3.8%)
priority: 100 dev: /dev/zram0
Sensors:
System Temperatures: cpu: 41.6 C mobo: 32.0 C gpu: nvidia temp: 44 C
Fan Speeds (RPM): fan-1: 0 fan-2: 0 fan-3: 0 fan-4: 569 fan-5: 0
gpu: nvidia fan: 0%
Power: 12v: N/A 5v: N/A 3.3v: 3.33 vbat: 3.26
Info:
Processes: 386 Uptime: 14h 49m wakeups: 0 Memory: 15.55 GiB
used: 3.87 GiB (24.9%) Init: systemd v: 250 tool: systemctl Compilers:
gcc: 11.1.0 clang: 13.0.0 Packages: 1840 pacman: 1831 lib: 510 flatpak: 9
Shell: garuda-inxi (sudo) default: Bash v: 5.1.16 running-in: konsole
inxi: 3.3.12
Garuda:
System install date:     2021-11-06
Last full system update: 2022-01-26
Is partially upgraded:   No
Using TLP:               No
Windows dual boot:       No/Undetected

Thanks!

Did you try

garuda-update

?
Please post always in and output from terminal as text.

Maybe

sudo pacman -Syu --overwrite '*'

fix it.

2 Likes

Any attempt to update full system or Python specifically results in the same

error: failed to commit transaction (failed to run transaction hooks)

whether through

garuda-update

or

pacman -Syu

or through the Octopi GUI.

Hmm, I've just come across this announcement, I didn't know this was a problem Garuda had before. I think I can fix it now.

Ok, so it seems like I need to run

garuda-update

to update things that

pacman -Syu

cannot before I update Python.
The problem is that

garuda-update

attempts and fails to update Python, and nowhere on the web can I find a way to force it to skip Python and update the rest, like you can with

pacman -Syu

So it seems to me like the solution would be to find a way to skip Python in

garuda-update

run that, and then unignore Python and run

garuda-update

again. I've looked and found no documentation, though, so I'm at a loss and I don't even know if this would work to begin with.

Hi there, welcome to the community.

This error is mostly caused by messing system up. Reinstall will certainly solve the issue. But we might also fix this without reinstalling. Post output of

python --version
1 Like

Hello and thank you.

python --version

returns nothing because in my attempts to reinstall Python I totally uninstalled it.
I have realized that this wasn't just a problem installing Python like I first thought, but a problem installing everything, which is more worrisome. Attempting to do an install of any package, through Octopi,

garuda-install
pacman -Syu

etc all return the same error,

:: Running pre-transaction hooks...

Performing snapper pre snapshots for the following configurations...
/usr/bin/env: 'python': No such file or directory
error: command failed to execute correctly 
error: failed to commit transaction (failed to run transaction hooks) 
Errors occurred, no packages were upgraded.

Command finished with errors!

This makes me wonder, when you said

Reinstall will certainly solve the issue

Did you mean Python or the whole system? Hoping to avoid a full Garuda reinstall but if that's what it comes to then it is what it is.

Either way, you said that

This error is mostly caused by messing system up.

I'll take full responsibility, I'm well aware of my capacity to FUBAR software, but is there any way to know what I might have done wrong/what I can do differently?

Thank you guys so much for being so active on the forums.

Never do a partial upgrade. If Python was causing a problem that prevented a full update, fix that problem first. :slight_smile:

https://wiki.archlinux.org/title/pacman#"Failed_to_commit_transaction_(conflicting_files)"_error

1 Like

Whole system

And don't Uninstall python, as soon as you reboot, the system will most likely be breaked.

Also, what command did you use for Uninstalling python?

That would be difficult to detect, but certainly possible.
You have to analyze your complete command history and wonder where it went wrong. Most probably, there's something wrong done with python.

Also, see if booting into snapshot helps.

2 Likes

For uninstalling Python I used the Octopi GUI.

You can just fix this by doing the following as root:

ln -s /dev/null /etc/pacman.d/hooks/05-snap-pac-pre.hook
pacman -Syu python
rm /etc/pacman.d/hooks/05-snap-pac-pre.hook
4 Likes

Thank you so much. Was preparing a Manjaro USB, so glad I don't have to install new OS.

Wha
That woulda been awful! Lucky me saving you from that terrible fate :slight_smile:

5 Likes

In case a traveler from the future comes along looking for answers, after doing what TNE said to do I had to

sudo pacman -S --overwrite \* python

to get python itself working again.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.