# Fatal Python error: init\_fs\_encoding: failed to get the Python codec of the filesystem encoding

**URL:** <https://discuss.python.org/t/fatal-python-error-init-fs-encoding-failed-to-get-the-python-codec-of-the-filesystem-encoding/3173>\
**Category:** Python Help\
**Created:** [February 11, 2020, 1:29pm UTC](https://discuss.python.org/t/fatal-python-error-init-fs-encoding-failed-to-get-the-python-codec-of-the-filesystem-encoding/3173 "2020-02-11T13:29:01Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![jiapei100](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/jiapei100/32/13554_2.png) [@jiapei100](https://discuss.python.org/u/jiapei100)\
**Post date:** [February 11, 2020, 1:29pm UTC](https://discuss.python.org/t/fatal-python-error-init-fs-encoding-failed-to-get-the-python-codec-of-the-filesystem-encoding/3173/1 "2020-02-11T13:29:01Z")

</div>

- If I `export PYTHONHOME=/usr/bin`, I got the following **ERRORs**.

```auto
➜ build git:(master) ✗ echo $PYTHONHOME
/usr/bin
➜ build git:(master) ✗ echo $PYTHONPATH
/home/longervision/.local/lib/python3.8/site-packages:/usr/lib/python3.8/site-packages:/usr/local/lib/python3.8/site-packages
➜ build git:(master) ✗ pip show setuptools
Python path configuration:
  PYTHONHOME = '/usr/bin'
  PYTHONPATH = '/home/longervision/.local/lib/python3.8/site-packages:/usr/lib/python3.8/site-packages:/usr/local/lib/python3.8/site-packages'
  program name = '/usr/bin/python'
  isolated = 0
  environment = 1
  user site = 1
  import site = 1
  sys._base_executable = '/usr/bin/python'
  sys.base_prefix = '/usr/bin'
  sys.base_exec_prefix = '/usr/bin'
  sys.executable = '/usr/bin/python'
  sys.prefix = '/usr/bin'
  sys.exec_prefix = '/usr/bin'
  sys.path = [
    '/home/longervision/.local/lib/python3.8/site-packages',
    '/usr/lib/python3.8/site-packages',
    '/usr/local/lib/python3.8/site-packages',
    '/usr/bin/lib/python38.zip',
    '/usr/bin/lib/python3.8',
    '/usr/bin/lib/python3.8/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 0x00007f12b17cbd80 (most recent call first):
<no Python frame>

```

- If I `export PYTHONHOME="" `

```auto
➜ build git:(master) ✗ export PYTHONHOME=""
➜ build git:(master) ✗ pip show setuptools
Name: setuptools
Version: 45.2.0
Summary: Easily download, build, install, upgrade, and uninstall Python packages
Home-page: https://github.com/pypa/setuptools
Author: Python Packaging Authority
Author-email: distutils-sig@python.org
License: UNKNOWN
Location: /home/longervision/.local/lib/python3.8/site-packages
Requires: 
Required-by: zope.interface, wadllib, twine, tensorboard, Sphinx, protobuf, Markdown, lazr.restfulclient, launchpadlib, kiwisolver, jsonschema, ipython, google-auth
➜ build git:(master) ✗ 

```

That seems to be a **Python** bug…

---

_[View the full topic](https://discuss.python.org/t/fatal-python-error-init-fs-encoding-failed-to-get-the-python-codec-of-the-filesystem-encoding/3173)._
