Python3.1 compiling instead of 2.6

Asked by waugust

I have installed Python 2.5 (for GAE), Python 2.6 (Ubuntu default), and Python 3.1 (latest).
What appears to be happening is that Python 3.1 attempts to compile and runs into syntactical errors due to version differences:
> aptget python-pyatspi
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
  python-pyatspi
0 upgraded, 1 newly installed, 0 to remove and 6 not upgraded.
1 not fully installed or removed.
Need to get 0B/45.6kB of archives.
After this operation, 184kB of additional disk space will be used.
Selecting previously deselected package python-pyatspi.
(Reading database ... 214048 files and directories currently installed.)
Unpacking python-pyatspi (from .../python-pyatspi_1.28.1-0ubuntu1_all.deb) ...
Setting up libgcj-common (1:4.4.1-1ubuntu2) ...
Compiling /usr/lib/python3.1/dist-packages/aotcompile.py ...
  File "/usr/lib/python3.1/dist-packages/aotcompile.py", line 115
    raise Error, "nothing to do"
               ^
SyntaxError: invalid syntax

Compiling /usr/lib/python3.1/dist-packages/classfile.py ...
  File "/usr/lib/python3.1/dist-packages/classfile.py", line 30
    raise TypeError, type(arg)
                   ^
SyntaxError: invalid syntax

pycentral: pycentral pkginstall: error byte-compiling files (2)
pycentral pkginstall: error byte-compiling files (2)
dpkg: error processing libgcj-common (--configure):
 subprocess installed post-installation script returned error exit status 1
Setting up python-pyatspi (1.28.1-0ubuntu1) ...
Compiling /usr/lib/python3.1/dist-packages/pyatspi/accessible.py ...
  File "/usr/lib/python3.1/dist-packages/pyatspi/accessible.py", line 108
    print template % _ACCESSIBLE_CACHE
                 ^
SyntaxError: invalid syntax

Compiling /usr/lib/python3.1/dist-packages/pyatspi/registry.py ...
  File "/usr/lib/python3.1/dist-packages/pyatspi/registry.py", line 353
    except KeyboardInterrupt, e:
                            ^
SyntaxError: invalid syntax

pycentral: pycentral pkginstall: error byte-compiling files (7)
pycentral pkginstall: error byte-compiling files (7)
dpkg: error processing python-pyatspi (--configure):
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 libgcj-common
 python-pyatspi
E: Sub-process /usr/bin/dpkg returned an error code (1)

> python -V
Python 2.6.4

Notice that if I run python -V it confirms the active version is 2.6.4 (not 3.1)

Question information

Language:
English Edit question
Status:
Expired
For:
Ubuntu apt Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Michael Wood (mwood) said :
#1

It looks like you had a partially installed libgcj-common package when you tried to install python-pyatspi.

What happens if you do this:
$ sudo dpkg --configure libgcj-common
?

Revision history for this message
waugust (waugustynski) said :
#2

Same thing, basically. I had actually 26 packages that were like this before. I removed them and started to reinstall only to notice the same thing happening:

> sudo dpkg --configure libgcj-common
Setting up libgcj-common (1:4.4.1-1ubuntu2) ...
Compiling /usr/lib/python3.1/dist-packages/aotcompile.py ...
  File "/usr/lib/python3.1/dist-packages/aotcompile.py", line 115
    raise Error, "nothing to do"
               ^
SyntaxError: invalid syntax

Compiling /usr/lib/python3.1/dist-packages/classfile.py ...
  File "/usr/lib/python3.1/dist-packages/classfile.py", line 30
    raise TypeError, type(arg)
                   ^
SyntaxError: invalid syntax

pycentral: pycentral pkginstall: error byte-compiling files (2)
pycentral pkginstall: error byte-compiling files (2)
dpkg: error processing libgcj-common (--configure):
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 libgcj-common

It says "Compiling /usr/libpython3.1.."
then it raises en error, "raise Error, "nothing to do"". The error is because that's old Python syntax. In Python 3.1 it should be raise Error("nothing to do")...
It looks like apt should be using Python 2.6 (the system default) but is using 3.1 instead...

Revision history for this message
Michael Wood (mwood) said :
#3

I'm not sure what libgcj-common has to do with Python, so I don't know why Python is involved when configuring it.

Also, why does it seem that there is Python 2 code in /usr/lib/python3.1?

Revision history for this message
waugust (waugustynski) said :
#4

These packages were just dependencies of other packages that installed..
It appeared that whatever I installed worked fine though I would end up with other packages showing up broken like this... I don't know if its that 2.5 and 2.6 would compile their own versions and then 3.1 would choke?? idk..
I can't verify any other operational difficulties other then this list of packages growing every time I install something.

Revision history for this message
Michael Wood (mwood) said :
#5

What does "dpkg -S /usr/lib/python3.1/dist-packages/aotcompile.py /usr/lib/python3.1/dist-packages/classfile.py" give you?

Revision history for this message
waugust (waugustynski) said :
#6

hmmm:
>dpkg -S /usr/lib/python3.1/dist-packages/aotcompile.py /usr/lib/python3.1/dist-packages/classfile.py
dpkg: /usr/lib/python3.1/dist-packages/aotcompile.py not found.
dpkg: /usr/lib/python3.1/dist-packages/classfile.py not found.

> ll /usr/lib/python3.1/dist-packages/
total 32
lrwxrwxrwx 1 root root 33 2010-03-20 10:29 aotcompile.py -> /usr/share/pyshared/aotcompile.py
lrwxrwxrwx 1 root root 32 2010-03-20 10:29 classfile.py -> /usr/share/pyshared/classfile.py
drwxr-xr-x 2 root root 4096 2010-03-09 16:22 gnome_app_install-0.4.1ubuntu1.egg-info
drwxr-xr-x 2 root root 4096 2010-03-09 16:22 GnomeCodecInstall
drwxr-xr-x 2 root root 4096 2010-03-20 10:32 pyatspi
-rw-r--r-- 1 root root 119 2009-11-02 07:55 README
drwxr-xr-x 3 root root 4096 2010-03-13 09:56 zc
drwxr-xr-x 2 root root 4096 2010-03-13 09:56 zc.lockfile.egg-info
lrwxrwxrwx 1 root root 41 2010-03-13 09:56 zc.lockfile-nspkg.pth -> /usr/share/pyshared/zc.lockfile-nspkg.pth
drwxr-xr-x 3 root root 4096 2010-03-20 10:28 zope
drwxr-xr-x 2 root root 4096 2010-03-13 09:56 zope.event.egg-info
lrwxrwxrwx 1 root root 40 2010-03-13 09:56 zope.event-nspkg.pth -> /usr/share/pyshared/zope.event-nspkg.pth

Revision history for this message
Michael Wood (mwood) said :
#7

OK, and "dpkg -S /usr/share/pyshared/aotcompile.py /usr/share/pyshared/classfile.py"?

I assume you're running Karmic? I don't currently have a Karmic box.

Revision history for this message
Michael Wood (mwood) said :
#8

Sorry, I should have thought before to check here:

http://packages.ubuntu.com/search?searchon=contents&keywords=aotcompile.py&mode=exactfilename&suite=karmic&arch=any

I see that is part of libgcj-common.

If you uninstall that, are you then able to install python-pyatspi?

Revision history for this message
waugust (waugustynski) said :
#9

Yeah, I should have mentioned I'm 9.10.
>dpkg -S /usr/share/pyshared/aotcompile.py
libgcj-common: /usr/share/pyshared/aotcompile.py
> dpkg -S /usr/share/pyshared/classfile.py
libgcj-common: /usr/share/pyshared/classfile.py

So I guess that means that the package is installed for the 2.5 & 2.6 versions but 3.1 can't run them?
Is the ticket for Python support then?
It just seems like most things I install end up doing this with packages that are dependent.
I guess I could just get rid of python3.1. I'm not using it a this time, though I will be down the line (I'm doing web apps right now with Django and GAE which require Python 2).

Revision history for this message
waugust (waugustynski) said :
#10

I removed python-pyatspi, then removed libgcj-common. When installing python-pyatspi, ran into same problem:
> aptremove libgcj-common
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
  libgcj-common
0 upgraded, 0 newly installed, 1 to remove and 6 not upgraded.
1 not fully installed or removed.
After this operation, 299kB disk space will be freed.
Do you want to continue [Y/n]? Y
(Reading database ... 214047 files and directories currently installed.)
Removing libgcj-common ...
Processing triggers for man-db ...
> aptget python-pyatspi
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
  python-pyatspi
0 upgraded, 1 newly installed, 0 to remove and 6 not upgraded.
Need to get 0B/45.6kB of archives.
After this operation, 184kB of additional disk space will be used.
Selecting previously deselected package python-pyatspi.
(Reading database ... 214030 files and directories currently installed.)
Unpacking python-pyatspi (from .../python-pyatspi_1.28.1-0ubuntu1_all.deb) ...
Setting up python-pyatspi (1.28.1-0ubuntu1) ...
Compiling /usr/lib/python3.1/dist-packages/pyatspi/accessible.py ...
  File "/usr/lib/python3.1/dist-packages/pyatspi/accessible.py", line 108
    print template % _ACCESSIBLE_CACHE
                 ^
SyntaxError: invalid syntax

Compiling /usr/lib/python3.1/dist-packages/pyatspi/registry.py ...
  File "/usr/lib/python3.1/dist-packages/pyatspi/registry.py", line 353
    except KeyboardInterrupt, e:
                            ^
SyntaxError: invalid syntax

pycentral: pycentral pkginstall: error byte-compiling files (7)
pycentral pkginstall: error byte-compiling files (7)
dpkg: error processing python-pyatspi (--configure):
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 python-pyatspi
E: Sub-process /usr/bin/dpkg returned an error code (1

Revision history for this message
Michael Wood (mwood) said :
#11

This sounds to me like a problem with python-central installing links to python2 code in /usr/lib/python3.1, but I don't know enough about how it works to say for sure.

Revision history for this message
waugust (waugustynski) said :
#12

None the less, I appreciate you taking the time to check it out.
Python-central is an Ubuntu package?
Do you think I need to put it to a bug or just wait to see if someone else picks it up here?

Revision history for this message
Michael Wood (mwood) said :
#13

OK, so it looks like the same problem affects both of those packages and probably every python2 package when you have python3 installed.

I had a very quick look to see if I could find an existing bug report for this, but I didn't see it. It's 1:22 am here, though and I didn't look very hard.

If I were you I'd have a better look to see if there's an existing bug report and if not, open one. (I might be wrong about python-central being to blame. I'm not very familiar with it, but it seems to me that your issues are caused by a bug.)

In the mean time, uninstall python3.1 if you can and I think that should work.

Revision history for this message
Michael Wood (mwood) said :
#14

Didn't see your last message before posting my last one.

Yes, python-central is an Ubuntu package. As I said above, I might be wrong about it being to blame, though.

If you don't find an existing bug, open one and link this question to it. (At least I think that's how it's supposed to work here :)

Revision history for this message
waugust (waugustynski) said :
#15

Thanks Michael!

Revision history for this message
Michael Wood (mwood) said :
#16

No problem :)

Revision history for this message
Launchpad Janitor (janitor) said :
#17

This question was expired because it remained in the 'Open' state without activity for the last 15 days.