Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

When I run sudo apt-get upgrade, the dpkg error appears and interupts the process.

Error details:

Setting up python-minimal (2.7.3-0ubuntu7.1) ...
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/local/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/usr/local/lib/python2.7/compileall.py", line 16, in <module>
    import struct
  File "/usr/local/lib/python2.7/struct.py", line 1, in <module>
    from _struct import *
ImportError: No module named _struct
dpkg: error processing python-minimal (--configure):
 subprocess installed post-installation script returned error exit status 255
dpkg: dependency problems prevent configuration of python:
 python depends on python-minimal (= 2.7.3-0ubuntu7.1); however:
  Package python-minimal is not configured yet.

And this problem leads to a series of dependency problems when processing the following packages:

 python
 gwibber-service
 libgwibber3
 libgwibber-gtk3
 gwibber
 gwibber-service-facebook
 gwibber-service-identica
 gwibber-service-twitter
 python-all
 python-dev
 python-all-dev
 python-apt
 python-problem-report
 python-apport
 python-libxml2
 unity-lens-gwibber
 unity-scope-video-remote

Any helps are appreciated! ^_^

Edit:

Finally, nothing I can do for this problem. And several days later, the root directory is full and I even could not uninstall any software because of this problem.

So what I can do is just to reinstall the system. ╮(╯_╰)╭

share|improve this question
    
possible duplicated of askubuntu.com/q/270011/169736 –  Braiam Jul 26 '13 at 13:03
    
@Braiam, I've found this question before. The answers are suggested to reinstall python. I've tried, and failed. Thanks anyway! –  Xu Jiawan Jul 29 '13 at 6:19
add comment

2 Answers

Don't know if this is going to help you out at all, it's a bit of a stab in the dark, but make sure your default Python version is set to 2.7.

There are three files of concern in /usr/bin:

python (symlink)
python2.7
python3 (symlink)

If you do ls -l /usr/bin | grep python you will see what each symlink points to.

If it shows you python -> python3 or python -> python3.3 there's something wrong. At this point you will want to:

rm /usr/bin/python
ln -s /usr/bin/python2.7 /usr/bin/python
share|improve this answer
    
Thanks for your reply. In my /usr/bin, python is soft-linked to python2.7. –  Xu Jiawan Aug 12 '13 at 2:00
add comment

OK, going through the packages, I found that python-minimal does not have struct.py, but python-minimal2.7 does.

So, try this and see if it helps you out:

sudo apt-get install --reinstall python2.7-minimal
sudo apt-get upgrade

If even that does't work, perhaps your $PYTHONPATH is messed up somehow.

nano ~/.bashr

Add the line export PYTHONPATH="${PYTHONPATH}:/usr/lib/python2.7" then

source ~/.bashrc

And try your update yet again.

share|improve this answer
    
edited to add "export", it's kind of necessary ;) –  Githlar Aug 12 '13 at 8:47
    
It says "Unable to locate package python-minimal2.7". Do you mean python2.7-minimal? When I try to reinstall python2.7-minimal, the same dependency problem occurs. –  Xu Jiawan Aug 13 '13 at 11:08
    
Hmm, sorry it took so long for me to get back to you. Try sudo apt-get clean sudo apt-get update sudo apt-get upgrade. –  Githlar Aug 13 '13 at 21:31
    
I'm afraid that it doesn't work. After clean, update and upgrade, then I try to reinstall python2.7-minimal, but the same dependency problem appears and the reinstall fails again. –  Xu Jiawan Aug 14 '13 at 2:47
    
Looks like I was wrong about which package. it's actually libpython2.7-minimal that contains struct.py. Make sure that's installed. What is the current version of python2.7-minimal that you have installed? Hint: dpkg -l | grep python2.7-minimal –  Githlar Aug 14 '13 at 3:01
show 4 more comments

Your Answer

 
discard

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.