I want to remove dnf installed packages using pip but when I type:

$ dnf info package

the package manager wrongly shows that the package is installed. I alternatively tried removing the package using dnf remove package but it wants to remove dozens of dependencies.

I have looked at dnf mark install and dnf mark remove but metadata about these commands are not clear.

How do I mark system packages that have been uninstalled by pip so that dnf also knows they have been removed?


You're going about this wrongly. There are many applications that are part of the distro that require python, pip, and a whole host of Python modules.

The installation of these packages into /usr/bin is the domain of 1 package manager (dnf - on Fedora, yum on CentOS). You should not be using pip to install/uninstall anything into this directory. Doing so puts your ability to properly manage the system at risk.

From this point you have:

  1. Only use dnf to manage python-* packages

    $ yum search python |& grep ^python | head
    python-Bottleneck-doc.noarch : Documentation files for python-Bottleneck
    python-CDDB.x86_64 : CDDB and FreeDB audio CD track info access in Python
    python-GeoIP.x86_64 : Python bindings for the GeoIP geographical lookup
    python-GeographicLib.noarch : Python implementation of GeographicLib
    python-GnuPGInterface.noarch : A Python module to interface with GnuPG
    python-GridDataFormats.noarch : Read and write data on regular grids in Python
    python-IPy.noarch : Python module for handling IPv4 and IPv6 Addresses and
    python-Levenshtein.x86_64 : Python extension computing string distances and
    python-MAPI.x86_64 : The Python MAPI extension by Zarafa
    python-NLopt.x86_64 : Python bindings for NLopt
  2. Setup a dedicated version of Python/pip using virtualenv/pipenv for your personal software development activities on these systems.

    Fight the urge and leave these intact and not view them as there for you to use etc. for your software endeavors. For your applications you should be using something like virtualenv or pipenv to setup & maintain your own reqirements.txt files and your own isolated Python environments where you'll install/maintain/manage your coding project's needed Python modules.

    We have extensive Q&A on the installation/setup of virtualenv on the site already so please use these to find out more on anything specific to it.

    For reference please refer to these tutorials on getting started with virtualenv:

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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