Search code examples
python-3.xubuntuaptubuntu-20.04

Can't add repository to install from on Ubuntu 20.04 LTS when switching from Python 3.8 to 3.7?


I am trying to install an application and as mentioned in the manual, I am trying to add it's repository without luck:

sudo add-apt-repository ppa:linuxuprising/shutter

And here is the error I am getting:

Traceback (most recent call last):
  File "/usr/bin/add-apt-repository", line 12, 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'

I have tried to reinstall using this solution:

sudo apt remove python3-apt
sudo apt autoremove
sudo apt autoclean
sudo apt install python3-apt

Still get the same error on my Ubuntu 20.04 LTS Python version is: 3.7.9

I must say that it work when I switch to python 3.8 using update-alternatives. Maybe this can help you to guide me what should I change.


Solution

  • You can add the repository manually (working around the add-apt-repository script problem):

    Import the gpg key:

    sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com EA8CACC073C3DB2A
    

    Add the ppa:

    printf "%s\n" "deb http://ppa.launchpad.net/linuxuprising/shutter/ubuntu focal main" |\
    sudo tee /etc/apt/sources.list.d/linuxuprising-shutter-focal.list
    

    Then run:

    sudo apt update
    

    Technical details: Linux Uprising team (check the gpg key)