0

I tried to install pygame with the command pip install pygame and there is an error message:

Fatal Python error: initfsencoding: unable to load the file system codec

ModuleNotFoundError: No module named 'encodings'

Current thread 0x000019c8 (most recent call first):

The Thonnu
  • 3,578
  • 2
  • 8
  • 30
442
  • 1
  • 1

2 Answers2

0

This is a known issue with the pygame installer. Try uninstalling and reinstalling pygame using the following commands:

pip uninstall pygame
pip install pygame
Mohamed Elgazar
  • 778
  • 4
  • 9
-1

Try running pip install wheel, pip install encoding, and then pip install pygame

Alternatively, check your environment variables to make sure your modules are findable Fatal Python error on Windows 10 ModuleNotFoundError: No module named 'encodings'

  • it doesn't even work and I have version 3.10.8 of python – 442 Oct 14 '22 at 17:52
  • https://stackoverflow.com/questions/67956888/doesnt-python-3-10-support-pygame looks like it may be a compatability issue, if your env variables look good – Nicholas Hansen-Feruch Oct 14 '22 at 17:59
  • `pip install encoding` and `pip install encodings` cannot work; 1st, there are no such packages at PyPI: https://pypi.org/project/encoding/ and https://pypi.org/project/encodings/ — error 404; 2nd, it's a package from the standard library: https://github.com/python/cpython/tree/main/Lib/encodings – phd Oct 14 '22 at 22:20