Describe the issue
The console logs say that module 'phply' is not not found.
On the web server side side there is a bunch of error logs saying no module named 'django'. My setup is a wsgi.py file in /var/www/html to avoid possible permission issues as I've read that parent directories should be accessible as well. The errors continue further like "wsgi.py cannot be loaded as Python module" and so on.
I've wasted 20+ hours with a bunch of critical bugs of Weblate that "were fixed" (like the examples/ indicating that python-path be used instead of python-home which made me add up lot of more hours of googling). I'm now having the error no module named django in Apache. When I visit the website it returns a 500 Internal Server Error.
I already tried
I have already searched the docs and many of the information, not to sound rude, misinformation. I've had to Google many things that the documentation didn't detail.
To Reproduce
Steps to reproduce the behavior:
/home/weblate-env where Weblate is installed. bin subdirectory.source activate.Expected behavior
I should be able to access Weblate website normally.
Server configuration and status
Weblate deploy checks
SystemCheckError: System check identified some issues:
at: No module named 'phply'
HINT: https://docs.weblate.org/en/weblate-4.3.2/admin/install.html
#optional-deps
?: (weblate.W025.php) Failure in loading handler for php file format: No m
odule named 'phply'
HINT: https://docs.weblate.org/en/weblate-4.3.2/admin/install.html
#optional-deps
?: (weblate.W025.srt) Failure in loading handler for srt file format: aeid
on or gaupol package required for Subtitle support
HINT: https://docs.weblate.org/en/weblate-4.3.2/admin/install.html
#optional-deps
?: (weblate.W025.ssa) Failure in loading handler for ssa file format: aeid
on or gaupol package required for Subtitle support
HINT: https://docs.weblate.org/en/weblate-4.3.2/admin/install.html
#optional-deps
?: (weblate.W025.sub) Failure in loading handler for sub file format: aeid
on or gaupol package required for Subtitle support
HINT: https://docs.weblate.org/en/weblate-4.3.2/admin/install.html
#optional-deps
?: (weblate.W033.Gerrit) Failure in loading VCS module for Gerrit: git: 'r
eview' is not a git command. See 'git --help'.
(1)
HINT: https://docs.weblate.org/en/weblate-4.3.2/vcs.html
?: (weblate.W033.Mercurial) Failure in loading VCS module for Mercurial: [
Errno 2] No such file or directory: 'hg': 'hg'
HINT: https://docs.weblate.org/en/weblate-4.3.2/vcs.html
?: (weblate.W033.Subversion) Failure in loading VCS module for Subversion:
git: 'svn' is not a git command. See 'git --help'.
The most similar commands are
fsck
mv
show
(1)
HINT: https://docs.weblate.org/en/weblate-4.3.2/vcs.html
INFOS:
?: (weblate.I021) Error collection is not set up, it is highly recommended
for production use
HINT: https://docs.weblate.org/en/weblate-4.3.2/admin/install.html
#collecting-errors
?: (weblate.I028) Backups are not configured, it is highly recommended for
production use
HINT: https://docs.weblate.org/en/weblate-4.3.2/admin/backup.html
System check identified 19 issues (1 silenced).
Exception traceback
Additional context
Ubuntu 18.04.4 LTS (GNU/Linux 4.15.0-123-generic x86_64)
This issue looks more like a support question than an issue. We strive to answer these reasonably fast, but purchasing the support subscription is not only more responsible and faster for your business but also makes Weblate stronger. In case your question is already answered, making a donation is the right way to say thank you!
The errors are module phply not found, and so on.
Please read the docs on the optional deps, it's linked from the warning: https://docs.weblate.org/en/weblate-4.3.2/admin/install.html#optional-deps
On the Apache side there is a bunch of erorr logs saying "no module named 'django'"
Most likely Apache mod_wsgi is not configured to use virtualenv. Check python-home setting there, see https://docs.weblate.org/en/latest/admin/install.html#apache
Thank you, the warning can be ignored then. but I can confirm that python-path is set. python-home errors a wsgi not found error, which would be further behind the error I am reporting if I'm not wrong.
These configure different things, check mod_wsgi docs for more info. In case you are using virtualenv, you need to set python-home to point to it. If that leads to other errors, these have to be fixed and not hiding them by not using it...
I've tried a few times with virtualenv and it still errored, but as you say we can't ignore other errors. The error that i get with and withot virtualenv is now:
Sun Nov 22 14: 19: 12.314821 2020] [wsgi: error] [pid 22375] (13) Permission denied: [remote 186.106.169.35:62999] mod_wsgi (pid = 22375, process = 'weblate', application = '') : Call to fopen () failed for '/var/www/html/wsgi.py'.
After granting permissions I took off, the error log is back to:
[Sun Nov 22 14:27:36.531823 2020] [wsgi:error] [pid 22375] [remote X:63190] mod_wsgi (pid=22375): Exception occurred processing WSGI script '/var/www/html/wsgi.py'.
[Sun Nov 22 14:27:36.538946 2020] [wsgi:error] [pid 22375] [remote X:63190] Traceback (most recent call last):
[Sun Nov 22 14:27:36.538974 2020] [wsgi:error] [pid 22375] [remote X:63190] File "/var/www/html/wsgi.py", line 35, in <module>
[Sun Nov 22 14:27:36.538977 2020] [wsgi:error] [pid 22375] [remote X:63190] from django.core.wsgi import get_wsgi_application
[Sun Nov 22 14:27:36.539011 2020] [wsgi:error] [pid 22375] [remote X:63190] ModuleNotFoundError: No module named 'django'
/var/www/html/wsgi.py
Seems wrong, it should be weblate/wsgi.py. Copying single file out of installation will not make it magically work.
No module named 'django'
It still is not using the virtualenv where all the dependencies are installed.
Please start from the example configuration and adjust paths and Python version there.
In case you cannot configure Apache to run wsgi, install Weblate using Docker way fewer things can go wrong there...
I moved the wsgi.py file back to the virtualenv. Now I'm getting a 403 forbidden error, and the same I started with, added to these logs:
Tue Nov 24 03:09:44.787367 2020] [core:error] [pid 30947] (13)Permission denied: [client X:60557] AH00035: access to / denied (filesystem path '/root/weblate-env') because search permissions are missing on a component of the path
The issue you have reported is resolved now. If you don鈥檛 feel it鈥檚 right, please follow it鈥檚 labels to get a clue and take further steps.
@nijel I am thinking of opening a separate issue for the permission error. Should I or can we continue here?
Installing things in /root/ which can be only opened by the root user is usually bad idea. Create separate user for that or install things elsewhere (for example /opt/weblate).
@nijel I have done everything you said. I am back to the same scheme, I've fixed the 403 Forbidden error, and now we are back to the same 500 Internal Server Error in the new directory. "No module named django" is the error that I'm getting. I've given permissions to Apache, chmod'ed, changed from /root to /var, from /var to /home now.
The error tells that Python interpreter in wsgi can not find django module. As you've installed it in a virtual env, something in the configuration is broken. Do you have set python-home=/home/weblate-env?
@nijel I set again python-home, the error is the same:
[Tue Dec 01 15:21:26.944408 2020] [wsgi:error] [pid 30882] [remote X:62220] ModuleNotFoundError: No module named 'django'
[Tue Dec 01 15:21:27.420578 2020] [authz_core:error] [pid 30883] [client X:62221] AH01630: client denied by server configuration: /home/weblate-env/data, referer: http://198.50.157.155:8001/
The virtual host:
<VirtualHost *:8001>
ServerAdmin [email protected]
ServerName [email protected]
Alias /favicon.ico /home/weblate-env/data/static/favicon.ico
Alias /static/ /home/weblate-env/lib/python3.6/site-packages/data/static/
<Directory /home/weblate-env/lib/python3.6/site-packages/data/static/>
Require all granted
</Directory>
Alias /media/ /home/weblate-env/lib/python3.6/site-packages/data/media/
<Directory /home/weblate-env/lib/python3.6/site-packages/data/media/>
Require all granted
</Directory>
WSGIDaemonProcess www-data python-path=/home/weblate-env/lib/python3.6 python-home=/home/weblate-env
WSGIProcessGroup www-data
WSGIApplicationGroup %{GLOBAL}
WSGIScriptAlias / /home/weblate-env/bin/wsgi.py
WSGIPassAuthorization On
<Directory /home/weblate-env/bin>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
</VirtualHost>
Are you using wsgi built with same python version as you virtual environment? Most distributions have separate package for the Python 3 version...
Are you using wsgi built with same python version as you virtual environment? Most distributions have separate package for the Python 3 version...
@nijel I am using Python 2.7.17 CLI version and Python 3.6 in the virtual environment.
I'm tasking about wsgi module, it has to be Python 3 version as well.
I have confirmed to have an older version of Python 2.4 successfully uninstalled 2.4 and installed Python 3.6 after doing a symlink from /usr/bin/python3.6 to /usr/bin/python. After doing that, my config files WSGI* entries started working again. Now, I'm stuck with a syntax error on the apache2.conf which is not really on this file, as it includes all the modules. One of the modules is Python, and that module has anither include, the mod_wsgi.so which is not in my system. I am clueless of what to do now with this missing file because I could only get it to work installing default Python 2.4.
The Python 3 version of wsgi is usually in a separate package. For example, in Debian it's libapache2-mod-wsgi-py3.
@nijel I got this to work.
manage.py is again outdated in all guides. You use django-admin.pyinstead. Even if you create your own django-admin.py file in the bin/ venv folder, it will permanently throw the "environment variable not set" error.
You have to set DJANGO_SETTINGS_MODULE and PYTHONPATH path set. First, I had to set PYTHONPATH to /home/weblate-env/lib/python3.6/site-packages, and DJANGO_SETTINGS MODULE to weblate.settings.
After fixing that, a new error brought with MySQL:
#1071 - Specified key was too long; max key length is 767 bytes
I had to go to /etc/mysql/mariadb.cnf and set encoding of databases (actually tables) to UTF8 adding those lines:
character-set-server = utf8
collation-server = utf8_general_ci
After doing migration again, with python-admin.py in /home/weblate/bin, tables already existed.
I had to delete the whole database and recreate it. After doing so, this command stopped failing.
I was then stuck in a 404 Not Found error.
To fix it I had to navigate to :8081/weblate instead of :8081
I then saw that CSS didn't load.
My Apache Alias directive was mapping /static/ when it had to be /weblate/static/ as I was accessing Weblate from /weblate.
Question: how do you set Weblate to be accessed rather in /?
manage.py is again outdated in all guides. You use django-admin.pyinstead. Even if you create your own django-admin.py file in the bin/ venv folder, it will permanently throw the "environment variable not set" error.
Maybe it would be easier to follow the installation docs: https://docs.weblate.org/en/latest/admin/install/venv-debian.html#configuring-weblate
The file is present in the repo: https://github.com/WeblateOrg/weblate/blob/master/manage.py and is installed as weblate when installing Weblate. See https://docs.weblate.org/en/latest/admin/management.html
1071 - Specified key was too long; max key length is 767 bytes
Your setup will break once somebody types emojis or other higher Unicode plan chars, see https://docs.weblate.org/en/latest/admin/install.html#mysql-and-mariadb for proper setup.
After doing migration again, with python-admin.py in /home/weblate/bin, tables already existed.
I have no clue what you did, but it seems that you've truncated the tables at some point - the tables were there, but no content (where Django stores what migrations have been applied).
Question: how do you set Weblate to be accessed rather in /?
The easiest approach is usually to read the documentation. We have examples for both setups:
I didn't type any emojis. I just followed the fix of enabling UTF-8 and it worked. The error hapenned suddenly during installation.
Thanks
The issue you have reported is resolved now. If you don鈥檛 feel it鈥檚 right, please follow it鈥檚 labels to get a clue and take further steps.