I am currently facing a problem with dnf, when running any dnf command I get this error:
File "/usr/bin/dnf", line 61, in <module>
from dnf.cli import main
File "/usr/lib/python3.10/site-packages/dnf/__init__.py", line 30, in <module>
import dnf.base
File "/usr/lib/python3.10/site-packages/dnf/base.py", line 29, in <module>
import libdnf.transaction
ModuleNotFoundError: No module named 'libdnf'
I am running Fedora 36 fully upgraded and running the 5.15.27 kernel compiled with a Bluetooth patch. yum is also not working with the same error.
This tells me you are not running the vanilla fedora system. Fedora 36 is currently at the 5.19.11 kernel. It seems likely that some recent update caused a python mismatch that broke dnf. (yum is merely a link to dnf)
It seems quite likely that your kernel with the bluetooth patch is the cause of the error, and that having the proper fedora kernel and packages installed may fix the problem. It also might resolve all the bluetooth issues as well since there are continuous fixes in that area.
The file it should be looking for is probably /usr/lib64/python3.10/site-packages/libdnf/transaction.py and it seems to be looking at /usr/lib/ instead.