2

It seems like I am getting some error related to Python, but I am not sure why I am getting it. When I ran Software Updater (in 12.10) from unity, it didn't even fire up.

When I did this from the terminal:

sudo update-manager

I am getting this trace, and update manager doesn't even open. I don't think this is a bug, so I am asking it here.

Traceback (most recent call last):
  File "/usr/bin/update-manager", line 28, in <module>
    from gi.repository import Gtk
  File "/usr/lib/python3/dist-packages/gi/repository/__init__.py", line 25, in <module>
    from ..importer import DynamicImporter
  File "/usr/lib/python3/dist-packages/gi/importer.py", line 24, in <module>
    import logging
ImportError: No module named logging
Error in sys.excepthook:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 64, in apport_excepthook
    from apport.fileutils import likely_packaged, get_recent_crashes
  File "/usr/lib/python3/dist-packages/apport/__init__.py", line 4, in <module>
    from apport.report import Report
  File "/usr/lib/python3/dist-packages/apport/report.py", line 15, in <module>
    import xml.dom, xml.dom.minidom
ImportError: No module named xml.dom

Original exception was:
Traceback (most recent call last):
  File "/usr/bin/update-manager", line 28, in <module>
    from gi.repository import Gtk
  File "/usr/lib/python3/dist-packages/gi/repository/__init__.py", line 25, in <module>
    from ..importer import DynamicImporter
  File "/usr/lib/python3/dist-packages/gi/importer.py", line 24, in <module>
    import logging
ImportError: No module named logging

However, apt-get commands work fine. Python seems to be installed properly(?), so I can't figure out what the trace is saying. Any idea what can I do to get back update-manager working?

  • Did you just add/remove/modify any of your files which could have messed up with these configurations? Or did you add/remove any ppa, though they don't seem to be of relevance here? – jobin Dec 28 '12 at 19:25
  • Try with the following command and update again. sudo rm -vf /var/cache/apt/*.bin – Lucio Dec 28 '12 at 19:29
  • @Jobin: I've been playing with gnome couple of days ago and have switched to gdm as my lightdm works properly no more, but I don't think that has anything to do with python3 since I haven't even touched it?

    I wrote what happened recently here: http://askubuntu.com/questions/232926/etc-x11-x-not-executable-error-when-startx, but do you think that must have affected my update-manager?

    – Bharadwaj Srigiriraju Dec 28 '12 at 19:33
  • @Lucio: Did it. Still no luck with update-manager though. Same errors again. – Bharadwaj Srigiriraju Dec 28 '12 at 19:33
  • Try with the following commands. sudo apt-get install -f and then sudo dpkg --configure -a – Lucio Dec 28 '12 at 19:34
  • @Lucio: Still no luck. No packages seem to have broken/lost. Both the commands run fine and generate no output. update-manager gives same errors again. :( – Bharadwaj Srigiriraju Dec 28 '12 at 19:37
  • Hey guys... the update-manager works after reinstalling python3.2. Thanks for your help! – Bharadwaj Srigiriraju Dec 28 '12 at 19:46

2 Answers2

2

The modules logging and xml.dom come from python3.2-minimal and python3.2 respectively.

This should fix the problem:

sudo apt-get install --reinstall python3.2 python3.2-minimal
  • Yup! That made it work... update-manager works fine now!! So, just asking, what must have broken in python3.2? – Bharadwaj Srigiriraju Dec 28 '12 at 19:46
  • 1
    @ForbiddenOverseer: who knows? Today I have read many questions of users that have played with sudo rm. Perhaps you have removed some stuff without noticing? – Andrea Corbellini Dec 28 '12 at 19:48
  • +1 for "Today I have read many questions of users that have played with sudo rm"... lolwut?? That was a laughably cynical way to put it... :D

    Well, I don't remember messing with python tbh... But anyway thanks for your help. :)

    – Bharadwaj Srigiriraju Dec 28 '12 at 20:00
0

I had this problem after a ppa-purge command. I resolved it following the official Ubuntu Community Help on this page: The following are the commands listed.

Step 9 Ubuntu Software Center fails to open

If the Ubuntu Software Center fails to open, then please execute these Terminal commands:

sudo rm /usr/lib/python*/dist-packages/__pycache__/*pyc
sudo apt-get install --reinstall python3-gi
sudo apt-get purge software-center
rm -rf ~/.cache/software-center
rm -rf ~/.config/software-center
rm -rf ~/.cache/update-manager-core
sudo rm /var/lib/apt-xapian-index/cataloged_times.p
sudo rm /var/lib/apt-xapian-index/values
sudo update-apt-xapian-index --verbose --force
sudo update-apt-xapian-index --force
sudo apt-get update
sudo apt-get dist-upgrade
sudo apt-get install software-center ubuntu-desktop
sudo dpkg-reconfigure software-center --force
sudo update-software-center
sudo apt-get install --reinstall software-center

Then reboot and retest.

To make the process quicker, I made a .sh and copy/paste all commands listed in it. Execute, reboot, and done ! All works now : add-apt-repository, software-center, update-manager !

Hope this can help.

Pilot6
  • 90,100
  • 91
  • 213
  • 324
berturion
  • 101