You should not use activate_this.py for virtual environment activation unless 
you have no other choice. Use WSGIPythonHome or preferably use 
WSGIDaemonProcess and python-home as explain in that doc.

> On 3 Dec 2021, at 1:18 pm, matkatmusic <[email protected]> wrote:
> 
> Success!!!
> 
> [wsgi:info] [pid 19919:tid 47035722368064] mod_wsgi (pid=19919): Initializing 
> Python.
> [Thu Dec 02 15:38:08.576095 2021] [wsgi:info] [pid 19916:tid 47035722368064] 
> mod_wsgi (pid=19916): Attach interpreter ''.
> [Thu Dec 02 15:38:08.586154 2021] [wsgi:info] [pid 19913:tid 47035722368064] 
> mod_wsgi (pid=19913): Attach interpreter ''.
> [Thu Dec 02 15:38:08.591026 2021] [wsgi:info] [pid 19914:tid 47035722368064] 
> mod_wsgi (pid=19914): Attach interpreter ''.
> [Thu Dec 02 15:38:08.594354 2021] [wsgi:info] [pid 19915:tid 47035722368064] 
> mod_wsgi (pid=19915): Attach interpreter ''.
> [Thu Dec 02 15:38:08.598385 2021] [wsgi:info] [pid 19919:tid 47035722368064] 
> mod_wsgi (pid=19919): Attach interpreter ''.
> [ N 2021-12-02 15:38:08.9955 19868/T1 age/Cor/TelemetryCollector.h:531 ]: 
> Message from Phusion: End time can not be before or equal to begin time
> [ N 2021-12-02 15:38:09.0274 19868/T1 age/Cor/CoreMain.cpp:1325 ]: Passenger 
> core shutdown finished
> 
> Now I am getting python-specific errors when I try to load up my site.  
> These errors are related to the virtual environment and the missing 
> `activate_this.py` file. 
> 
> After reading: 
> https://modwsgi.readthedocs.io/en/develop/user-guides/virtual-environments.html
>  
> <https://modwsgi.readthedocs.io/en/develop/user-guides/virtual-environments.html>
>  
> It seems like mod_wsgi is meant for, or designed around python v2.x, not v3.x 
> 
> I was able to get the hello, world snippet you shared here up and running and 
> printing out. 
> https://modwsgi.readthedocs.io/en/develop/user-guides/debugging-techniques.html#apache-error-log-files
>  
> <https://modwsgi.readthedocs.io/en/develop/user-guides/debugging-techniques.html#apache-error-log-files>
> 
> Now I just need to solve these import errors, which seem to be related to my 
> folder hierarchy and file structure. 
> 
> 
> 
> On Thursday, December 2, 2021 at 1:47:38 PM UTC-8 Graham Dumpleton wrote:
> A few quick comments as got other things need to do before read through this 
> properly.
> 
> 1. Compiling your own Python can be tricky. Read:
> 
> * http://blog.dscpl.com.au/2015/06/installing-custom-python-version-into.html 
> <http://blog.dscpl.com.au/2015/06/installing-custom-python-version-into.html>
> 
> Ignore that it talks about docker as still relevant.
> 
> 2. If you are using Python from a non standard location, if using CMMI 
> install method you have to embed in mod_wsgi  knowledge of where it is. That 
> is, set LD_RUN_PATH when compiling/installing module. Read:
> 
> * 
> https://modwsgi.readthedocs.io/en/master/user-guides/installation-issues.html#unable-to-find-python-shared-library
>  
> <https://modwsgi.readthedocs.io/en/master/user-guides/installation-issues.html#unable-to-find-python-shared-library>
> 
> 3. Instead of using CMMI install method, it can be better to use pip install 
> method. Read:
> 
> * https://pypi.org/project/mod-wsgi/ <https://pypi.org/project/mod-wsgi/>
> 
> Graham
> 
> 
>> On 3 Dec 2021, at 8:39 am, matkatmusic <[email protected] 
>> <applewebdata://554C06CA-56E5-4B99-B9BF-5CA992646E4D>> wrote:
>> 
> 
>> I am getting the following error when I try to use mod_wsgi with Apache2.4:
>> 
>> The “/usr/sbin/httpd -DSSL -t -f 
>> /etc/apache2/conf.d/includes/pre_main_global.conf.tmp.cfgcheck -C Include 
>> "/etc/apache2/conf.modules.d/*.conf"” command (process 10241) reported error 
>> number 1 when it ended. httpd: Syntax error on line 2 of 
>> /etc/apache2/conf.d/includes/pre_main_global.conf.tmp.cfgcheck: Cannot load 
>> modules/mod_wsgi.so into server: libpython3.9.so.1.0: cannot open shared 
>> object file: No such file or directory
>> 
>> I have installed python3.9.9 from source code as the Cpanel user into: 
>> $HOME/python/Python-3.9.9/
>> the configuration was:
>> --enable-shared --prefix=$HOME/python
>> This install location is taken from this tutorial from my host:
>> https://www.bluehost.com/help/article/python-installation 
>> <https://www.bluehost.com/help/article/python-installation>
>> 
>> mkdir ~/python
>> cd ~/python
>> wget http://www.python.org/ftp/python/3.9.9/Python-3.9.9.tgz 
>> <http://www.python.org/ftp/python/3.9.9/Python-3.9.9.tgz>
>> tar zxfv Python-3.9.9.tgz
>> find ~/python -type d | xargs chmod 0755
>> cd Python-3.9.9
>> ./configure --enable-shared --prefix=$HOME/python
>> make
>> make install
>> 
>> I have modified the CPanel user's .bashrc file to point to this location so 
>> that calling $ python -V will execute the python installed from source. 
>> 
>> This command failed (cannot find libpython3.9.so.1.0), so I followed the 
>> instructions here to add LD_LIBRARY_PATH to the .bashrc: 
>> https://stackoverflow.com/questions/480764/linux-error-while-loading-shared-libraries-cannot-open-shared-object-file-no-s
>>  
>> <https://stackoverflow.com/questions/480764/linux-error-while-loading-shared-libraries-cannot-open-shared-object-file-no-s>
>> 
>> export PATH=/home/bfxqsxmy/python/Python-3.9.9/:$PATH
>> export PATH=/home/bfxqsxmy/python/bin/:$PATH
>> export LD_LIBRARY_PATH=/home/bfxqsxmy/python/Python-3.9.9/:$LD_LIBRARY_PATH
>> 
>> Now running 'python -V' from the CPanel User's shell prints out 'python3.9.9'
>> 
>> I then installed mod_wsgi from source as the Cpanel user. 
>> the configuration used was:
>> ./configure --with-apxs=/bin/apxs 
>> --with-python=/home/bfxqsxmy/python/Python-3.9.9/python
>> 
>> 'make' succeeded without issue.
>> running 'make install' failed because I was the Cpanel user, and it was 
>> trying to write to /etc/apache2/modules/
>> 
>> running 'sudo make install' succeeded. 
>> /etc/apache2/modules/mod_wsgi.so now exists. 
>> 
>> Next: I try to edit the Apache Pre-main include file via WHM and add the 
>> following line:
>>  LoadModule wsgi_module modules/mod_wsgi.so
>> 
>> Updating the pre-main include file causes this error to appear: 
>> Error:
>> The “/usr/sbin/httpd -DSSL -t -f 
>> /etc/apache2/conf.d/includes/pre_main_global.conf.tmp.cfgcheck -C Include 
>> "/etc/apache2/conf.modules.d/*.conf"” command (process 10241) reported error 
>> number 1 when it ended. httpd: Syntax error on line 2 of 
>> /etc/apache2/conf.d/includes/pre_main_global.conf.tmp.cfgcheck: Cannot load 
>> modules/mod_wsgi.so into server: libpython3.9.so.1.0: cannot open shared 
>> object file: No such file or directory
>> 
>> Apache is running as the following users:
>> root (1 instance of /usr/sbin/httpd -k start)
>> nobody (6 instances of /usr/sbin/httpd -k start)
>> 
>> Any idea what the problem is? 
>> 
>> Thanks!!
>> 
> 
>> -- 
>> 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] 
>> <applewebdata://554C06CA-56E5-4B99-B9BF-5CA992646E4D>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/modwsgi/a8bf68cd-491a-4ae4-be45-16f013eb6aa1n%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/modwsgi/a8bf68cd-491a-4ae4-be45-16f013eb6aa1n%40googlegroups.com?utm_medium=email&utm_source=footer>.
> 
> 
> -- 
> 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 view this discussion on the web visit 
> https://groups.google.com/d/msgid/modwsgi/350a3ab2-ef75-4a4e-9c2a-74f158ad0f3an%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/modwsgi/350a3ab2-ef75-4a4e-9c2a-74f158ad0f3an%40googlegroups.com?utm_medium=email&utm_source=footer>.

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/modwsgi/55EAD5C9-BE59-4655-930D-B538C078E4ED%40gmail.com.

Reply via email to