Check your wsgi.load contents is correct. Ie., current output of running:
mod_wsgi-express module-config
for version installed in system Python 3.6.
Check that mods-enabled is symlink to it and not copy with wrong value.
The error indicates module wasn't loaded.
> On 14 Jun 2018, at 5:09 pm, 'Rajeev Jain' via modwsgi
> <[email protected]> wrote:
>
> did that and tried to restart the server. getting an error:
>
> sudo service apache2 restart
> Job for apache2.service failed because the control process exited with error
> code. See "systemctl status apache2.service" and "journalctl -xe" for details.
> rajeev@cubi-ubuntu:/var/www/FlaskApp/FlaskApp$ systemctl status
> apache2.service
> ● apache2.service - LSB: Apache2 web server
> Loaded: loaded (/etc/init.d/apache2; bad; vendor preset: enabled)
> Drop-In: /lib/systemd/system/apache2.service.d
> └─apache2-systemd.conf
> Active: failed (Result: exit-code) since Thu 2018-06-14 00:03:05 PDT; 8s
> ago
> Docs: man:systemd-sysv-generator(8)
> Process: 5405 ExecStop=/etc/init.d/apache2 stop (code=exited,
> status=0/SUCCESS)
> Process: 5531 ExecStart=/etc/init.d/apache2 start (code=exited,
> status=1/FAILURE)
>
> Jun 14 00:03:05 cubi-ubuntu apache2[5531]: * The apache2 configtest failed.
> Jun 14 00:03:05 cubi-ubuntu apache2[5531]: Output of config test was:
> Jun 14 00:03:05 cubi-ubuntu apache2[5531]: AH00526: Syntax error on line 5 of
> /etc/apache2/sites-enabled/FlaskApp.conf:
> Jun 14 00:03:05 cubi-ubuntu apache2[5531]: Invalid command
> 'WSGIDaemonProcess', perhaps misspelled or defined by a module not included
> in the server configuration
> Jun 14 00:03:05 cubi-ubuntu apache2[5531]: Action 'configtest' failed.
> Jun 14 00:03:05 cubi-ubuntu apache2[5531]: The Apache error log may have more
> information.
> Jun 14 00:03:05 cubi-ubuntu systemd[1]: apache2.service: Control process
> exited, code=exited status=1
> Jun 14 00:03:05 cubi-ubuntu systemd[1]: Failed to start LSB: Apache2 web
> server.
> Jun 14 00:03:05 cubi-ubuntu systemd[1]: apache2.service: Unit entered failed
> state.
> Jun 14 00:03:05 cubi-ubuntu systemd[1]: apache2.service: Failed with result
> 'exit-code’.
>
>
> /etc/apache2/sites-available$ cat FlaskApp.conf
> <VirtualHost *:83>
> ServerName flaskapp.com <http://flaskapp.com/>
>
> WSGIDaemonProcess flaskapp.com <http://flaskapp.com/> python-home=/usr
> WSGIScriptAlias / /var/www/FlaskApp/flaskapp.wsgi
> process-group=flaskapp.com <http://flaskapp.com/> application-group=%{GLOBAL}
>
> <Directory /var/www/FlaskApp/>
> <Files flaskapp.wsgi>
> Require all granted
> </Files>
> </Directory>
> </VirtualHost>
>
>
> Do you see anything wrong?
>
> —Rajeev
>
>
> On Jun 13, 2018, at 11:52 PM, Graham Dumpleton <[email protected]
> <mailto:[email protected]>> wrote:
>
> Do:
>
> pip uninstall mod_wsgi
>
> Repeat until says not installed.
>
> Then reinstall it.
>
> Run 'ldd' on the mod_wsgi .so file that is built to see what Python shared
> library it is finding.
>
> The installed version is possibly compiled against Anaconda Python somehow.
>
> Also do a complete Apache stop and start, rather than reload. There is also a
> chance the Anaconda Python library hasn't unloaded from Apache properly.
>
> Graham
>
>> On 14 Jun 2018, at 4:28 pm, Rajeev Jain <[email protected]
>> <mailto:[email protected]>> wrote:
>>
>> here is updated flask.wsgi
>>
>>
>> here is error.log
>> [Wed Jun 13 23:23:03.445837 2018] [wsgi:error] [pid 4758]
>> ModuleNotFoundError: No module named 'math'
>> [Wed Jun 13 23:23:15.854525 2018] [wsgi:error] [pid 4758] VERSION 3.6.5
>> |Anaconda, Inc.| (default, Apr 29 2018, 16:17:00)
>> [Wed Jun 13 23:23:15.854556 2018] [wsgi:error] [pid 4758] [GCC 7.2.0]
>> [Wed Jun 13 23:23:15.854563 2018] [wsgi:error] [pid 4758]
>> [Wed Jun 13 23:23:15.854581 2018] [wsgi:error] [pid 4758] PREFIX /usr
>> [Wed Jun 13 23:23:15.854599 2018] [wsgi:error] [pid 4758] PATH
>> ['/var/www/FlaskApp/', '/var/www/FlaskApp/', '/var/www/FlaskApp',
>> '/usr/lib/python36.zip', '/usr/lib/python3.6',
>> '/usr/lib/python3.6/lib-dynload', '/usr/local/lib/python3.6/dist-packages',
>> '/usr/lib/python3/dist-packages']
>> [Wed Jun 13 23:23:15.856916 2018] [wsgi:error] [pid 4758] [remote
>> 127.0.0.1:57696] mod_wsgi (pid=4758): Failed to exec Python script file
>> '/var/www/FlaskApp/flaskapp.wsgi'.
>> [Wed Jun 13 23:23:15.856949 2018] [wsgi:error] [pid 4758] [remote
>> 127.0.0.1:57696] mod_wsgi (pid=4758): Exception occurred processing WSGI
>> script '/var/www/FlaskApp/flaskapp.wsgi'.
>> [Wed Jun 13 23:23:15.857057 2018] [wsgi:error] [pid 4758] [remote
>> 127.0.0.1:57696] Traceback (most recent call last):
>> [Wed Jun 13 23:23:15.857091 2018] [wsgi:error] [pid 4758] [remote
>> 127.0.0.1:57696] File "/var/www/FlaskApp/flaskapp.wsgi", line 11, in
>> <module>
>> [Wed Jun 13 23:23:15.857095 2018] [wsgi:error] [pid 4758] [remote
>> 127.0.0.1:57696] from FlaskApp import app as application
>> [Wed Jun 13 23:23:15.857100 2018] [wsgi:error] [pid 4758] [remote
>> 127.0.0.1:57696] File "/var/www/FlaskApp/FlaskApp/__init__.py", line 2, in
>> <module>
>> [Wed Jun 13 23:23:15.857103 2018] [wsgi:error] [pid 4758] [remote
>> 127.0.0.1:57696] from flask import Flask
>> [Wed Jun 13 23:23:15.857108 2018] [wsgi:error] [pid 4758] [remote
>> 127.0.0.1:57696] File
>> "/usr/local/lib/python3.6/dist-packages/flask/__init__.py", line 17, in
>> <module>
>> [Wed Jun 13 23:23:15.857110 2018] [wsgi:error] [pid 4758] [remote
>> 127.0.0.1:57696] from werkzeug.exceptions import abort
>> [Wed Jun 13 23:23:15.857115 2018] [wsgi:error] [pid 4758] [remote
>> 127.0.0.1:57696] File
>> "/usr/local/lib/python3.6/dist-packages/werkzeug/__init__.py", line 151, in
>> <module>
>> [Wed Jun 13 23:23:15.857117 2018] [wsgi:error] [pid 4758] [remote
>> 127.0.0.1:57696] __import__('werkzeug.exceptions')
>> [Wed Jun 13 23:23:15.857122 2018] [wsgi:error] [pid 4758] [remote
>> 127.0.0.1:57696] File
>> "/usr/local/lib/python3.6/dist-packages/werkzeug/exceptions.py", line 67, in
>> <module>
>> [Wed Jun 13 23:23:15.857124 2018] [wsgi:error] [pid 4758] [remote
>> 127.0.0.1:57696] from werkzeug._internal import _get_environ
>> [Wed Jun 13 23:23:15.857129 2018] [wsgi:error] [pid 4758] [remote
>> 127.0.0.1:57696] File
>> "/usr/local/lib/python3.6/dist-packages/werkzeug/_internal.py", line 15, in
>> <module>
>> [Wed Jun 13 23:23:15.857131 2018] [wsgi:error] [pid 4758] [remote
>> 127.0.0.1:57696] from datetime import datetime, date
>> [Wed Jun 13 23:23:15.857135 2018] [wsgi:error] [pid 4758] [remote
>> 127.0.0.1:57696] File "/usr/lib/python3.6/datetime.py", line 8, in <module>
>> [Wed Jun 13 23:23:15.857138 2018] [wsgi:error] [pid 4758] [remote
>> 127.0.0.1:57696] import math as _math
>> [Wed Jun 13 23:23:15.857150 2018] [wsgi:error] [pid 4758] [remote
>> 127.0.0.1:57696] ModuleNotFoundError: No module named 'math'
>> [Wed Jun 13 23:23:30.077689 2018] [wsgi:error] [pid 4758] VERSION 3.6.5
>> |Anaconda, Inc.| (default, Apr 29 2018, 16:17:00)
>> [Wed Jun 13 23:23:30.077714 2018] [wsgi:error] [pid 4758] [GCC 7.2.0]
>> [Wed Jun 13 23:23:30.077720 2018] [wsgi:error] [pid 4758]
>> [Wed Jun 13 23:23:30.077729 2018] [wsgi:error] [pid 4758] PREFIX /usr
>> [Wed Jun 13 23:23:30.077745 2018] [wsgi:error] [pid 4758] PATH
>> ['/var/www/FlaskApp/', '/var/www/FlaskApp/', '/var/www/FlaskApp/',
>> '/var/www/FlaskApp', '/usr/lib/python36.zip', '/usr/lib/python3.6',
>> '/usr/lib/python3.6/lib-dynload', '/usr/local/lib/python3.6/dist-packages',
>> '/usr/lib/python3/dist-packages']
>> [Wed Jun 13 23:23:30.080656 2018] [wsgi:error] [pid 4758] [remote
>> 127.0.0.1:57698] mod_wsgi (pid=4758): Failed to exec Python script file
>> '/var/www/FlaskApp/flaskapp.wsgi'.
>> [Wed Jun 13 23:23:30.080701 2018] [wsgi:error] [pid 4758] [remote
>> 127.0.0.1:57698] mod_wsgi (pid=4758): Exception occurred processing WSGI
>> script '/var/www/FlaskApp/flaskapp.wsgi'.
>> [Wed Jun 13 23:23:30.080846 2018] [wsgi:error] [pid 4758] [remote
>> 127.0.0.1:57698] Traceback (most recent call last):
>> [Wed Jun 13 23:23:30.080893 2018] [wsgi:error] [pid 4758] [remote
>> 127.0.0.1:57698] File "/var/www/FlaskApp/flaskapp.wsgi", line 11, in
>> <module>
>> [Wed Jun 13 23:23:30.080907 2018] [wsgi:error] [pid 4758] [remote
>> 127.0.0.1:57698] from FlaskApp import app as application
>> [Wed Jun 13 23:23:30.080916 2018] [wsgi:error] [pid 4758] [remote
>> 127.0.0.1:57698] File "/var/www/FlaskApp/FlaskApp/__init__.py", line 2, in
>> <module>
>> [Wed Jun 13 23:23:30.080921 2018] [wsgi:error] [pid 4758] [remote
>> 127.0.0.1:57698] from flask import Flask
>> [Wed Jun 13 23:23:30.080927 2018] [wsgi:error] [pid 4758] [remote
>> 127.0.0.1:57698] File
>> "/usr/local/lib/python3.6/dist-packages/flask/__init__.py", line 17, in
>> <module>
>> [Wed Jun 13 23:23:30.080931 2018] [wsgi:error] [pid 4758] [remote
>> 127.0.0.1:57698] from werkzeug.exceptions import abort
>> [Wed Jun 13 23:23:30.080937 2018] [wsgi:error] [pid 4758] [remote
>> 127.0.0.1:57698] File
>> "/usr/local/lib/python3.6/dist-packages/werkzeug/__init__.py", line 151, in
>> <module>
>> [Wed Jun 13 23:23:30.080941 2018] [wsgi:error] [pid 4758] [remote
>> 127.0.0.1:57698] __import__('werkzeug.exceptions')
>> [Wed Jun 13 23:23:30.080947 2018] [wsgi:error] [pid 4758] [remote
>> 127.0.0.1:57698] File
>> "/usr/local/lib/python3.6/dist-packages/werkzeug/exceptions.py", line 67, in
>> <module>
>> [Wed Jun 13 23:23:30.080951 2018] [wsgi:error] [pid 4758] [remote
>> 127.0.0.1:57698] from werkzeug._internal import _get_environ
>> [Wed Jun 13 23:23:30.080957 2018] [wsgi:error] [pid 4758] [remote
>> 127.0.0.1:57698] File
>> "/usr/local/lib/python3.6/dist-packages/werkzeug/_internal.py", line 15, in
>> <module>
>> [Wed Jun 13 23:23:30.080961 2018] [wsgi:error] [pid 4758] [remote
>> 127.0.0.1:57698] from datetime import datetime, date
>> [Wed Jun 13 23:23:30.080967 2018] [wsgi:error] [pid 4758] [remote
>> 127.0.0.1:57698] File "/usr/lib/python3.6/datetime.py", line 8, in <module>
>> [Wed Jun 13 23:23:30.080971 2018] [wsgi:error] [pid 4758] [remote
>> 127.0.0.1:57698] import math as _math
>> [Wed Jun 13 23:23:30.080988 2018] [wsgi:error] [pid 4758] [remote
>> 127.0.0.1:57698] ModuleNotFoundError: No module named 'math'
>>
>> How is Anaconda being picked up?
>>
>> Can we check PATH setting for Apache boot ?
>>
>>
>> On Jun 13, 2018, at 11:17 PM, Graham Dumpleton <[email protected]
>> <mailto:[email protected]>> wrote:
>>
>> print('VERSION', sys.version)
>> print('PREFIX', sys.prefix)
>> print('PATH', sys.path)
>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "modwsgi" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected]
>> <mailto:[email protected]>.
>> To post to this group, send email to [email protected]
>> <mailto:[email protected]>.
>> Visit this group at https://groups.google.com/group/modwsgi
>> <https://groups.google.com/group/modwsgi>.
>> For more options, visit https://groups.google.com/d/optout
>> <https://groups.google.com/d/optout>.
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "modwsgi" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected]
> <mailto:[email protected]>.
> To post to this group, send email to [email protected]
> <mailto:[email protected]>.
> Visit this group at https://groups.google.com/group/modwsgi
> <https://groups.google.com/group/modwsgi>.
> For more options, visit https://groups.google.com/d/optout
> <https://groups.google.com/d/optout>.
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "modwsgi" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected]
> <mailto:[email protected]>.
> To post to this group, send email to [email protected]
> <mailto:[email protected]>.
> Visit this group at https://groups.google.com/group/modwsgi
> <https://groups.google.com/group/modwsgi>.
> For more options, visit https://groups.google.com/d/optout
> <https://groups.google.com/d/optout>.
--
You received this message because you are subscribed to the Google Groups
"modwsgi" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/modwsgi.
For more options, visit https://groups.google.com/d/optout.