Hi Graham

Thanks a lot for your response and you times

I added the directive WSGIApplicationGroup %{GLOBAL} and the problem was
solved

Please let me add complementary information that I got during this 2 days

The problem was not only on windows but also on linux

About your question, i have checked and it's possible to import numpy twice
in the main interpreter without error

During this time i also posted the question on stack overflow (
https://stackoverflow.com/questions/54537814/import-conflict-when-running-flask-app-with-apache-mod-wsgi-on-windows
)

And with you permission i would like to post your response as a solution of
this topic

Kinds regards and thanks again

Alx



Le mar. 5 févr. 2019 à 22:28, Graham Dumpleton <[email protected]>
a écrit :

> When using multiple WSGIScriptAlias directives, the applications should
> already be running in different sub interpreter contexts.
>
> If you are getting an error like you see, you might also be setting:
>
>      WSGIApplicationGroup %{GLOBAL}
>
> to override that behaviour, or you are just hitting one of the various
> ways that numpy is broken when used in sub interpreters.
>
> Unfortunately, removing that isn't really a solution if set, because numpy
> usually will not work in sub interpreters, and needs to be used in the main
> interpreter context, which is what that WSGIApplicationGroup directive
> forces.
>
> In short, if you want to run two isolated WSGI applications which both use
> numpy, on Windows you can't do it because of the problems with running
> numpy in sub interpreters.
>
> FWIW, if numpy is giving such an error when imported more than once in the
> main interpreter, there is something wrong with numpy. There is no good
> reason for that error.
>
> Graham
>
> On 6 Feb 2019, at 2:36 am, [email protected] wrote:
>
> Hi
>
> I am permit you to ask you about a problem that I have with hosting flask
> application with the portage of mod_wsgi on windows
>
> I have two flask application and only one can be alive a the same times
> due to conflict in import
>
> ie :
> If a request application 1 I have a response
> Then if I request application 2 I have internal server error with error in
> log ...
> Then if I restart apache and I request application 2 I have a response but
> if I request application 1 I have the same internal server error
> If I comments some import like numpy both application can be alive at the
> same time
>
> Any help would be appreciated if you have any idea or link or answer to
> about this problem?
>
> My installation is describe below
>
> Thanks by advance for tour times and your works
>
> Alexandre
>
>
> LOG of the error
>     mod_wsgi (pid=4936): Failed to exec Python script file
> 'D:/exec/Apache24/htdocs/wsgi/api_test_2.wsgi'.
>     mod_wsgi (pid=4936): Exception occurred processing WSGI script
> 'D:/exec/Apache24/htdocs/wsgi/api_test_2.wsgi'.
>     Traceback (most recent call last):\r
>     File "D:/exec/Apache24/htdocs/wsgi/api_test_2.wsgi", line 3, in
> <module>\r
>         from api_test_2 import app as application\r
>         File "D:/exec/wsgi_api/api_test_2\\api_test_2.py", line 2, in
> <module>\r
>             import numpy\r
>         File
> "c:\\python\\python36\\lib\\site-packages\\numpy\\__init__.py", line 142,
> in <module>\r
>             from . import core\r
>         File
> "c:\\python\\python36\\lib\\site-packages\\numpy\\core\\__init__.py", line
> 16, in <module>\r
>             from . import multiarray\r
>         File
> "c:\\python\\python36\\lib\\site-packages\\numpy\\core\\multiarray.py",
> line 12, in <module>\r
>             from . import overrides\r
>         File
> "c:\\python\\python36\\lib\\site-packages\\numpy\\core\\overrides.py", line
> 46, in <module>\r
>         """)\r
>      RuntimeError: implement_array_function method already has a
> docstring\r
>
>
>     #---------------------------------
>     # file : D:/exec/wsgi_api/api_test_1/api_test_1.py
>     #---------------------------------
>     from flask import Flask, jsonify,render_template, request,
> make_response
>     import numpy
>     app = Flask(__name__)
>     @app.route('/')
>     def home():
>         resp = make_response("hello from 1", 200)
>         resp.headers['Content-Type'] = 'charset=utf-8'
>         return resp
>     #---------------------------------
>
>     #---------------------------------
>     # file : D:/exec/wsgi_api/api_test_2/api_test_2.py
>     #---------------------------------
>     from flask import Flask, jsonify,render_template, request,
> make_response
>     import numpy
>     app = Flask(__name__)
>     @app.route('/')
>     def home():
>         resp = make_response("hello from 2", 200)
>         resp.headers['Content-Type'] = 'charset=utf-8'
>         return resp
>     if __name__ == '__main__':
>         app.run(host='127.0.0.1', port=36000)
>     #---------------------------------
>
>
> I have this two wsgi file in appache httpdocs
>
>
>     #---------------------------------
>     # file : D:/exec/Apache24/htdocs/wsgi/api_test_1.wsgi
>     #---------------------------------
>     import sys
>     sys.path.append('D:/exec/wsgi_api/api_test_1/')
>     from api_test_1 import app as application
>     #---------------------------------
>
>
>     #---------------------------------
>     # file : D:/exec/Apache24/htdocs/wsgi/api_test_2.wsgi
>     #---------------------------------
>     import sys
>     sys.path.append('D:/exec/wsgi_api/api_test_1/')
>     from api_test_1 import app as application
>     #---------------------------------
>
>
>     #---------------------------------
>     In D:/exec/Apache24/conf/httpd.conf i add the line
>     #---------------------------------
>     WSGIScriptAlias /api_test_1
> "D:/exec/Apache24/htdocs/wsgi/api_test_1.wsgi"
>     WSGIScriptAlias /api_test_2
> "D:/exec/Apache24/htdocs/wsgi/api_test_2.wsgi"
>     #---------------------------------
>
>
>
> --
> 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.
>
>
> --
> 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.
>

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