4

When I install some python packages in Fedora, there're two ways:

  • use dnf install python-package
  • use pip install package

I notice even I use dnf update to make my Fedora the newest, when I use pip, it still tell me something like

pip is a old version, please use pip update

I guess the dnf package management is different with python-pip package management.

So which one is more recommended to install python packages ?

2
  • 1
    Please refrain from asking for recommendations here at stackoverflow. Different people will have different opinions. Opinionated questions are therefore off-topic here.
    – cel
    Nov 7, 2015 at 16:17
  • The accepted answer doesn't mention the --user flag. More about it can be read in here: stackoverflow.com/questions/42988977/…
    – nlhnt
    Mar 16, 2021 at 9:19

1 Answer 1

11

Quoted from Gentoo Wiki:

It is important to understand that packages installed using pip will not be tracked by Portage. This is the case for installing any package through means other than the emerge command. Possible conflicts can be created when installing a Python package that is available in the Portage tree, then installing the same package using pip.

Decide which package manager will work best for the use case: either use emerge or pip for Python packages, but not both. Sometimes a certain Python packages will not be available in the Portage tree, in these cases the only option is to use pip. Be wise and make good choices!

This is true for almost any nowadays package managers. If you are using packages or certain package versions that only exists in pip, use it but don't try to install that from dnf. Doing this will not only cause file collisions but also will (most possibly) break the package manager's knowledge of the system, which usually leads to major package management issues.

Other solution would be using pip in user mode, without root permissions, which will install relevant things into your home directory.

So again, it's both okay to use pip or dnf, but just don't mix these two package managers together.

6
  • thank you first, will "sudo pip update" ("pip update" running as root) break the dnf manager ?
    – linrongbin
    Nov 7, 2015 at 16:23
  • 1
    @zhaochenyou most likely. Nov 7, 2015 at 16:29
  • Orz, thanks again, I think I won't use pip again -_-
    – linrongbin
    Nov 7, 2015 at 16:35
  • 1
    @zhaochenyou like i said, you can use pip if you really need the newer version of a library, but dont run it as root or remove that package (possibly what gets pulled in as dependency by pip too) from dnf. Nov 7, 2015 at 17:22
  • @zhaochenyou do you need more help? If this or another answer was helpful to you and answered your question, please don't forget to accept that answer. Also see [What does it mean when an answer is "accepted"?][1] and [Why is voting important?][2]. Nov 8, 2015 at 1:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.