Search code examples
pythondjangoenvironment-variablesvirtualenvuwsgi

uwsgi error - ModuleNotFoundError: No module named 'encodings'?


!!! no internal routing support, rebuild with pcre support !!!
uWSGI running as root, you can use --uid/--gid/--chroot options
setuid() to 1000
your processes number limit is 5568
your memory page size is 4096 bytes
detected max file descriptor number: 2560
lock engine: OSX spinlocks
thunder lock: disabled (you can enable it with --thunder-lock)
uWSGI http bound on 127.0.0.1:8000 fd 4
uwsgi socket 0 bound to TCP address 127.0.0.1:62444 (port auto-assigned) fd 3
Python version: 3.8.1 (v3.8.1:1b293b6006, Dec 18 2019, 14:08:53)  [Clang 6.0 (clang-600.0.57)]
!!! Python Home is not a directory: /Portenv !!!
Set PythonHome to /Portenv
Python path configuration:
  PYTHONHOME = '/Portenv'
  PYTHONPATH = (not set)
  program name = '/Portenv/bin/python'
  isolated = 0
  environment = 1
  user site = 1
  import site = 1
  sys._base_executable = '/Portenv/bin/python'
  sys.base_prefix = '/Portenv'
  sys.base_exec_prefix = '/Portenv'
  sys.executable = '/Portenv/bin/python'
  sys.prefix = '/Portenv'
  sys.exec_prefix = '/Portenv'
  sys.path = [
    '/Portenv/lib/python38.zip',
    '/Portenv/lib/python3.8',
    '/Portenv/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 0x00000001136aadc0 (most recent call first):
<no Python frame>

I have tried some other stack overflow answers but I'm very new to Django and some answers are too vauge I have a virtual env setup and the project is actually located inside the environment its the only way I could get it to work initially now im getting this error when I try to initialize uwsgi. Thanks in advance for any help anyone can offer


Solution

  • This issue has been addressed here in this thread. If you are running python setup as an administrator or have permanently set PYTHONHOME then this can cause the error.