To be clear, I'll create a virtual environment and use standard python3.6 
distribution (i.e. non anaconda). I'll follow the suggestions you have laid 
out here...

On Wednesday, June 13, 2018 at 6:50:48 PM UTC-7, Graham Dumpleton wrote:
>
> Using a virtual environment will not help if you intend to still use 
> Anaconda Python. You will still have the issue with the SSL libraries.
>
> Are you thinking that a virtual environment will somehow solve the problem?
>
> On 14 Jun 2018, at 11:34 am, Rajeev Jain <[email protected] <javascript:>> 
> wrote:
>
> I want to thank you for the time you spent with me. It is clear, using 
> Anaconda with Apache is not a good idea. My objective now is to setup a 
> virtual environment, and then configure a Apache virtual host to use it. 
> There is a multitude of half complete solutions out there to accomplish 
> this. Would you be kind enough to point me to from your perspective the 
> best guide for this objective? I want to make sure the essential parameters 
> are correctly set.
>
> Any examples for the following files would very helpful:
>
> - wsgi.conf
>
>
> Would stay the same.
>
> - wsgi.load
>
>
> Would still be output of mod_wsgi-express module-config.
>
> The difference would be that you would pip install mod_wsgi into the 
> virtual environment first and run mod_wsgi-express module-config from there 
> so loading module from correct place.
>
> - myhost.conf
>
>
> Only difference here would be what python-home is set to.
>
> Should be value of sys.prefix for the virtual environment.
>
> Details in:
>
> * 
> http://modwsgi.readthedocs.io/en/develop/user-guides/virtual-environments.html
>
> Note I missed one thing in the config.
>
> You also likely needed python-path option to WSGIDaemonProcess as well. 
> Probably:
>
>     python-path=/var/www/FlaskApp
>
> This is in addition to python-home.
>
> The python-path says where your project code is.
>
> If you use mod_wsgi-express as standalone server behind front end Apache 
> proxy, then it will pretty well worry about this stuff for you. Just run it 
> in the right directory and additional tell it where your static files 
> should be mounted.
>
>
> I guess at this point wsgi.conf should contain nothing, wsgi.load would 
> load the appropriate mod_wsgi. Most of the magic will be in the 
> virtualhost.conf file, yes?  
>
> I believe this to be a good path for getting this to work.
>
> thank-you again.
> --Rajeev
>
>
> On Wednesday, June 13, 2018 at 6:15:50 PM UTC-7, Graham Dumpleton wrote:
>>
>>
>>
>> On 14 Jun 2018, at 11:04 am, Rajeev Jain <[email protected]> wrote:
>>
>> Here is a more complete error log:
>>
>> [Wed Jun 13 17:55:33.173679 2018] [mpm_prefork:notice] [pid 2174] 
>> AH00169: caught SIGTERM, shutting down
>> [Wed Jun 13 17:55:34.421101 2018] [mpm_prefork:notice] [pid 2501] 
>> AH00163: Apache/2.4.18 (Ubuntu) mod_wsgi/4.6.4 Python/3.6 configured -- 
>> resuming normal operations
>> [Wed Jun 13 17:55:34.421158 2018] [core:notice] [pid 2501] AH00094: 
>> Command line: '/usr/sbin/apache2'
>> [Wed Jun 13 17:55:34.576866 2018] [wsgi:error] [pid 2504] mod_wsgi 
>> (pid=2504): Failed to exec Python script file 
>> '/var/www/FlaskApp/flaskapp.wsgi'.
>> [Wed Jun 13 17:55:34.576923 2018] [wsgi:error] [pid 2504] mod_wsgi 
>> (pid=2504): Exception occurred processing WSGI script 
>> '/var/www/FlaskApp/flaskapp.wsgi'.
>> [Wed Jun 13 17:55:34.578129 2018] [wsgi:error] [pid 2504] Traceback (most 
>> recent call last):
>> [Wed Jun 13 17:55:34.578169 2018] [wsgi:error] [pid 2504]   File 
>> "/var/www/FlaskApp/flaskapp.wsgi", line 7, in <module>
>> [Wed Jun 13 17:55:34.578182 2018] [wsgi:error] [pid 2504]     from 
>> FlaskApp import app as application
>> [Wed Jun 13 17:55:34.578189 2018] [wsgi:error] [pid 2504]   File 
>> "/var/www/FlaskApp/FlaskApp/__init__.py", line 2, in <module>
>> [Wed Jun 13 17:55:34.578192 2018] [wsgi:error] [pid 2504]     from flask 
>> import Flask
>> [Wed Jun 13 17:55:34.578197 2018] [wsgi:error] [pid 2504]   File 
>> "/home/rajeev/anaconda3/lib/python3.6/site-packages/flask/__init__.py", 
>> line 21, in <module>
>> [Wed Jun 13 17:55:34.578200 2018] [wsgi:error] [pid 2504]     from .app 
>> import Flask, Request, Response
>> [Wed Jun 13 17:55:34.578205 2018] [wsgi:error] [pid 2504]   File 
>> "/home/rajeev/anaconda3/lib/python3.6/site-packages/flask/app.py", line 25, 
>> in <module>
>> [Wed Jun 13 17:55:34.578207 2018] [wsgi:error] [pid 2504]     from . 
>> import cli, json
>> [Wed Jun 13 17:55:34.578212 2018] [wsgi:error] [pid 2504]   File 
>> "/home/rajeev/anaconda3/lib/python3.6/site-packages/flask/cli.py", line 18, 
>> in <module>
>> [Wed Jun 13 17:55:34.578218 2018] [wsgi:error] [pid 2504]     import ssl
>> [Wed Jun 13 17:55:34.578223 2018] [wsgi:error] [pid 2504]   File 
>> "/home/rajeev/anaconda3/lib/python3.6/ssl.py", line 101, in <module>
>> [Wed Jun 13 17:55:34.578225 2018] [wsgi:error] [pid 2504]     import _ssl
>>              # if we can't import it, let the error propagate
>> [Wed Jun 13 17:55:34.578243 2018] [wsgi:error] [pid 2504] ImportError: 
>> /home/rajeev/anaconda3/lib/python3.6/lib-dynload/_
>> ssl.cpython-36m-x86_64-linux-gnu.so: undefined symbol: SSLv2_method
>>
>>
>> As a side note, I have 2 other php virtualhosts running on the same 
>> ubuntu box and pages are being served correctly.
>>
>>
>> Those PHP sites are likely going to be the issue then as the PHP modules 
>> are likely pulling in the SSL libraries. It could also be the LDAP related 
>> modules, but more likely the PHP modules.
>>
>> What Anaconda Python does with supplying its own SSL libraries, as well 
>> as other replacements for system libraries is a right pain and is going to 
>> break any system where Python is being embedded in another process, such as 
>> is the case with mod_wsgi and Apache. So isn't just the SSL libraries. 
>> Because PHP can pull in image libraries, that can conflict with those in 
>> Anaconda Python if using image manipulation packages like Pillow (PIL).
>>
>> If you have the existing PHP sites I don't really see a solution besides 
>> running mod_wsgi-express to create a separate Apache/mod_wsgi instance and 
>> then proxy that behind the main Apache.
>>
>> Some links which talk about mod_wsgi-express and running it like this are 
>> below. Note that when using mod_wsgi-express it will automatically 
>> configure the separate Apache instance for you, so it isn't as bad as it 
>> may seem.
>>
>> Introduction in:
>>
>> * http://blog.dscpl.com.au/2015/04/introducing-modwsgi-express.html
>>
>> Details on having it behind a proxy. Ignore that it talks about Docker, 
>> is still relevant.
>>
>> * 
>> http://blog.dscpl.com.au/2015/06/proxying-to-python-web-application.html
>> * 
>> http://blog.dscpl.com.au/2015/07/redirection-problems-when-proxying-to.html
>>
>> Pre-create config so easier to integrate with system startup scripts.
>>
>> * 
>> https://github.com/GrahamDumpleton/mod_wsgi#running-mod_wsgi-express-as-root
>>
>> Ignore that mentions root. You would need to run it on port other than 80 
>> and so doesn't need to run as root.
>>
>> So sorry, don't have a simple solution if you want to run with Anaconda 
>> Python because of what Anaconda Python does with supplying its own 
>> libraries which conflict with system libraries.
>>
>> Graham
>>
>
> -- 
> 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] <javascript:>.
> To post to this group, send email to [email protected] <javascript:>
> .
> Visit this group at https://groups.google.com/group/modwsgi.
> For more options, visit 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