>From your command line Python interpreter, do:

    import sklearn.feature_extraction
    print(sklearn.feature_extraction.__file_)

What do you get?

> On 22 Jan 2019, at 3:22 am, Eric Demarqui <[email protected]> wrote:
> 
> Thanks Graham,
> 
> let me answer your questions .
> 
> I compiled mod_wsgi from source (from 
> https://github.com/GrahamDumpleton/mod_wsgi/archive/4.6.5.tar.gz 
> <https://github.com/GrahamDumpleton/mod_wsgi/archive/4.6.5.tar.gz>)
> My first try was without the python-path in the  WSGIDaemonProcess directive. 
> but the same error was there without python-path.
> I am not using a virtual environment.
> Here is my python environment :
>     Python 3.7.1 (default, Jan 15 2019, 15:00:56)
>     [GCC 4.8.5 20150623 (Red Hat 4.8.5-36)] on linux
>     Type "help", "copyright", "credits" or "license" for more information.
>      >>> import sys
>      >>> sys.path
>      ['', '/usr/local/lib/python37.zip', '/usr/local/lib/python3.7', 
> '/usr/local/lib/python3.7/lib-dynload', 
> '/root/.local/lib/python3.7/site-packages', 
> '/usr/local/lib/python3.7/site-packages']
>      >>> sys.prefix
>      '/usr/local'
>      >>>
> 
> is the path ok ? 
> 
> I have just tried your suggestion by adding the directive 
> "WSGIRestrictEmbedded" outside the VirtualHost. 
> But the same 500 error happens 
> 
> [Mon Jan 21 13:51:42.193801 2019] [wsgi:error] [pid 12113] [remote 
> 10.222.160.228:54376 <http://10.222.160.228:54376/>]     from 
> sklearn.feature_extraction.text import TfidfVectorizer
> [Mon Jan 21 13:51:42.193829 2019] [wsgi:error] [pid 12113] [remote 
> 10.222.160.228:54376 <http://10.222.160.228:54376/>] ModuleNotFoundError: No 
> module named 'sklearn.feature_extraction'
> 
> any idea ?
> Thanks
> Eric
> 
> Le lundi 21 janvier 2019 12:35:56 UTC+1, Graham Dumpleton a écrit :
> 
> 
>> On 21 Jan 2019, at 9:58 pm, Eric Demarqui <eric.d...@ <>gmail.com 
>> <http://gmail.com/>> wrote:
>> 
>> Hi
>> 
>> I have an application using Flask server which is running fine.
>> 
>> I want to use  now Apache with mod_wsgi on this environment : Apache/2.4.6 
>> (Red Hat Enterprise Linux) mod_wsgi/4.6.5 Python/3.7 
>> 
>> Here is how my wsgi.conf file looks like :
>> 
>> <VirtualHost *>
>>     ServerName xxxxxx
>> 
>>     WSGIDaemonProcess pythonapi user=apache group=apache processes=1 
>> threads=5 home=/var/www/html/pythonapi 
>> python-path=/usr/local/lib/python3.7/site-packages
> 
> Are you using system package for mod_wsgi, or are you compiling from source 
> code yourself? The system mod_wsgi package is not going to be for Python 3.7. 
> You would need to uninstall the system package to be able to compile mod_wsgi 
> from source code. So how did you install mod_wsgi?
> 
> Next issue is that you shouldn’t use python-path to refer to a site-packages 
> directory like that, especially not one in the actual Python installation. If 
> you need to be referring to the one for the actual Python installation, it 
> generally indicates something is wrong with your setup.
> 
> If using a Python virtual environment you should be using python-home. See:
> 
> https://modwsgi.readthedocs.io/en/develop/user-guides/virtual-environments.html
>  
> <https://modwsgi.readthedocs.io/en/develop/user-guides/virtual-environments.html>
> 
> Even if not using a virtual environment. If the Python is in a non standard 
> location, you should also use python-home but in that case referring to 
> sys.path value for the main Python installation and not that of a virtual 
> environment.
> 
> I would suggest though when using daemon mode, to add at global scope outside 
> of the VirtualHost:
> 
>     WSGIRestrictEmbedded On
> 
> This ensures you are using daemon mode.
> 
> So first up, it looks a bit like you are mixing mod_wsgi compiled for one 
> Python version/installation, with a different Python version or virtual 
> environment created from a different version.
> 
> Beyond that, because you are RHEL, it could be a SELinux issue, but first 
> confirm how your mod_wsgi is installed.
> 
>>     WSGIProcessGroup pythonapi
>> 
>>     WSGIScriptAlias /servicebotpy /var/www/html/pythonapi/servicebotpy.wsgi
>> 
>>     <Directory /var/www/html/pythonapi>
>>          WSGIApplicationGroup %{GLOBAL}
>>          Options Indexes MultiViews FollowSymlinks
>>          AllowOverride None
>>          Require all granted
>>     </Directory>
>> </VirtualHost>
>> 
>> mod_wsgi is compiled with same version as of python3.7
>> 
>> I am stucked here . 
>> 
>> [Mon Jan 21 10:32:45.881625 2019] [wsgi:error] [pid 22328] [remote 
>> 10.222.160.228:49260 <http://10.222.160.228:49260/>]   File 
>> "/var/www/html/pythonapi/scorer.py", line 5, in <module>
>> [Mon Jan 21 10:32:45.881632 2019] [wsgi:error] [pid 22328] [remote 
>> 10.222.160.228:49260 <http://10.222.160.228:49260/>]     from 
>> sklearn.feature_extraction.text import TfidfVectorizer
>> [Mon Jan 21 10:32:45.881656 2019] [wsgi:error] [pid 22328] [remote 
>> 10.222.160.228:49260 <http://10.222.160.228:49260/>] ModuleNotFoundError: No 
>> module named 'sklearn.feature_extraction'
>> 
>> Thanks for help
>> Eric
>> 
>> 
>> -- 
>> 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 modwsgi+u...@ <>googlegroups.com <http://googlegroups.com/>.
>> To post to this group, send email to mod...@ <>googlegroups.com 
>> <http://googlegroups.com/>.
>> 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.

Reply via email to