Forums

Fatal Python error: Py_Initialize: Unable to get the locale encoding and ModuleNotFoundError

I haven't touched this site since I set it up and it stopped working yesterday. I'm not sure why it crashed all of a sudden. Can anyone help me?

This is the server log:

2022-12-02 01:44:39 *** Starting uWSGI 2.0.19.1 (64bit) on [Fri Dec  2 01:44:39 2022] ***
2022-12-02 01:44:39 compiled with version: 9.3.0 on 27 May 2021 21:02:35
2022-12-02 01:44:39 os: Linux-5.15.0-1017-aws #21~20.04.1 SMP Tue Aug 16 15:49:47 UTC 2022
2022-12-02 01:44:39 nodename: blue-liveweb2
2022-12-02 01:44:39 machine: x86_64
2022-12-02 01:44:39 clock source: unix
2022-12-02 01:44:39 pcre jit disabled
2022-12-02 01:44:39 detected number of CPU cores: 4
2022-12-02 01:44:39 current working directory: /home/vertfromage
2022-12-02 01:44:39 detected binary path: /usr/local/bin/uwsgi
2022-12-02 01:44:39 *** dumping internal routing table ***
2022-12-02 01:44:39 [rule: 0] subject: path_info regexp: \.svgz$ action: addheader:Content-Encoding:gzip
2022-12-02 01:44:39 *** end of the internal routing table ***
2022-12-02 01:44:39 chdir() to /home/vertfromage/
2022-12-02 01:44:39 your processes number limit is 512
2022-12-02 01:44:39 your memory page size is 4096 bytes
2022-12-02 01:44:39 detected max file descriptor number: 123456
2022-12-02 01:44:39 building mime-types dictionary from file /etc/mime.types...
2022-12-02 01:44:39 567 entry found
2022-12-02 01:44:39 lock engine: pthread robust mutexes
2022-12-02 01:44:39 thunder lock: disabled (you can enable it with --thunder-lock)
2022-12-02 01:44:39 uwsgi socket 0 bound to UNIX address /var/sockets/www.riversidealbertchurch.com/socket fd 3
2022-12-02 01:44:39 Python version: 3.6.13 (default, May 27 2021, 19:37:37)  [GCC 9.3.0]
2022-12-02 01:44:39 Set PythonHome to /home/vertfromage/.virtualenvs/flask-tutorial
2022-12-02 01:44:39 Fatal Python error: Py_Initialize: Unable to get the locale encoding
2022-12-02 01:44:39 ModuleNotFoundError
2022-12-02 01:44:39 : 
2022-12-02 01:44:39 No module named 'encodings'
2022-12-02 01:44:39 
2022-12-02 01:44:39 
2022-12-02 01:44:39 Current thread 0x
2022-12-02 01:44:39 00007f7975a3d780
2022-12-02 01:44:39  (most recent call first):
2022-12-02 01:44:39 !!! uWSGI process 1 got Segmentation Fault !!!
2022-12-02 01:44:39 *** backtrace of 1 ***#012/usr/local/bin/uwsgi(uwsgi_backtrace+0x2e) [0x55c6cc9ae90e]#012/usr/local/bin/uwsgi(uwsgi_segfault+0x27) [0x55c6cc9aecf7]#012/lib/x86_64-linux-gnu/libc.so.6(+0x46210) [0x7f7977956210]#012/lib/x86_64-linux-gnu/libc.so.6(abort+0x213) [0x7f7977935941]#012/usr/local/lib/libpython3.6m.so.1.0(Py_FatalError+0x99) [0x7f797580b719]#012/usr/local/lib/libpython3.6m.so.1.0(+0x184b24) [0x7f797580bb24]#012/usr/local/lib/libpython3.6m.so.1.0(_Py_InitializeEx_Private+0x238) [0x7f797580c428]#012/usr/lib/uwsgi/python36_plugin.so(uwsgi_python_init+0x144) [0x7f79759c1124]#012/usr/local/bin/uwsgi(uwsgi_start+0x5af) [0x55c6cc9aff6f]#012/usr/local/bin/uwsgi(uwsgi_setup+0x127c) [0x55c6cc9b221c]#012/usr/local/bin/uwsgi(main+0xf) [0x55c6cc95db3f]#012/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf3) [0x7f79779370b3]#012/usr/local/bin/uwsgi(_start+0x2e) [0x55c6cc95db7e]#012*** end of backtrace ***
2022-12-02 01:44:39 VACUUM: unix socket /var/sockets/www.riversidealbertchurch.com/socket removed.

We were recently decomissioning dangermouse system image, which you were using, and migrated all accounts from it to glastonbury one. You need to rebuild your web app's virtual env now.

Okay, thank you.

Fixed.

Glad to hear that!