Something else I will mention, in case it's an issue. I built/installed mod_wsgi while logged in as root at first, as I hadn't added apache_user to the sudo list at that point.
Latterly, I did add it to the list and then rebuilt/installed under that user, to see if it would make a difference. I didn't try and uninstall it first tho as there was no make uninstall task and I was unsure as to every location I should delete to accomplish this. Is it possible that could be having an effect here? On 17 May 2013, at 15:28, Matthew O'Connell <[email protected]> wrote: > Log level set to debug. Looks like it is setting WSGIPythonHome ok in the > logs as well, to me at least: > > [Fri May 17 09:20:01 2013] [info] mod_wsgi (pid=11299): Process 'foo.com' has > died, restarting. > [Fri May 17 09:20:01 2013] [info] mod_wsgi (pid=11302): Starting process > 'foo.com' with uid=1001, gid=33 and threads=5. > [Fri May 17 09:20:01 2013] [info] mod_wsgi (pid=11302): Python home > /home/apache_user/workspace/python/current. > [Fri May 17 09:20:01 2013] [info] mod_wsgi (pid=11302): Initializing Python. > [Fri May 17 09:20:01 2013] [info] mod_wsgi (pid=11301): Python home > /home/apache_user/workspace/python/current. > [Fri May 17 09:20:01 2013] [info] mod_wsgi (pid=11301): Initializing Python. > [Fri May 17 09:20:01 2013] [info] mod_wsgi (pid=11300): Python home > /home/apache_user/workspace/python/current. > [Fri May 17 09:20:01 2013] [info] mod_wsgi (pid=11300): Initializing Python. > Traceback (most recent call last): > File "/usr/lib/python2.7/site.py", line 562, in <module> > main() > File "/usr/lib/python2.7/site.py", line 544, in main > known_paths = addusersitepackages(known_paths) > File "/usr/lib/python2.7/site.py", line 271, in addusersitepackages > user_site = getusersitepackages() > File "/usr/lib/python2.7/site.py", line 246, in getusersitepackages > user_base = getuserbase() # this will also set USER_BASE > File "/usr/lib/python2.7/site.py", line 236, in getuserbase > USER_BASE = get_config_var('userbase') > File "/usr/lib/python2.7/sysconfig.py", line 577, in get_config_var > return get_config_vars().get(name) > File "/usr/lib/python2.7/sysconfig.py", line 476, in get_config_vars > _init_posix(_CONFIG_VARS) > File "/usr/lib/python2.7/sysconfig.py", line 337, in _init_posix > makefile = _get_makefile_filename() > File "/usr/lib/python2.7/sysconfig.py", line 331, in _get_makefile_filename > return > os.path.join(get_path('platstdlib').replace("/usr/local","/usr",1), "config" > + (sys.pydebug and "_d" or ""), "Makefile") > AttributeError: 'module' object has no attribute 'pydebug' > > FYI here's the Apache site config as well, in case there are any boobs in > there: > > <VirtualHost *:80> > > ServerName www.foo.com > ServerAlias foo.com > ServerAdmin [email protected] > > DocumentRoot /home/apache_user/p4p/p4p_jsapp/www > > <Directory /home/apache_user/p4p/p4p_jsapp/www> > Order allow,deny > Allow from all > </Directory> > > WSGIDaemonProcess foo.com user= apache_user processes=1 threads=5 > display-name=%{GROUP} > WSGIProcessGroup foo.com > > WSGIScriptAlias /api /home/apache_user/p4p/p4p_jsapp/pfp/pfp.wsgi > > <Directory /home/apache_user/p4p/p4p_jsapp/pfp> > WSGIProcessGroup foo.com > WSGIApplicationGroup %{GLOBAL} > Order allow,deny > Allow from all > </Directory> > > </VirtualHost> > > > On 17 May 2013, at 02:03, Graham Dumpleton <[email protected]> wrote: > >> On first glance, yes, looks okay. >> >> If this is still not working, then set LogLevel in Apache to debug. With >> that done mod_wsgi should log messages to the Apache error log about when it >> is setting the Python home location to and what. That way you can confirm it >> is using what you told it to. >> >> Graham >> >> On 17/05/2013, at 12:41 AM, Matthew O'Connell <[email protected]> >> wrote: >> >>> So mod_python is not installed on the server and I have already the >>> following two apache config files... >>> >>> >>> /etc/apace2/mods-available/mod-wsgi.load: >>> >>> LoadModule wsgi_module /usr/lib/apache2/modules/mod_wsgi.so >>> >>> >>> /etc/apace2/mods-available/mod-wsgi.conf: >>> >>> <IfModule mod_wsgi.c> >>> >>> WSGIPythonHome /home/apache_user/workspace/python/current >>> >>> </IfModule> >>> >>> >>> Looks correct? >>> >>> >>> On 16 May 2013, at 00:28, Graham Dumpleton <[email protected]> >>> wrote: >>> >>>> Try adding to the Apache configuration: >>>> >>>> WSGIPythonHome /home/apache_user/workspace/python/current >>>> >>>> It is possible that at runtime, because your Python is in a non standard >>>> location, that it is picking of the .py files from the standard location >>>> rather than where your Python installation is. This will force it to look >>>> in the correct location. >>>> >>>> Note that you MUST not be using mod_python in the same Apache as that will >>>> override this and cause it not to work. >>>> >>>> Graham >>>> >>>> On 15/05/2013, at 11:25 PM, ultra909 <[email protected]> wrote: >>>> >>>>> Hi Graham, >>>>> >>>>> So like Isaac, I am trying to get mod_wsgi to play with the Enthought >>>>> Python distro on Ubuntu. >>>>> >>>>> I have likewise followed the instructions for building with Multiple >>>>> Python Versions and run the following: >>>>> >>>>> make distclean >>>>> ./configure >>>>> --with-python=/home/apache_user/workspace/python/current/bin/python >>>>> LD_RUN_PATH=/home/apache_user/workspace/python/current/lib make >>>>> sudo make install >>>>> >>>>> When I try and start Apache, I just get the following in a loop in the >>>>> error.log: >>>>> >>>>> Traceback (most recent call last): >>>>> File "/usr/lib/python2.7/site.py", line 562, in <module> >>>>> main() >>>>> File "/usr/lib/python2.7/site.py", line 544, in main >>>>> known_paths = addusersitepackages(known_paths) >>>>> File "/usr/lib/python2.7/site.py", line 271, in addusersitepackages >>>>> user_site = getusersitepackages() >>>>> File "/usr/lib/python2.7/site.py", line 246, in getusersitepackages >>>>> user_base = getuserbase() # this will also set USER_BASE >>>>> File "/usr/lib/python2.7/site.py", line 236, in getuserbase >>>>> USER_BASE = get_config_var('userbase') >>>>> File "/usr/lib/python2.7/sysconfig.py", line 577, in get_config_var >>>>> return get_config_vars().get(name) >>>>> File "/usr/lib/python2.7/sysconfig.py", line 476, in get_config_vars >>>>> _init_posix(_CONFIG_VARS) >>>>> File "/usr/lib/python2.7/sysconfig.py", line 337, in _init_posix >>>>> makefile = _get_makefile_filename() >>>>> File "/usr/lib/python2.7/sysconfig.py", line 331, in >>>>> _get_makefile_filename >>>>> return >>>>> os.path.join(get_path('platstdlib').replace("/usr/local","/usr",1), >>>>> "config" + (sys.pydebug and "_d" or ""), "Makefile") >>>>> AttributeError: 'module' object has no attribute 'pydebug' >>>>> >>>>> On Monday, 29 April 2013 01:18:55 UTC+2, Graham Dumpleton wrote: >>>>> Since I can't see in the prior discussion mention of the error given by >>>>> the traceback, can you go back to square one and explain your specific >>>>> problem from the start rather than just assuming it is related to the >>>>> prior one. Not knowing the background of what you are doing makes it hard >>>>> to comment. >>>>> >>>>> Graham >>>>> >>>>> On 25/04/2013, at 5:28 AM, ultra909 <[email protected]> wrote: >>>>> >>>>>> Hi, >>>>>> >>>>>> I have EXACTLY the same problem as you. Have done all that and yet still >>>>>> get nothing out of Apache other than: >>>>>> >>>>>> [Wed Apr 24 15:15:55 2013] [info] mod_wsgi (pid=10234): Python home >>>>>> /home/strongshell/workspace/python/epd-7.3-1/. >>>>>> [Wed Apr 24 15:15:55 2013] [info] mod_wsgi (pid=10234): Initializing >>>>>> Python. >>>>>> Traceback (most recent call last): >>>>>> File "/usr/lib/python2.7/site.py", line 562, in <module> >>>>>> main() >>>>>> File "/usr/lib/python2.7/site.py", line 544, in main >>>>>> known_paths = addusersitepackages(known_paths) >>>>>> File "/usr/lib/python2.7/site.py", line 271, in addusersitepackages >>>>>> user_site = getusersitepackages() >>>>>> File "/usr/lib/python2.7/site.py", line 246, in getusersitepackages >>>>>> user_base = getuserbase() # this will also set USER_BASE >>>>>> File "/usr/lib/python2.7/site.py", line 236, in getuserbase >>>>>> USER_BASE = get_config_var('userbase') >>>>>> File "/usr/lib/python2.7/sysconfig.py", line 577, in get_config_var >>>>>> return get_config_vars().get(name) >>>>>> File "/usr/lib/python2.7/sysconfig.py", line 476, in get_config_vars >>>>>> _init_posix(_CONFIG_VARS) >>>>>> File "/usr/lib/python2.7/sysconfig.py", line 337, in _init_posix >>>>>> makefile = _get_makefile_filename() >>>>>> File "/usr/lib/python2.7/sysconfig.py", line 331, in >>>>>> _get_makefile_filename >>>>>> return >>>>>> os.path.join(get_path('platstdlib').replace("/usr/local","/usr",1), >>>>>> "config" + (sys.pydebug and "_d" or ""), "Makefile") >>>>>> AttributeError: 'module' object has no attribute 'pydebug' >>>>>> >>>>>> >>>>>> Clearly it's still hitting the base system python somehow - can't even >>>>>> get it to run a simple wsgi to dump out sys variables. My WSGIPythonHome >>>>>> is set to the directory above lib and bin... ldd looks all good... any >>>>>> ideas? >>>>>> >>>>>> TIA >>>>>> >>>>>> On Thursday, 10 January 2013 20:45:26 UTC+1, Isaac Shivvers wrote: >>>>>> Hi all, >>>>>> >>>>>> Just a quick bump, bringing this post back to life. >>>>>> >>>>>> I'm running a similar setup, and had a very similar problem: >>>>>> - attempting to run a mod_wsgi application using a specific, custom >>>>>> Enthought python build >>>>>> - used multiple-python guide here, and it appeared successful >>>>>> - but, I still had problems: >>>>>> - libraries that should work (numpy) did not >>>>>> - sys.version (inside wsgi application) reported default system >>>>>> version, not the one I wanted >>>>>> >>>>>> But, modifying the LD_RUN_PATH with make worked like a charm! >>>>>> I re-compiled mod_wsgi, as Graham suggested: >>>>>> >>>>>> make distclean >>>>>> ./configure --with-python=/path/to/python/executable >>>>>> LD_RUN_PATH=/path/to/python/lib make >>>>>> sudo make install >>>>>> >>>>>> Thanks for all the work you've put into mod_wsgi! >>>>>> -Isaac >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> On Tuesday, May 3, 2011 4:46:30 PM UTC-7, Graham Dumpleton wrote: >>>>>> On 4 May 2011 03:41, Daniel O'Donovan <[email protected]> wrote: >>>>>> > Thanks for your help Graham, embarrassingly, many of my problems >>>>>> > stemmed from using >>>>>> > >>>>>> > $ service httpd restart >>>>>> > >>>>>> > to control my apache daemon rather than >>>>>> > >>>>>> > $ /etc/init.d/httpd restart >>>>>> > >>>>>> > As 'service' will remove some of your environment variables >>>>>> > (PYTHONHOME seems to be key - WSGIPythonHome didn't seem to have any >>>>>> > effect). >>>>>> You should never rely on environment variables set in user environment >>>>>> being inherited because when box reboots it will fail. >>>>>> >>>>>> As I said before, WSGIPythonHome doesn't help with which shared >>>>>> library is found, only the runtime Python installation prefix. Your >>>>>> comments before suggested sys.path was correct which indicated that >>>>>> WSGIPythonHome was at least doing it job correctly. As per the >>>>>> documented I directed you to, the important value is sys.prefix and >>>>>> what that is set to within mod_wsgi. >>>>>> >>>>>> WSGIPythonHome should work so long as mod_python not loaded, you get >>>>>> the prefix you give it correct, Apache can read the directories for >>>>>> the installation and you haven't managed to inherit user environment >>>>>> variables that screw it all up. >>>>>> >>>>>> >> What do you mean here? Ie., what does patchelf do and how does it >>>>>> >> change the output from ldd on mod_wsgi.so? >>>>>> > >>>>>> > patchelf modifies the dynamic linker and RPATH of ELF executables. >>>>>> > Unfortunately setting --with-python= and LD_RUN_PATH had no effect for >>>>>> > me, so but a quick >>>>>> > >>>>>> > $ patchelf --set-rpath /lib64:/path/to/my/custom/lib >>>>>> > /etc/httpd/modules/mod_wsgi.so >>>>>> > >>>>>> > did the job. - ldd now searches for dynamic libs in /lib64 and >>>>>> > /path/to/my/custom/lib and finds the appropriate non-system python. >>>>>> >>>>>> Setting LD_RUN_PATH in user environment when building mod_wsgi should >>>>>> work. I can't say what you have done wrong as you haven't supplied >>>>>> exact logs of what commands you ended up running to build it and what >>>>>> subsequent ldd output was. Also don't know what other user environment >>>>>> variables you had set which could cause problems. >>>>>> >>>>>> Anyway, if you have got it working then doesn't matter I guess. >>>>>> >>>>>> 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]. >>>>>> To post to this group, send email to [email protected]. >>>>>> Visit this group at http://groups.google.com/group/modwsgi?hl=en. >>>>>> For more options, visit https://groups.google.com/groups/opt_out. >>>>>> >>>>>> >>>>> >>>>> >>>>> -- >>>>> 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 http://groups.google.com/group/modwsgi?hl=en. >>>>> For more options, visit https://groups.google.com/groups/opt_out. >>>>> >>>>> >>>> >>>> >>>> -- >>>> You received this message because you are subscribed to a topic in the >>>> Google Groups "modwsgi" group. >>>> To unsubscribe from this topic, visit >>>> https://groups.google.com/d/topic/modwsgi/DW0DzFrF1YY/unsubscribe?hl=en. >>>> To unsubscribe from this group and all its topics, send an email to >>>> [email protected]. >>>> To post to this group, send email to [email protected]. >>>> Visit this group at http://groups.google.com/group/modwsgi?hl=en. >>>> For more options, visit https://groups.google.com/groups/opt_out. >>>> >>>> >>> >>> >>> -- >>> 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 http://groups.google.com/group/modwsgi?hl=en. >>> For more options, visit https://groups.google.com/groups/opt_out. >>> >>> >> >> >> -- >> You received this message because you are subscribed to a topic in the >> Google Groups "modwsgi" group. >> To unsubscribe from this topic, visit >> https://groups.google.com/d/topic/modwsgi/DW0DzFrF1YY/unsubscribe?hl=en. >> To unsubscribe from this group and all its topics, send an email to >> [email protected]. >> To post to this group, send email to [email protected]. >> Visit this group at http://groups.google.com/group/modwsgi?hl=en. >> For more options, visit https://groups.google.com/groups/opt_out. >> >> > -- 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 http://groups.google.com/group/modwsgi?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
