Stupidly uninstalled bunch of python modules with sudo

Hi there

basically the title, trying to compile this app for Fedora 41 after an upgrade.

The author mentioned the following dependencies need to be installed:
- appdirs
- dbus-python
- evdev
- Pillow
- PyGObject
- pyusb

I ran using sudo and noted the warning about NOT doing this as it would cause conflicts with system packages, so stupidly ran the following command to correct:

sudo python -m pip uninstall appdirs dbus-python evdev Pillow PyGObject pyusb

I then received some warnings about not being able to uninstall system level dependencies (and I accidentally closed my console window so can’t get that specific error).

Now when I try to install dbus-python (with sudo or not) I get the following error

../subprojects/dbus-gmain/meson.build:107:11: ERROR: Dependency "dbus-1" not found, tried pkgconfig

So a bit of a calamity of errors really.

So key questions:

  1. Did I break something important with the sudo uninstall?
  2. If so how do I correct what I did in #1
  3. Lastly, how do I get dbus-python installed?

TIA for any suggestions.

You may need to re-install the python3-appdirs and python3-dbus system packages by running sudo dnf reinstall python3-appdirs python3-dbus.

Added f41, python

That did the trick thank you so much! Hopefully no other damage from what I did!

1 Like

It looks like you may also need to reinstall python3-pillow and python3-gobject, since both may have been removed by the pip uninstall command.

And for future reference – NEVER use sudo with pip.

Pip will check if it is running as a normal user and then install the packages under ~/.local/lib/python3.xx/site-packages so they are only able to be used by the user and do not conflict with the system installed python packages.

1 Like