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]> 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].
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.

Reply via email to