4

Getting frustrated here because I can't seem to get things right here:

I want to use python3.3 (on Ubuntu12.04) and am having major issues getting things to work. I was working fine with python3.2 until I wanted to use Bottle+Jinja2, so I had to upgrade to python3.3 which I may have done improperly (sudo apt-get install python3.3 I think?).

Things seemed to work for a little while until I was in the python interpreter (accessed via python3 on the command line, after I changed the symlink for python3 from python3.2 to python3.3). I called a function that raised an error, and it ran into the spew of errors that results in:

[user]:~$ python3.3
Python 3.3.0 (default, Sep 25 2013, 19:28:08) 
[GCC 4.7.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> x = []
>>> x[2]
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
IndexError: list index out of range
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 30, in <module>
    import apport.fileutils
  File "/usr/lib/python3/dist-packages/apport/fileutils.py", line 23, in <module>
    from apport.packaging_impl import impl as packaging
  File "/usr/lib/python3/dist-packages/apport/packaging_impl.py", line 20, in <module>
    import apt
  File "/usr/lib/python3/dist-packages/apt/__init__.py", line 21, in <module>
    import apt_pkg
ImportError: No module named 'apt_pkg'

Original exception was:
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
IndexError: list index out of range

and I just don't understand why. I tried doing

sudo apt-get remove --purge python-apt
sudo apt-get install python-apt

as per this related SO question and answer but that doesn't seem to alleviate the issue.

Anyone have any thoughts? I've seen something about setuptools, distribute, easy_install, pip, ez_setup.py but I haven't been able to sift through all the chaff to get to an understandable way forward. Thanks

EDIT1: I had read elsewhere that perhaps I just needed to symlink apt_pkg.so to apt_pkg.cpython-32mu.so in /usr/bin/python3/dist-packages but when I do that, instead of an apt_pkg error, I get a segfault...

EDIT2: at this point, I don't mind uninstalling and reinstalling python3.3; but I don't know how to do that properly, apparently.

Community
  • 1
  • 1
dwanderson
  • 2,775
  • 2
  • 25
  • 40
  • Are you currently working on the `apt` module? If I'm reading the output correctly, you have `apt_pkg.so` lying in your current working directory. Why do do you need that anyways? – phihag Jan 22 '14 at 03:18
  • Sorry, that's like a 6-nested traceback; this error stems from sys.excepthook(), and is over in /usr/bin/python3/dist-packages; I don't have any apt_pkg* file in my current directory that could be throwing things off (though good call; I've been burned by that before, elsewhere). – dwanderson Jan 22 '14 at 03:43
  • Well, why are you omitting the 6-nested traceback from the question then? It almost certainly describes what's going on here. – phihag Jan 22 '14 at 04:13
  • @phihag - sorry about that. updated for clarity. – dwanderson Jan 22 '14 at 14:34
  • This is harmless, and a bug in [Apport](https://wiki.ubuntu.com/Apport), which you simply may want to disable. – phihag Jan 22 '14 at 17:03

0 Answers0