close

[Solved] Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding, when trying to start uwsgi

Hello Guys, How are you all? Hope You all Are Fine. Today I get the following error Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding, when trying to start uwsgi in Python. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding, when trying to start uwsgi Error Occurs?

Today I get the following error Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding, when trying to start uwsgi in Python.

How To Solve Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding, when trying to start uwsgi Error ?

  1. How To Solve Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding, when trying to start uwsgi Error ?

    To Solve Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding, when trying to start uwsgi Error In my case this is caused by my admin's base environment. I would try removing PYTHONHOME and PYTHONPATH variables by doing

Solution 1

I found a solution while browsing Bing, not Google.

I see your PYTHONHOME is set to PYTHONHOME = '/home/env3/educ'. Try to check if it is really there.

The solution for me was to remove the PYTHONHOME environment variable. For you, it can be just that, or setting that variable to another value. This worked on Windows, and would work on Linux for sure. If someone tries this, please post a comment here !

A CPython developer confirmed the solution here. :

This is not a Python bug, this is a symptom of setting PYTHONHOME and/or PYTHONPATH when they’re not needed. In nearly all cases you don’t need to set either of them;

In the case of PYTHONHOME it’s almost always a mistake to set.

Solution 2


I solve this problem by unsetting PYTHONHOME or PYTHONPATH, because they override the virtual environment variables.

In my case this is caused by my admin’s base environment. I would try removing PYTHONHOME and PYTHONPATH variables by doing

unset PYTHONPATH
unset PYTHONHOME

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you? Thank You.

Also Read

Leave a Comment