2

I can no longer install or remove any software using apt-get. When I try I get the error:

Could not find platform independent libraries <prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
Fatal Python error: Py_Initialize: can't initialize sys standard streams
ImportError: No module names 'io'

I tried to reinstall python but that just brings up this error again.

I'm running Raspbian.

Update from comments:
Here is the error log: https://pastebin.com/nXmRTx03
and pip install io gives me: https://pastebin.com/DtHqfc3n

  • I'm not super experienced with Linux. How would I generate an error log for this? – Tyler Bourne May 24 at 18:53
  • Also, No module names 'io' seems to me a very grievious issue. io is a module upon which many Python-based programs operate. pip install io might resolve it, if pip isn't dependent upon io. – user96931 May 24 at 18:58
  • 1
    This is unlikely to be related specifically to Raspberry Pi. It seems like a generic Linux issue that might get better attention elsewhere. – Brick May 24 at 19:11
  • error log: pastebin.com/nXmRTx03 – Tyler Bourne May 24 at 19:20
  • @Brick Do you know a good place to post this? – Tyler Bourne May 24 at 19:24
1

As shown in the error log there seems to be a general problem with updates. Before trying anything else with python you should fix your update. You only do an sudo apt-get upgrade. Before doing it you should update the packages lists. So first try to do:

rpi ~$ sudo apt update
rpi ~$ sudo apt full-upgrade

and reboot. You should now have an up to date system. Check with:

rpi ~$ apt list --upgradable
Listing... Done

It should not show any upgradable packages. If this does not help then you can try to reinitialze the packet manager. How to do it you can look at Raspberry Pi sudo apt-get update not working.

If you have a clean updated system then you can try to use python.

  • the "sudo apt update" works but the "sudo apt full-upgrade gives the same error as before. – Tyler Bourne May 24 at 21:04
  • as soon as I hit y to continue the error appears. – Tyler Bourne May 24 at 21:05
  • @TylerBourne Do you reinitialized the package manager? – Ingo May 24 at 23:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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