4

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.

eyllanesc
  • 235,170
  • 19
  • 170
  • 241
john kim
  • 49
  • 1
  • 2

1 Answers1

1

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

Kalana
  • 5,631
  • 7
  • 30
  • 51