Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I needed to get a bug fix which arrived in Python 2.7.3

Latest version available for 11.10 was 2.7.2, so I built Python 2.7.3 from source

Now when I try to apt-get [anything] I get this error at the end:

Setting up unattended-upgrades (0.73ubuntu1) ...
update-rc.d: warning: unattended-upgrades start runlevel arguments (2 3 4 5) do not match LSB Default-Start values (none)
update-rc.d: warning: unattended-upgrades stop runlevel arguments (0 1 6) do not match LSB Default-Stop values (0 6)
Checking for running unattended-upgrades: 
Traceback (most recent call last):
  File "/usr/share/unattended-upgrades/unattended-upgrade-shutdown", line 27, in <module>
    import apt_pkg
ImportError: No module named apt_pkg
invoke-rc.d: initscript unattended-upgrades, action "start" failed.
dpkg: error processing unattended-upgrades (--configure):
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
E: Sub-process /usr/bin/dpkg returned an error code (1)

Since this error is python related I assume I have broken some part of apt by installing a new python.

Although I installed to /usr/local/bin and haven't touched the /usr/bin/python, which is still the 2.7.2 version that came with Ubuntu.

Very grateful if someone can suggest a way out of the mess I'm now in, preferrably without reinstalling the OS.

share|improve this question
up vote 0 down vote accepted

By default the PATH will be set /usr/local/bin before /usr/bin which would cause this issue. A simple solution is to rename the /usr/local/bin/python executable to /usr/local/bin/python2.7.3 or something similar. Then to use this new name in situations where you need the new version.

share|improve this answer
this is indeed the answer I found – Anentropic Aug 9 '12 at 14:30

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.