Thursday, October 6, 2022

[SOLVED] Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding, when trying to install packages on venv

Issue

I created a virtual environment through python -m venv env in python and tried to install packages with pip on it. I've got this error:

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'

I'm using Windows, does it has something to do with the environment variables? (PYTHONPATH, PYTHONHOME)


Solution

Turns out that you have to reinstall python and check Add Python to environmental variables in Advanced Options.



Answered By - SushiWaUmai
Answer Checked By - Katrina (WPSolving Volunteer)