You are not logged in.

#1 2017-08-14 21:04:49

nannerpussy
Member
Registered: 2017-02-15
Posts: 96

"Cleanest" way to remove only what pip has done, revert to clean env

I'm taking up python and am just learning why virtualenvs are a good thing and how to use pip properly. Unfortunately my system is a mess because as you know, pip and <insert AUR manager> are interchangeable and both install globally to site-packages. At least that's how it appears. For instance, if I install Flask using pip, and then install python-flask from the AUR, I'll get an error during the PKGBUILD because it exists. So my question is: what's the easiest way to separate pip and packer/yaourt/pacman (if possible) and would it be possible to nuke what pip has done so far without totally fucking up a million dependencies system-wide? Should I never use pip outside of my little containers going forward? [fixed that] I know that pip is essentially like compiling from source and it has no way of telling pacman or AUR manager what it has done, which is the reason for the PKGBUILD errors mentioned above. Totally get that. Is pip2pkgbuild a good solution or not worth the hassle? Just stick to pacman to manage?

Just to be clear, everything works fine right now and both python2 and python3 are installed (3 is default and what I use) and those paths all work and I don't have any dependency issues or anything. I just want to clean up and separate pip installs and virtualenvs from my root filesystem, as good practice. I know there are brutal commands such as "pip freeze | xargs pip uninstall -y" but by doing that, I'll remove actual legit AUR packages and dependencies, right?

Last edited by nannerpussy (2017-08-14 21:14:21)

Offline

#2 2017-08-14 22:34:59

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: "Cleanest" way to remove only what pip has done, revert to clean env

https://aur.archlinux.org/packages/lostfiles is a general-purpose script for finding things in / that aren't tracked by pacman.

Note also that you can use `pip install --user` (without sudo!) to install things to ~/.local/lib/python3.6/site-packages/ which is much safer to casually nuke or more generally to manage with pip while being assured that you aren't messing with the system stuff.
You can make this the default by adding the following to ~/.config/pip/pip.conf:

[install]
user = yes

Also, pip2pkgbuild sounds like something which just generates a PKGBUILD using pip metadata, which should be perfectly safe. The only dangerous thing is prefixing any installer command other than pacman with `sudo`. wink
Although chances are most of what you need is already in the AUR.
The PKGBUILD is fairly trivial either way, look at any python module PKGBUILD and they are all 95% the same except for the depends array.


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#3 2017-08-14 22:42:00

atomicbeef
Member
Registered: 2015-09-30
Posts: 98

Re: "Cleanest" way to remove only what pip has done, revert to clean env

If you want to separate pip and system-wide installs of packages using pacman, use pip with the --user flag. This will install all packages into your home directory and won't touch the system-wide packages. I would recommend only using pacman for system-wide packages and pip for installing for one user to not run into issues like this in the future. To fix your problem, just use pip to remove any packages that are installed system-wide and then reinstall them using pacman.

Offline

Board footer

Powered by FluxBB