I broke Python
I was having issues during an upgrade and I deleted the entire /usr/lib/python directory. Yes, I thought "WTF am I doing?" just as I hit enter.
How do I fix this? So much of the system relies on Python. Simply re-installing Python didn't fix it.Can I avoid doing a complete system re-install?
[SOLVED] Thanks to the awesome people on this sub. I installed this system 7 years ago and you've saved it!
Edited 5 Jul 2022. We only hold this version.
About this post
- Posted
- Archived
- Edited
- Score
- 143 · 94% up
- Kind
- Text
- ID
- vrtn69
19 comments
LC_ALL=C pacman -Qk 2>&1 | grep -E ', [1-9][0-9]* missing files' | cut -d':' -f1should give you a list of packages with missing files, you can pipe that on to pacman by adding| pacman -Syu -to the endAlso to not end here again, what were your "issues upgrading" ? If anything along the lines of "files already exist" that happens if you pip install stuff as root. Do not do that, install your pip stuff as your normal user or better yet into virtual envs if you need it for dev work and keep system locations to system packages.
Thanks for letting me know about this. I usually simply ... reinstall all packages
Less is more, that solution is better IMHO.
Thanks! I had this problem yesterday and solved it with the command...
pacman -Qqn | grep python | sudo pacman -S -Thank you, I had issues updating my system today, so I deleted the site-packages folder, which broke all python stuff. This command fixed it
pacman -Ql | grep /usr/lib/python | awk '{ print $1 }' | uniqReinstall these.
pacman -Qqo /usr/lib/python*:PAh wait we can't rely on the expansion if the dir is missing, shite
but on a properly set up system
pacman -Qqo /usr/lib/python{3.10,2.7}should cover the only two logically possible dirs that exist.I like my monstrosity better still.
Thanks! You and the others who replied saved a 7 year old installation :)
Awesome
What does awk do? Looks like you’re printing something to stdout.
He's using it to print the first field in each line outputted by grep
Grep /usr/lib/python in PKGBUILD directory and reinstall those packages? I guess
Chroot and pacstrap python.
You know what this means, right? Time to take an external backup of your vital directories ;)
I don't see a lot of value in backing up system directories that are replaced exactly by packages. I suppose you could take snapshots of the installed package list occasionally if you wanted.
I normally agree however this is a 7 year old install that OP would clearly be distressed about if it wouldn't boot. So due to the age, I don't see any harm at all in copying their smaller directories onto a USB.