6

I did sudo apt dist-upgrade to upgrade my Ubuntu distro but faced this error

Cannot start click due to a conflict with a different locally-installed Python 'click' package.  Remove it using Python packaging tools and try again.
dpkg: error processing package click (--configure):
 subprocess installed post-installation script returned error exit status 1

I uninstalled my local Python 3 click package as given in an answer here. After that I tried sudo apt-get install -f but now it fails saying

    Setting up click-apparmor (0.3.17) ...
Traceback (most recent call last):
  File "/usr/bin/click", line 37, in <module>
    import click
ImportError: No module named 'click'
dpkg: error processing package click-apparmor (--configure):
 subprocess installed post-installation script returned error exit status 1

It is not able to import click because it has been uninstalled. I couldn't find anything else on AskUbuntu related to this.

Trying apt-cache policy click python-click python3-click outputs this:

Installed: 0.4.45.1+16.10.20160916-0ubuntu1
  Candidate: 0.4.45.1+16.10.20160916-0ubuntu1
  Version table:
 *** 0.4.45.1+16.10.20160916-0ubuntu1 500
        500 http://us.archive.ubuntu.com/ubuntu yakkety/main amd64 Packages
        100 /var/lib/dpkg/status
     0.4.43+16.04.20160203-0ubuntu2 500
        500 http://in.archive.ubuntu.com/ubuntu xenial/main amd64 Packages
        500 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 Packages
        500 http://archive.ubuntu.com/ubuntu xenial/main amd64 Packages
python-click:
  Installed: (none)
  Candidate: 6.6-1
  Version table:
     6.6-1 500
        500 http://us.archive.ubuntu.com/ubuntu yakkety/main amd64 Packages
        500 http://us.archive.ubuntu.com/ubuntu yakkety/main i386 Packages
     6.2-2ubuntu1 500
        500 http://in.archive.ubuntu.com/ubuntu xenial/universe amd64 Packages
        500 http://in.archive.ubuntu.com/ubuntu xenial/universe i386 Packages
        500 http://us.archive.ubuntu.com/ubuntu xenial/universe amd64 Packages
        500 http://us.archive.ubuntu.com/ubuntu xenial/universe i386 Packages
python3-click:
  Installed: (none)
  Candidate: 6.6-1
  Version table:
     6.6-1 500
        500 http://us.archive.ubuntu.com/ubuntu yakkety/universe amd64 Packages
        500 http://us.archive.ubuntu.com/ubuntu yakkety/universe i386 Packages
     6.2-2ubuntu1 500
        500 http://in.archive.ubuntu.com/ubuntu xenial/universe amd64 Packages
        500 http://in.archive.ubuntu.com/ubuntu xenial/universe i386 Packages
        500 http://us.archive.ubuntu.com/ubuntu xenial/universe amd64 Packages
        500 http://us.archive.ubuntu.com/ubuntu xenial/universe i386 Packages

And sudo dpkg--audit outputs this:

The following packages have been unpacked but not yet configured.
They must be configured using dpkg --configure or the configure
menu option in dselect for them to work:
 ubuntu-app-launch    Session init system job for Launching Applications
 ubuntu-app-launch-tools Tools for working wtih launched applications
 ubuntu-system-settings System Settings application for Ubuntu Touch
 unity-greeter-session-broadcast Service to allow the greeter to communicate to
 url-dispatcher-tools tools for working with the URL Dispatcher.

The following packages are only half configured, probably due to problems configuring them the first time. The configuration should be retried using dpkg --configure <package> or the configure menu option in dselect: click Click packages click-apparmor Click manifest to AppArmor easyprof conversion tools url-dispatcher:amd64 service to allow sending of URLs and get handlers started

Any help is appreciated.

  • You need to install python-click for official repo, using sudo apt- install python-click then sudo apt-get install -f – user.dz Jan 22 '17 at 17:37
  • 1
    Okay, I did sudo apt install python-click but faced same import error because click is not there. Setting up click (0.4.45.1+16.10.20160916-0ubuntu1) ... Traceback (most recent call last): File "/usr/bin/click", line 37, in <module> import click ImportError: No module named 'click' dpkg: error processing package click (--configure): subprocess installed post-installation script returned error exit status 1 – gautamprajapati Jan 22 '17 at 18:01
  • Try installing click module using sudo apt install python3-click-package then sudo apt-get install -f – user.dz Jan 22 '17 at 18:34
  • 1
    I'm not able to install anything actually, every apt install throws the same error – gautamprajapati Jan 22 '17 at 19:00
  • well, install it using sudo easy_install3 click; sudo easy_install click then fix installation sudo apt-get install -f then install the official one sudo apt install python3-click-package python3-click python-click – user.dz Jan 22 '17 at 19:54
  • 2
    It's kinda recursive problem, my desktop's broke because of partial install when I installed click again and tried apt-get install -f it says Cannot start click due to a conflict with a different locally-installed Python 'click' package. Remove it using Python packaging tools and try again. When I uninstall click, it says I cannot import click. Stuck here, cannot do anything :( – gautamprajapati Jan 23 '17 at 04:07

1 Answers1

4

Remove non-ubuntu repository click then when you get this error again:

    Setting up click-apparmor (0.3.17) ...
Traceback (most recent call last):
  File "/usr/bin/click", line 37, in <module>
    import click
ImportError: No module named 'click'
dpkg: error processing package click-apparmor (--configure):
 subprocess installed post-installation script returned error exit status 1
  1. Rename click-apparmor post-installation script to skip it, using:

    sudo mv /var/lib/dpkg/info/click-apparmor.postinst /var/lib/dpkg/info/click-apparmor.postinst.backup
    
  2. Continue the stuck installation:

    sudo apt-get install -f
    
  3. Install Ubuntu repository click python modules

    sudo apt install python3-click-package python3-click python-click
    
  4. If it works, put back that post-installation script

    sudo mv /var/lib/dpkg/info/click-apparmor.postinst.backup /var/lib/dpkg/info/click-apparmor.postinst
    sudo dpkg-reconfigure click-apparmor
    
user.dz
  • 48,105