Had this error while trying to install Lutris :sudo add-apt-repository ppa:lutris-team/lutris and then this came out :

 Traceback (most recent call last):
  File "/usr/bin/add-apt-repository", line 11, in <module>
    from softwareproperties.SoftwareProperties import SoftwareProperties, shortcut_handler
  File "/usr/lib/python3/dist-packages/softwareproperties/SoftwareProperties.py", line 28, in <module>
    import apt_pkg
ModuleNotFoundError: No module named 'apt_pkg'

Seems like the problem is something about python?


It seems that you've upgraded python3 version. As explained here https://askubuntu.com/a/1191220/607679; because of the python3 update, usr/bin/python3 points to a python that does not have apt_pkg.

You can create symlink like below. This should your problem.

ln -s /usr/lib/python3/dist-packages/apt_pkg.cpython-36m-x86_64-linux-gnu.so /usr/lib/python3/dist-packages/apt_pkg.so

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.