I have upgraded from Ubuntu 12.10 to 13.10. In the meanwhile I have removed the Enthought Python distribution manually because I want to start back on the 'official' packages. So I removed the python folder and redirected the pythonpath towards the official package. Here a dump of PYTHONPATH:
$ echo $PYTHONPATH
/usr/local/Madagascar_1.5/lib/python2.7/dist-packages:/usr/lib/python2.7:/usr/local/lib/python2.7:/usr/local/Madagascar_1.5/lib/python2.7:/usr/local/Madagascar_1.5/lib/python2.7/dist-packages:/usr/local/Madagascar_1.5/lib:/usr/lib/python3
Which is theoretically what you need to get everything working. I code with python 2.7 and everything works perfectly.
However to start gedit I need to export
PYTHONPATH=/usr/lib/python3
whereas it is already in pythonpath. As Gedit depends on python 3 now. I followed this solution but to me it is not satisfactory:
https://askubuntu.com/questions/363291/multiple-versions-of-python
When I update my packages with aptitude, I get an error message that gedit has inconsistencies. So the general advice is to reinstall gedit. Here the output:
sudo apt-get --reinstall install gedit
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 3 not upgraded.
1 not fully installed or removed.
Need to get 0 B/492 kB of archives.
After this operation, 0 B of additional disk space will be used.
(Reading database ... 304259 files and directories currently installed.)
Preparing to replace gedit 3.8.3-0ubuntu3 (using .../gedit_3.8.3-0ubuntu3_amd64.deb) ...
Fatal Python error: Py_Initialize: Unable to get the locale encoding
File "/usr/lib/python2.7/encodings/__init__.py", line 123
raise CodecRegistryError,\
^
SyntaxError: invalid syntax
Aborted (core dumped)
dpkg: warning: subprocess old pre-removal script returned error exit status 134
dpkg: trying script from the new package instead ...
Fatal Python error: Py_Initialize: Unable to get the locale encoding
File "/usr/lib/python2.7/encodings/__init__.py", line 123
raise CodecRegistryError,\
^
SyntaxError: invalid syntax
Aborted (core dumped)
dpkg: error processing /var/cache/apt/archives/gedit_3.8.3-0ubuntu3_amd64.deb (--unpack):
subprocess new pre-removal script returned error exit status 134
No apport report written because MaxReports is reached already
Fatal Python error: Py_Initialize: Unable to get the locale encoding
File "/usr/lib/python2.7/encodings/__init__.py", line 123
raise CodecRegistryError,\
^
SyntaxError: invalid syntax
Aborted (core dumped)
dpkg: error while cleaning up:
subprocess installed post-installation script returned error exit status 134
Errors were encountered while processing:
/var/cache/apt/archives/gedit_3.8.3-0ubuntu3_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
I was wondering if it was my PYTHONHOME which was not properly defined but it did not bring me anywhere to export a variable.
Now the other annoyance is that Ubuntu-desktop being dependant of gedit, it is also broken after an update I made (without thinking...). So now I have no more desktop. Screen is black after logging.
Any suggestion to put gedit back on track?
Thanks in advance
Correct me if I'm wrong but aren't you saying that gedit will not work when your PYTHONPATH looks like this:
But when you manually change it with
export
toIt works fine?
Is there any reason why you would want the path to look like in the first example all the time? You could make it to that by adding the
export
command to~/bash.rc
edit: Also, could you experiment and try putting the part that gedit likes,
/usr/lib/python3
, at the start of the path and then the rest of it afterwards, rather than having python3 right at the end? Maybe it uses "short circuit logic" and chooses the first one it finds that works.