0

I am trying to run a private project code on my local computer and when I do poetry install command it shows below error.

Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
Python path configuration:
  PYTHONHOME = (not set)
  PYTHONPATH = (not set)
  program name = '/Users/tok/Library/Application Support/pypoetry/venv/bin/python'
  isolated = 0
  environment = 1
  user site = 1
  import site = 1
  sys._base_executable = '/Users/tok/Library/Application Support/pypoetry/venv/bin/python'
  sys.base_prefix = '/Users/tok/anaconda3'
  sys.base_exec_prefix = '/Users/tok/anaconda3'
  sys.platlibdir = 'lib'
  sys.executable = '/Users/tok/Library/Application Support/pypoetry/venv/bin/python'
  sys.prefix = '/Users/tok/anaconda3'
  sys.exec_prefix = '/Users/tok/anaconda3'
  sys.path = [
    '/Users/tok/anaconda3/lib/python39.zip',
    '/Users/tok/anaconda3/lib/python3.9',
    '/Users/tok/anaconda3/lib/lib-dynload',
  ]
Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding
Python runtime state: core initialized
ModuleNotFoundError: No module named 'encodings'

Current thread 0x00007ff84884a640 (most recent call first):
<no Python frame>

I thought this relates to anaconda3 and I uninstall anaconda3. However it is still showing the same error message. I am on python3.9 environment and very new to poetry. Any suggestions are highly appreciated!

Update: I tried setting PYTHONHOME and PYTHONPATH but still getting below errors now. I tried creating venv for this specific project, uninstall and reinstall python but still the same errors...

Python path configuration:
  PYTHONHOME = '/Users/tok/anaconda3'
  PYTHONPATH = '/Users/tok/anaconda3/bin'
  program name = '/Users/tok/Library/Application Support/pypoetry/venv/bin/python'
  isolated = 0
  environment = 1
  user site = 1
  import site = 1
  sys._base_executable = '/Users/tok/Library/Application Support/pypoetry/venv/bin/python'
  sys.base_prefix = '/Users/tok/anaconda3'
  sys.base_exec_prefix = '/Users/tok/anaconda3'
  sys.platlibdir = 'lib'
  sys.executable = '/Users/tok/Library/Application Support/pypoetry/venv/bin/python'
  sys.prefix = '/Users/tok/anaconda3'
  sys.exec_prefix = '/Users/tok/anaconda3'
  sys.path = [
    '/Users/tok/anaconda3/bin',
    '/Users/tok/anaconda3/lib/python39.zip',
    '/Users/tok/anaconda3/lib/python3.9',
    '/Users/tok/anaconda3/lib/python3.9/lib-dynload',
  ]
Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding
Python runtime state: core initialized
ModuleNotFoundError: No module named 'encodings'

Current thread 0x00007ff8596ec640 (most recent call first):
<no Python frame>
  • Does this answer your question? [ImportError: No module named 'encodings'](https://stackoverflow.com/questions/38132755/importerror-no-module-named-encodings) – Brian61354270 Aug 09 '23 at 13:49
  • 1
    How was poetry installed? Did you use [the official installation instructions](https://python-poetry.org/docs/#installation), or did you install it using `pip`/`pipx`? – Seon Aug 09 '23 at 14:17
  • also check output of `which python` to verify your PATH is set correctly. – M S Aug 09 '23 at 14:40
  • @Brian61354270 I followed suggestions here but still encountering same errors. [lFatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings'](https://stackoverflow.com/questions/30767191/fatal-python-error-py-initialize-unable-to-load-the-file-system-codec-importe/56803287#56803287) – tokuyou-li Aug 10 '23 at 05:09
  • @Seon yes, i followed the official installation instructions. – tokuyou-li Aug 10 '23 at 05:13
  • @MS which python returns me below. /Users/tok/anaconda3/bin/python would you suggest how shall I edit the python path configuration for alignment and avoid the error? – tokuyou-li Aug 10 '23 at 06:16
  • I was able to solve above with setting below to PATH on my bash_profile (PATH when official python download is performed.) and unsetting PYTHONPATH and PYTHONHOME `export PATH=”/Library/Frameworks/Python.framework/Versions/3.11/bin:${PATH}”` thank you everyone for taking a look on this! – tokuyou-li Aug 14 '23 at 13:32

0 Answers0