Issue
Initial Update: Through the last build LSWS 6.0.11 build 7 should address the issue, we received a few reports that it doesn't help to fix a problem. LiteSpeed developers are aware and working on the solution. We'll keep this article updated.
Last Update (04-14-2022): It is advised to install the latest debug version as described below which addresses some of the issues.
Last news (04-20-2022): LiteSpeed devs are planning to release LS build 8 that should address all Python 3 issues - we all are waiting for its announcement.
Python Web Application shows 503 error with the following records in the logs:
"Fatal Python error: Py_Initialize: Unable to get the locale encoding
ImportError: No module named 'encodings' "
May also show the following:
"Fatal Python error: Py_Initialize: Unable to get the locale encoding
ImportError: No module named 'django' "
Only python3 applications using virtualenv (v.20.13.0) on LiteSpeed Web Server are affected.
Environment
- CloudLinux 6/7/8
- LiteSpeed
- alt-python packages with alt-python-virtualenv-20.13.0
Cause
LiteSpeed bug. Changelog of 6.0.11 version:
LiteSpeed Web Server v6.0.11 Build 7 was made available last Friday.
This build includes various bug fixes.
[Bug Fix] Address broken alt-python application.
[Bug Fix] Address POST cache issues.
[Bug Fix] Block request header "transfer-encoding: chunked" for HTTP/2 and HTTP/3.
[Bug Fix] Address an SSI engine crash.
Solution
1. To get the bugfix, please update the LiteSpeed Web Server (to 6.0.11 version or higher if available, the command below will install the debug version for 6.0.11):
/usr/local/lsws/admin/misc/lsup.sh -d -f -v 6.0.11
2. The currently installed build number can also be checked with the following command:
cat /usr/local/lsws/BUILD
This should solve the issue with Python Applications with Python version 2.7 to 3.9, but not for Python 3.10 because LiteSpeed doesn't support Python 3.10 for now - see "Python LSAPI tab" https://www.litespeedtech.com/open-source/litespeed-sapi/lsapi-release-log
If you wish to use Python 3.10 for the application (alt-python310) in Python Selector, then the only way is to switch from LiteSpeed to Apache Web server + Passenger.
Also, please be sure that the CloudLinux server has the alt-pythonXX-wsgi-lsapi packages installed, which contain binaries needed by LiteSpeed.
Comments
0 comments
Please sign in to leave a comment.