Ask Your Question

when I run dnf I get the following error: ModuleNotFoundError: No module named '_module'

asked 2019-03-28 08:38:29 -0500

Traceback (most recent call last): File "/usr/lib64/python3.7/site-packages/libdnf/", line 14, in swig_import_helper return importlib.import_module(mname) File "/usr/lib64/python3.7/importlib/", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap="">", line 1006, in _gcd_import File "<frozen importlib._bootstrap="">", line 983, in _find_and_load File "<frozen importlib._bootstrap="">", line 967, in _find_and_load_unlocked File "<frozen importlib._bootstrap="">", line 670, in _load_unlocked File "<frozen importlib._bootstrap="">", line 583, in module_from_spec File "<frozen importlib._bootstrap_external="">", line 1043, in create_module File "<frozen importlib._bootstrap="">", line 219, in _call_with_frames_removed ImportError: /usr/lib64/python3.7/site-packages/libdnf/ undefined symbol: _ZN22ModulePackageContainer9uninstallERKSt10shared_ptrI13ModulePackageERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/bin/dnf", line 57, in <module> from dnf.cli import main File "/usr/lib/python3.7/site-packages/dnf/", line 30, in <module> import dnf.base File "/usr/lib/python3.7/site-packages/dnf/", line 29, in <module> import libdnf.transaction File "/usr/lib64/python3.7/site-packages/libdnf/", line 4, in <module> from . import module File "/usr/lib64/python3.7/site-packages/libdnf/", line 17, in <module> _module = swig_import_helper() File "/usr/lib64/python3.7/site-packages/libdnf/", line 16, in swig_import_helper return importlib.import_module('_module') File "/usr/lib64/python3.7/importlib/", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) ModuleNotFoundError: No module named '_module'

edit retag flag offensive close merge delete


What is the output of: rpm -V python3-dnf?

fcomida gravatar imagefcomida ( 2019-03-28 10:12:04 -0500 )edit

Returns nothing

carsonpadawon gravatar imagecarsonpadawon ( 2019-03-28 11:04:23 -0500 )edit

Which version of Fedora? Which version of dnf? Are you doing a sudo dnf (as opposed to doing dnf)?

OnorioCatenacci gravatar imageOnorioCatenacci ( 2019-03-28 11:24:48 -0500 )edit

Fedora 29 (uname -r = 4.20.13-200.fc29.x86_64) If I do a rpm -qa | grep python3-dnf, I get back python3-dnf-4.1.0-1.fc29.noarch if I do "sudo dnf" I get the same result.

carsonpadawon gravatar imagecarsonpadawon ( 2019-03-28 13:00:41 -0500 )edit

Please verify all dnf related packages running: rpm -V $(rpm -qa | grep dnf)

fcomida gravatar imagefcomida ( 2019-03-28 14:01:45 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted

answered 2019-04-04 16:29:09 -0500

chzenz gravatar image

Fix for Fedora 29 (4.20.13-200.fc29.x86_64) 1) check versions libdnf=libdnf-0.26.0-1.fc29.x86_64, dnf=dnf-4.1.0-1.fc29.noarch rpm -q dnf libdnf2) download the corresponding package (libdnf-0.26.0-1.fc29.x86_64.rpm) from 3) remove libdnf sudo rpm -e libdnf-0.28.1-1.fc29.x86_64 --nodeps 4) install libdnf sudo rpm -Uhv ./libdnf-0.26.0-1.fc29.x86_64.rpm --replacepkgs --replacefiles 5) enjoy, dnf runs

edit flag offensive delete link more


Exactly my case. Fixed.

javascat gravatar imagejavascat ( 2019-04-27 06:18:59 -0500 )edit

answered 2019-03-31 09:05:13 -0500

Issues was caused by corrupt files on the root partition. @fcomida suggested to run fsck on the drives, which I did and resolved some file issues. Then downloaded the libdnf version I needed to replace/reinstall. This fixed my dnf issue. I am now able to run dnf and update my system.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2019-03-28 08:38:29 -0500

Seen: 1,021 times

Last updated: Mar 28 '19