apt-get action on any python3* pkg returns "Fatal Python error: Py_Initialize: Unable to get the locale encoding"

Bug #1434772 reported by pgnd
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Ubuntu
Expired
Undecided
Unassigned

Bug Description

I've clean installed Ubuntu-server 15/vivid

 lsb_release -rd
  Description: Ubuntu Vivid Vervet (development branch)
  Release: 15.04
 uname -rm
  3.19.0-9-generic x86_64

python & python3 are installed

 python --version
  Python 2.7.9
 python3 --version
  Python 3.4.3

exec of any apt-get command attempting to update a python3* pkg fails with:

 Fatal Python error: Py_Initialize: Unable to get the locale encoding

we've now replicated the problem on two other similarly, recently installed systems.

for example

 apt-get upgrade
  Reading package lists... Done
  Building dependency tree
  Reading state information... Done
  Calculating upgrade... Done
  The following packages will be upgraded:
    python3-apport python3-problem-report
  2 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
  6 not fully installed or removed.
  Need to get 0 B/85.9 kB of archives.
  After this operation, 1,024 B of additional disk space will be used.
  Do you want to continue? [Y/n] Y
  (Reading database ... 64135 files and directories currently installed.)
  Preparing to unpack .../python3-problem-report_2.16.2-0ubuntu4_all.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
  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
  dpkg: error processing archive /var/cache/apt/archives/python3-problem-report_2.16.2-0ubuntu4_all.deb (--unpack):
   subprocess new pre-removal script returned error exit status 134
  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
  dpkg: error while cleaning up:
   subprocess installed post-installation script returned error exit status 134
  Preparing to unpack .../python3-apport_2.16.2-0ubuntu4_all.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
  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
  dpkg: error processing archive /var/cache/apt/archives/python3-apport_2.16.2-0ubuntu4_all.deb (--unpack):
   subprocess new pre-removal script returned error exit status 134
  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
  dpkg: error while cleaning up:
   subprocess installed post-installation script returned error exit status 134
  Errors were encountered while processing:
   /var/cache/apt/archives/python3-problem-report_2.16.2-0ubuntu4_all.deb
   /var/cache/apt/archives/python3-apport_2.16.2-0ubuntu4_all.deb
  E: Sub-process /usr/bin/dpkg returned an error code (1)

not sure if this is a python3 problem, apt-get/dpkg, or other. i suspect python3, atm.

dpkg --list python3
 Desired=Unknown/Install/Remove/Purge/Hold
 | Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
 |/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
 ||/ Name Version Architecture Description
 +++-==============================================-============================-============================-==================================================================================================
 ii python3 3.4.3-1 amd64 interactive high-level object-oriented language (default python3 version)

apt-cache policy python3
 python3:
   Installed: 3.4.3-1
   Candidate: 3.4.3-1
   Version table:
  *** 3.4.3-1 0
         900 http://mirrors.linode.com/ubuntu/ vivid/main amd64 Packages
         100 /var/lib/dpkg/status

Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

Thank you for taking the time to report this bug and helping to make Ubuntu better. It seems that your bug report is not filed about a specific source package though, rather it is just filed against Ubuntu in general. It is important that bug reports be filed about source packages so that people interested in the package can find the bugs about it. You can find some hints about determining what package your bug might be about at https://wiki.ubuntu.com/Bugs/FindRightPackage. You might also ask for help in the #ubuntu-bugs irc channel on Freenode.

To change the source package that this bug is filed about visit https://bugs.launchpad.net/ubuntu/+bug/1434772/+editstatus and add the package name in the text box next to the word Package.

[This is an automated message. I apologize if it reached you inappropriately; please just reply to this message indicating so.]

tags: added: bot-comment
Revision history for this message
Brian Murray (brian-murray) wrote :

What does the output of ' apt-cache policy python2.7' return?

tags: added: vivid
Changed in ubuntu:
status: New → Incomplete
Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for Ubuntu because there has been no activity for 60 days.]

Changed in ubuntu:
status: Incomplete → Expired
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.