Fixing potential dnf and pip conflicts

asked 2017-08-09 05:54:59 -0600

warrickball gravatar image

I've happily been using Fedora for about 9 months now, during which I've foolishly been installing Python packages using pip as root. I've now come to understand why that's a bad idea (and what to do instead). Although I'm not having any problems, I'd like to do is fix my error (i.e. uninstall Python packages as root install Python packages with pip --user instead) but hopefully without breaking dnf. What's the best way to go about this?

My first thought was to do something like pip freeze as root and remove everything but I definitely have some packages that are installed by both systems. For example, as root,

$ dnf list --installed | grep numpy
python2-numpy.x86_64               1:1.12.1-1.fc26                 @@commandline
python2-numpy-f2py.x86_64          1:1.12.1-1.fc26                 @@commandline
python3-numpy.x86_64               1:1.12.1-1.fc26                 @@commandline

$ pip2 freeze | grep numpy
numpy==1.13.1

$ pip3 freeze | grep numpy
numpy==1.13.1

So NumPy appears to be tracked by both package managers, and I suspect removing one will mess with the other. I suppose one way to deal with this is remove everything, then use dnf to re-install all the packages it tracks (perhaps as suggested in this question? All help welcome.

Also, I apologise if this has been asked before, but most of the answers I found were either people asking which package manager to use before they blundered in like I did, or fixing specific packages after upgrading Fedora.

edit retag flag offensive close merge delete

Comments

I've learned that naively removing everything with pip and pip3 as root is not the thing to do. dnf/yum has some Python 3 dependencies that I accidentally removed, so I had to install yum-deprecated to reinstall dnf before I could reinstall all the other Python(3) dependencies.

warrickball gravatar imagewarrickball ( 2017-08-11 02:44:58 -0600 )edit