Hello,

Dear awesome community

Each time I try sudo update-manager it returns

Fatal Python error: Py_Initialize: Unable to get the locale encoding Traceback (most recent call last): File "/usr/lib/python3.4/encodings/__ init __.py", line 31, in ImportError: No module named 'codecs'

I tried the following with the help of my brother schultza from the IRC boys.:

  • sudo apt-get update // no errors

  • sudo apt-get clean // no errors

  • sudo apt-get install -fy // same error

  • sudo apt-get install --reinstall python3 // same error

  • sudo apt-get install --reinstall dpkg apt update-manager python // same error

  • sudo apt-get autoremove // same error

  • sudo apt-get upgrade // same error

  • sudo apt-get install --reinstall python3.4 //E: Internal Error, No file name for python3.4:amd64

  • sudo apt-get install python3.4 // same error (Dependency problems )

  • python --version //Python 2.7.6

  • sudo apt-get -f install // same error (Dependency problems )

And I didn't modify the "__ init __.py" file .

Here is a full error code with my name removed: http://pastebin.com/YX3m1HRy

I'm using ubuntu 14.04 LTS

Thanks for being Awesome Your brother Majed

  • I tried gksu update manager as one of the members recommended ; and it returns Fatal Python error: Py_Initialize: Unable to get the locale encoding Traceback (most recent call last): File "/usr/lib/python3.4/encodings/__init__.py", line 31, in <module> ImportError: No module named 'codecs' Aborted (core dumped) – Majed Nov 28 '14 at 8:24
  • I added a space between __ init __ .py ; so the editor doesn't make it init.py – Majed Nov 28 '14 at 8:35
  • Could you check how many versions of python do you have on your system? It seems 2.7.6, but apt is using a messy 3.4, try ls /usr/lib command and look at python directory. Also could you update your question with Ubuntu version? – Lety Nov 30 '14 at 17:00
  • here is the ls /usr/lib/python* output : http://pastebin.com/DK1mqNBe – Majed Dec 2 '14 at 12:41
  • @Letizia I tried lsb_release -a . Sadly I get the same error msg which is Fatal Python error: Py_Initialize: Unable to get the locale encoding Traceback (most recent call last): File "/usr/lib/python3.4/encodings/__init__.py", line 31, in <module> ImportError: No module named 'codecs' Aborted – Majed Dec 2 '14 at 12:55

This can happen if your filesystem has been damaged. Check the logs for hints, and also look inside /lost+found. The solution is to reinstall the package containing the missing module.

Find the Ubuntu package providing this file:

dpkg -S /usr/lib/python3.4/codecs.py

Reinstall the package:

sudo apt-get install --reinstall libpython3.4-minimal

Also, reinstall the packages that provide any other files found in lost+found

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.