Skip to content

I'd like to "reset" my Python installation and start from fresh

Like many other Arch users, my python install messed up after updating to Python 3.11

As many have advised, I should use virtualenv, which is what I will be doing. But I'd like to remove all the "junk" that I have installed using pip from the CLI without removing the modules that are used by software I use as that would break them.

Is this possible?

14 points11 comments
Open on Reddit
About this post
Posted
Archived
Score
14 · 85% up
Kind
Text
ID
13dptdk

Author

19
posts
13
comments
1
media
View profile

12 comments

If you used pip as your user, just delete the python folders from $HOME

12 points

Would this not break the software that may depend on certain modules?

Or does are python installed somewhere else when you install software through pacman?

2 points

Depends on how you ran pip.

Pip should never be ran as root. If you ran pip as root - your system is broken. Dumping a list of all installed packages, booting from a usb stick, mounting your root partition, deleting everything in /usr/local/lib/python* and then reinstalling the packages from the list is the easiest way to solve the problem.

If you ran pip as your user (by passing --user) - just follow what /u/MrElendig said.

12 points

Just a guide for If it happens again: you have most PIP packages with pacman python-<package-name>. then you can just reinstall those.

4 points

I haven't tested this, but theoretically it should work if you ever ran pip as root and installed python packages into the system site-packages.

You might be able to find junk you installed with sudo pip by running:

pacman -Qo /usr/lib/python3.*/site-packages/* | grep error

Everything in there should be owned by a package. Anything that isn't can (probably) be deleted, because at least nothing you installed with pacman will depend on it.

4 points

Keyboard shortcuts

Move and act

jork
Next / previous post or comment
Enteroro
Open the post
f
Open the media viewer
s
Save
h
Hide (the toast has Undo)
Tab
Right after an action: the toast's Undo
x
Collapse the comment
v
Next layout: cards, compact, grid

Go to

/
Search
gthenh
Home
gthena
All
gthens
Subreddits
gthenl
Library
?
This list
Esc
Close a menu or this list

In the viewer

←or→
Previous / next file
↑or↓
Previous / next post
korj
Previous / next post
Space
Play / pause
m
Mute
z
Zoom
s
Save
o
Open the post (on its own page: back to it)
Esc
Close

Keys do nothing while you type in a box.