3
votes

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 ?

1
Please refrain from asking for recommendations here at stackoverflow. Different people will have different opinions. Opinionated questions are therefore off-topic here.cel
The accepted answer doesn't mention the --user flag. More about it can be read in here: stackoverflow.com/questions/42988977/…nlhnt

1 Answers

8
votes

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.