✓ Solved

<no python frame> error while trying to connect to apache on mod_wsgi in Ubuntu

my conf file:

 Alias /static /home/dvlpr69/pokomowiki/staticfiles
        <Directory /home/dvlpr69/pokomowiki/staticfiles>
                Require all granted
        </Directory>

        <Directory /home/dvlpr69/pokomowiki/pokowiki>
                <Files wsgi.py>
                        Require all granted
                </Files>
        </Directory>

        WSGIScriptAlias / /home/dvlpr69/pokomowiki/pokowiki/wsgi.py process-group=pokomowiki.co.ke
WSGIDaemonProcess pokomowiki.co.ke python-home=/home/dvlpr69/pokomowiki/venv python-path=/home/dvlpr69/pokomowiki
WSGIProcessGroup pokomowiki.co.ke

</VirtualHost>

error logs:

[Fri Jun 24 08:48:22.078909 2022] [wsgi:warn] [pid 75310:tid 140554363750272] (13)Permission denied: mod_wsgi (pid=75310): Unable to stat Python home /home/dvlpr69/pokomowiki/venv. Python interpreter may not be able to be initialized correctly. Verify the supplied path and access permissions for whole of the path.
Python path configuration:
  PYTHONHOME = '/home/dvlpr69/pokomowiki/venv'
  PYTHONPATH = (not set)
  program name = 'python3'
  isolated = 0
  environment = 1
  user site = 1
  import site = 1
  sys._base_executable = '/usr/bin/python3'
  sys.base_prefix = '/home/dvlpr69/pokomowiki/venv'
  sys.base_exec_prefix = '/home/dvlpr69/pokomowiki/venv'
  sys.platlibdir = 'lib'
  sys.executable = '/usr/bin/python3'
  sys.prefix = '/home/dvlpr69/pokomowiki/venv'
  sys.exec_prefix = '/home/dvlpr69/pokomowiki/venv'
  sys.path = [
    '/home/dvlpr69/pokomowiki/venv/lib/python39.zip',
    '/home/dvlpr69/pokomowiki/venv/lib/python3.9',
    '/home/dvlpr69/pokomowiki/venv/lib/python3.9/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 0x00007fd55cec4780 (most recent call first):
<no Python frame>

How do I fix this error?

2 Replies

✓ Best Answer

Just fixed, this was a permission issue denying apache access to my project directory.

sudo chmod 755 /home/<user>
ModuleNotFoundError: No module named 'encodings'

Install the module named 'encodings'? I haven't the faintest idea how to do that…

-- sw

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct