Ubuntu – Broken dependencies after upgrade

13.04package-managementpythonsoftware installationupgrade

After an apt-get upgrade
I got the following error:

Reading package lists... Done
Building dependency tree      
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
2 not fully installed or removed.  
After this operation, 0 B of additional disk space will be used.
Do you want to continue [Y/n]? y
Setting up python3.3-minimal (3.3.1-1ubuntu5) ...
Traceback (most recent call last):
File "/usr/lib/python3.3/py_compile.py", line 8, in <module>
    import imp
  File "/usr/lib/python3.3/imp.py", line 28, in <module>
    import tokenize
  File "/usr/lib/python3.3/tokenize.py", line 28, in <module>
    import re
  File "/usr/lib/python3.3/re.py", line 122, in <module>
    import sre_compile
  File "/usr/lib/python3.3/sre_compile.py", line 14, in <module>
    import sre_parse
  File "/usr/lib/python3.3/sre_parse.py", line 17, in <module>
    from sre_constants import *
  File "/usr/lib/python3.3/sre_constants.py", line 18, in <module>
    from _sre import MAXREPEAT
ImportError: cannot import name MAXREPEAT
dpkg: error processing python3.3-minimal (--configure):
 subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of python3.3:
 python3.3 depends on python3.3-minimal (= 3.3.1-1ubuntu5); however:
  Package python3.3-minimal is not configured yet.

dpkg: error processing python3.3 (--configure):
 dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error     from a previous failure.
                      Errors were encountered while processing:
 python3.3-minimal
 python3.3
E: Sub-process /usr/bin/dpkg returned an error code (1)

and I can't turn off my computer…

I guess I did not install correctly python 3.3, but how can I repair it?

Edit: I tried apt-get --reinstall install python2 python2-support
but I got: the same error

EDIT: More information

on my system:
Linux Mycomputer 3.5.0-34-generic #55-Ubuntu SMP Thu Jun 6 20:20:19 UTC 2013 i686 i686 i686 GNU/Linux

dpkg --print-architecture   
i386

I used to have ubuntu 12.10.
My problem occured when I tried upgrading it to 13.04.
I had a error message telling me the process stoped because there were too many errors.

I then tried to run sudo apt-get update && sudo apt-get upgrade but encountered the error above.

I had a similar problem a few months ago when I mistakenly deleted python2 from my computer. I then could not turn off my computer by clicking on the icon (it does not respond) and turning off. The only way was to force it to shut down manually. When I turned it on again, I just had an empty desktop and could not do anything. This was fixed by reinstalling the whole system.

Searching on the internet, I tried several commands:

sudo dpkg --configure -a

which resulted in

Setting up python3.3-minimal (3.3.1-1ubuntu5) ...
Traceback (most recent call last):
  File "/usr/lib/python3.3/py_compile.py", line 8, in <module>
    import imp
  File "/usr/lib/python3.3/imp.py", line 28, in <module>
       import tokenize
  File "/usr/lib/python3.3/tokenize.py", line 28, in <module>
    import re
  File "/usr/lib/python3.3/re.py", line 122, in <module>
    import sre_compile
      File "/usr/lib/python3.3/sre_compile.py", line 14, in <module>
    import sre_parse
  File "/usr/lib/python3.3/sre_parse.py", line 17, in <module>
    from sre_constants import *
  File "/usr/lib/python3.3/sre_constants.py", line 18, in <module>
    from _sre import MAXREPEAT
ImportError: cannot import name MAXREPEAT
dpkg: error processing python3.3-minimal (--configure):
 subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of python3-minimal:
 python3-minimal depends on python3.3-minimal (>= 3.3.1-1~); however:
  Package python3.3-minimal is not configured yet.


sudo apt-get --reinstall install python3 python3-support
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package python3-support


sudo apt-get -f install 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
4 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up python3.3-minimal (3.3.1-1ubuntu5) ...
Traceback (most recent call last):
  File "/usr/lib/python3.3/py_compile.py", line 8, in <module>
    import imp
  File "/usr/lib/python3.3/imp.py", line 28, in <module>
    import tokenize
  File "/usr/lib/python3.3/tokenize.py", line 28, in <module>
    import re
  File "/usr/lib/python3.3/re.py", line 122, in <module>
    import sre_compile
  File "/usr/lib/python3.3/sre_compile.py", line 14, in <module>
    import sre_parse
  File "/usr/lib/python3.3/sre_parse.py", line 17, in <module>
    from sre_constants import *
  File "/usr/lib/python3.3/sre_constants.py", line 18, in <module>
    from _sre import MAXREPEAT
ImportError: cannot import name MAXREPEAT
dpkg: error processing python3.3-minimal (--configure):
 subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of python3-minimal:
 python3-minimal depends on python3.3-minimal (>= 3.3.1-1~); however:
  Package python3.3-minimal is not configured yet.

dpkg: error processing python3-minimal (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of python3.3:
 python3.3 depends on python3.3-minimal (= 3.3.1-1ubuntu5); however:
  Package python3.3-minimal is not configured yet.

dpkg: error processing python3.3 (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of python3:
 python3 depends on python3.3 (>= 3.3.1-1~); however:
  Package python3.3 is not configured yet.
 python3 depends on python3-minimal (= 3.3.1-0ubuntu1); however:
  Package python3-minimal is not configured yet.

dpkg: error processing python3 (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 python3.3-minimal
 python3-minimal
 python3.3
 python3
E: Sub-process /usr/bin/dpkg returned an error code (1)




dpkg: error processing python3-minimal (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of python3:
 python3 depends on python3-minimal (= 3.3.1-0ubuntu1); however:
  Package python3-minimal is not configured yet.

dpkg: error processing python3 (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of python3.3:
 python3.3 depends on python3.3-minimal (= 3.3.1-1ubuntu5); however:
  Package python3.3-minimal is not configured yet.

dpkg: error processing python3.3 (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 python3.3-minimal
 python3-minimal
 python3
 python3.3


python --version

returns Python 2.7.4

Doing:

cd /tmp
sudo apt-get download python3
sudo dpkg -i python3*.deb && apt-get dist-upgrade

returns

    (Reading database ... 374310 files and directories currently installed.)
Preparing to replace python3 3.3.1-0ubuntu1 (using python3_3.3.1-0ubuntu1_i386.deb) ...
running python pre-rtupdate hooks for python3.3...
Unpacking replacement python3 ...
dpkg: dependency problems prevent configuration of python3:
 python3 depends on python3.3 (>= 3.3.1-1~); however:
  Package python3.3 is not configured yet.
 python3 depends on python3-minimal (= 3.3.1-0ubuntu1); however:
  Package python3-minimal is not configured yet.

dpkg: error processing python3 (--install):
 dependency problems - leaving unconfigured
Processing triggers for man-db ...
Errors were encountered while processing:
 python3

I also tried to remove and reinstall python3

Any help please?

Edited after Gx1sptDTDa's answer

sudo apt-get clean
sudo apt-get dist-upgrade 

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
4 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue [Y/n]? y
Setting up python3.3-minimal (3.3.1-1ubuntu5) ...
Traceback (most recent call last):
  File "/usr/lib/python3.3/py_compile.py", line 8, in <module>
    import imp
  File "/usr/lib/python3.3/imp.py", line 28, in <module>
    import tokenize
  File "/usr/lib/python3.3/tokenize.py", line 28, in <module>
    import re
  File "/usr/lib/python3.3/re.py", line 122, in <module>
    import sre_compile
  File "/usr/lib/python3.3/sre_compile.py", line 14, in <module>
    import sre_parse
  File "/usr/lib/python3.3/sre_parse.py", line 17, in <module>
    from sre_constants import *
  File "/usr/lib/python3.3/sre_constants.py", line 18, in <module>
    from _sre import MAXREPEAT
ImportError: cannot import name MAXREPEAT
dpkg: error processing python3.3-minimal (--configure):
 subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of python3-minimal:
 python3-minimal depends on python3.3-minimal (>= 3.3.1-1~); however:
  Package python3.3-minimal is not configured yet.

dpkg: error processing python3-minimal (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of python3.3:
 python3.3 depends on python3.3-minimal (= 3.3.1-1ubuntu5); however:
  Package python3.3-minimal is not configured yet.

dpkg: error processing python3.3 (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of python3:
 python3 depends on python3.3 (>= 3.3.1-1~); however:
  Package python3.3 is not configured yet.
 python3 depends on python3-minimal (= 3.3.1-0ubuntu1); however:
  Package python3-minimal is not configured yet.

dpkg: error processing python3 (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 python3.3-minimal
 python3-minimal
 python3.3
 python3
E: Sub-process /usr/bin/dpkg returned an error code (1)

Edit: Installation of all the dependencies for python3.3-minimal

sudo apt-get install libc6 libexpat1 libpython3.3-minimal zlib1g

returns

Reading package lists... Done
Building dependency tree       
Reading state information... Done
libc6 is already the newest version.
libexpat1 is already the newest version.
libpython3.3-minimal is already the newest version.
libpython3.3-minimal set to manually installed.
zlib1g is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
4 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue [Y/n]? y
Setting up python3.3-minimal (3.3.1-1ubuntu5) ...
Traceback (most recent call last):
  File "/usr/lib/python3.3/py_compile.py", line 8, in <module>
    import imp
  File "/usr/lib/python3.3/imp.py", line 28, in <module>
    import tokenize
  File "/usr/lib/python3.3/tokenize.py", line 28, in <module>
    import re
  File "/usr/lib/python3.3/re.py", line 122, in <module>
    import sre_compile
  File "/usr/lib/python3.3/sre_compile.py", line 14, in <module>
    import sre_parse
  File "/usr/lib/python3.3/sre_parse.py", line 17, in <module>
    from sre_constants import *
   File "/usr/lib/python3.3/sre_constants.py", line 18, in <module>
     from _sre import MAXREPEAT
ImportError: cannot import name MAXREPEAT
dpkg: error processing python3.3-minimal (--configure):
 subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of python3-minimal:
 python3-minimal depends on python3.3-minimal (>= 3.3.1-1~); however:
  Package python3.3-minimal is not configured yet.

dpkg: error processing python3-minimal (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of python3.3:
 python3.3 depends on python3.3-minimal (= 3.3.1-1ubuntu5); however:
  Package python3.3-minimal is not configured yet.

dpkg: error processing python3.3 (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of python3:
 python3 depends on python3.3 (>= 3.3.1-1~); however:
  Package python3.3 is not configured yet.
 python3 depends on python3-minimal (= 3.3.1-0ubuntu1); however:
  Package python3-minimal is not configured yet.

dpkg: error processing python3 (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 python3.3-minimal
 python3-minimal
 python3.3
 python3
E: Sub-process /usr/bin/dpkg returned an error code (1)

EDIT: sudo dbkg-reconfigure -a

1/ Asks:
─────────────────────────────┤ Adduser ├────────────────────────────────┐
│ │
│ By default, users' home directories are readable by all users on the │
│ system. If you want to increase security and privacy, you might want │
│ home directories to be readable only for their owners. But if in doubt, │
│ leave this option enabled. │
│ │
│ This will only affect home directories of users added from now on with │
│ the adduser command. │
│ │
│ Do you want system-wide readable home directories?

Said yes

2/
┤ Configuring apparmor ├──────────────────────────┐
│ Please enter a space separated list of any additional locations for user │
│ home directories. These locations are in addition to those specified in │
│ /etc/apparmor.d/tunables/home and must end with a '/'. │
│ │
│ Example: if user's directories are stored in /srv/nfs/home and │
│ /mnt/homes, you should enter "/srv/nfs/home/ /mnt/homes/". │
│ │
│ Additional home directory locations:

I don't know what location to indicate…
so I just pass

Finally, I read on the shell:

update-rc.d: warning: /etc/init.d/acpi-support missing LSB information
update-rc.d: see <http://wiki.debian.org/LSBInitScripts>
acpid stop/waiting
acpid start/running, process 24816
 * Starting AppArmor  

profiles                                                              Skipping      
 profile in /etc/apparmor.d/disable: usr.bin.firefox
Skipping profile in /etc/apparmor.d/disable: usr.sbin.rsyslogd
                                                                     [ OK ]
 * Reloading AppArmor profiles                                                  
Skipping     profile in /etc/apparmor.d/disable: usr.bin.firefox
Skipping profile in /etc/apparmor.d/disable: usr.sbin.rsyslogd
                                                                     [ OK ]
gpg: key 437D05B5: "Ubuntu Archive Automatic Signing Key <ftpmaster@ubuntu.com>" 
not     changed
gpg: key FBB75451: "Ubuntu CD Image Automatic Signing Key <cdimage@ubuntu.com>" 
not     changed
gpg: key C0B21F32: "Ubuntu Archive Automatic Signing Key (2012)  
  <ftpmaster@ubuntu.com>"     not changed
gpg: key EFE21092: "Ubuntu CD Image Automatic Signing Key (2012) 
<cdimage@ubuntu.com>"     not changed
gpg: Total number processed: 4
gpg:              unchanged: 4
Unknown media type in type 'all/all'
Unknown media type in type 'all/allfiles'
Unknown media type in type 'uri/mms'
Unknown media type in type 'uri/mmst'
Unknown media type in type 'uri/mmsu'
Unknown media type in type 'uri/pnm'
Unknown media type in type 'uri/rtspt'
Unknown media type in type 'uri/rtspu'
/usr/sbin/dpkg-reconfigure: asymptote is broken or not fully installed

Edit: Synaptic
On synaptic, no "broken dependencies" is displayed (I click on status and all I can see is:
All
Installed
Installed (local or obsolete)
Installed (manual)
Not installed
Not installed (residual config)

Best Answer

EDIT

The problem was related to the following bug report: https://bugs.launchpad.net/ubuntu/+source/ubuntu-release-upgrader/+bug/1165281

Follow steps in comment #3 to #5, but change the path to python3.3 rather than 2.7.

Related Question