john kim
john kim

Reputation: 59

How to troubleshoot "Could not find platform independent libraries <prefix>" in Python & buildozer

Through buildozer in Ubuntu, I was running an app I am developing.
However, I faced the following error:

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

I searched and searched and searched for an adequate method for treating this particular problem on Google. Then, I found few methods to fix this problem.

For the first attempt, I set: export PYTHONHOME=/usr/local/lib/python3.7 as suggested in the error comments. Unfortunately, the same error appeared even with this change. For the second attempt, I tried to delete virtual environment file and reset it as suggested on the following website: ImportError: No module named 'encodings'. But, again, I failed to eliminate this error.

I saw that some of the posts on Stackoverflow regarding this issue provide repetitive methods. I am stuck with this issue. I would deeply appreciate it if anyone can be kind enough to shed some light on this. Blessings.

Upvotes: 5

Views: 4057

Answers (1)

Kalana
Kalana

Reputation: 6163

Follow these steps to avoid this

  1. Activate virtualenv by source venv/bin/activate
  2. Set ENV["PYTHON"] to correct Python path under the virtualenv
  3. Install PyCall by pip install pycall
  4. Open v0.6/PyCall/deps/deps.jl with a text editor and replace const PYTHONHOME = "..." with const PYTHONHOME = ""
  5. Run using PyCall

Further details

Upvotes: 1

Related Questions