I had vdirsyncer running just fine for eons, on a computer that I don't use every day (or even every week). And then about a month ago I tried to run vdirsyncer sync and it choked with:

Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
Fatal Python error: Py_Initialize: Unable to get the locale encoding
ImportError: No module named 'encodings'

Current thread 0x00007f9038c2b740 (most recent call first):
Aborted (core dumped)

I don't remember screwing around in my python settings so I don't know why it would have just stopped working. I suspect that someone who spends more time in Python than I do these days might know what happened?

I'd like to fix this without trashing python, which currently defaults to 2.7 unless I specify that I want python3.

I found a question that cites the same error text, but the answer there recommends unsetting $PYTHONHOME and I haven't set it:

Fatal Python error: Py_Initialize: Unable to get the locale encoding … SyntaxError: invalid syntax Aborted (core dumped)

Answers to questions in the comments:

  • I'm on Ubuntu 18.04
  • I don't remember how I initially installed but I reinstalled with apt which didn't solve anything.
  • Which distro? What version of vdirsyncer? How are you installing? FWIW I think the latest version is for python3. – Sparhawk Jan 3 at 6:00

I reinstalled with pip3 install --user --ignore-installed vdirsyncer which seems to have gotten it working again. Still not sure how I broke it.

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.