[mod_python] Apache wont load/start...

Graham Dumpleton graham.dumpleton at gmail.com
Thu Aug 16 07:29:04 EDT 2007


On 16/08/07, Jacob Carlsson <jagge_90 at hotmail.com> wrote:
> Hello!
>
> Okey. Im going to give some more detaild information.
>
> OS: Windows XP SP2
> PYTHON: 2.4.4
> MOD_PYTHON: mod_python-3.3.1.win32-py2.4-Apache2.0
> APACHE: Apache 2.0.59 (yes, its from a installer i didnt compile it myself)
> WHY DO I WANT MOD_PYTHON: To install the project management tool Trac
>
> FIRST PROBLEM:
> Now i had Apache 2.2, mod_python-3.3.1.win32-py2.4-Apache2.2, python 2.4
> installed.
> Everytime i entered "LoadModule python_module modules/mod_python.so" my
> apache wouldnt start. There was no error specified in the apache monitor
> only said "Error", and there was no special error specified in apcahes Error
> log either, not any "couldnt find/load module" or anything.

Did you run Apache installer as Administrator?

How are you starting Apache? Are you starting it as yourself directly,
or as an Apache service?

> HOW DID I SOLVE THE FIRST PROBLEM:
> I really did not solve it, or maybe? First i couldnt even launch apache
> 2.0.59 when adding "LoadModule ...." but then i thought, why not try
> downgrading and make clean install once more and so i did. I unistalled
> apache 2.2 and mod_python installed clean apache 2.0.59 and mod_python,
> restarted my computer and it worked. Now i could load the module without
> apache screaming about a Error. Though i directly ran into next problem but
> at least i got somewhere.
> So note that BEFORE i restarted my computer i also added:
>
> Well i simply added some paths to the PATH variable (Right click your "My
> computer" -> Properties -> Advanced -> Enviorment Variables -> find PATH i
> list -> add directorys where python is installed)
>
> I never tried these settings with Apache 2.2 since i didnt understand that
> restarting was needed.
> Also maybe this didnt solve my problem, maybe it was something else? And
> thats just exaclty the reason why im staying at 2.0.59 now when i got it
> working instead of going back to 2.2 and getting that error again.
>
> SECOND PROBLEM:
> Well, now i got apache 2.0.59, mod_python 3.3.1 read my settings on top of
> the mail for more detaild information about my system as it is now. Now i
> can run apache when LoadModule is uncommented in httpd.conf but i cant use
> python at all. When i add:
>
> <Location /mpinfo>
>    SetHandler mod_python
>    PythonInterpreter main_interpreter
>    PythonHandler mod_python.testhandler
> </Location>
>
> and then try to access localhost/mpinfo the server gives me a internal error
> (500).
> My Apache error log says:
>
> [Thu Aug 16 12:13:07 2007] [error] make_obcallback: could not import
> mod_python.apache.\n
> [Thu Aug 16 12:13:07 2007] [error] make_obcallback: Python path being used
> "['H:\\\\install\\\\Python24\\\\python24.zip', '.\\\\DLLs', '.\\\\lib',
> '.\\\\lib\\\\plat-win', '.\\\\lib\\\\lib-tk',

Where this is wrong is that the actual directory where the Python
stuff is meant to be has been replaced with '.'. That this is wrong
means that site.py file probably isn't being found and as a result
site-packages not being added automatically and so can't find
mod_python. Why the path would have '.' I don't know.

If you can set environment variable:

  PYTHONVERBOSE=1

before you start Apache, you may be able to coax Python to output more
verbose information and you might see error about not finding site.py
file.

> 'H:\\\\install\\\\Apache2\\\\bin']".
> [Thu Aug 16 12:13:07 2007] [error] get_interpreter: no interpreter callback
> found.
> [Thu Aug 16 12:13:07 2007] [error] [client 127.0.0.1] python_handler: Can't
> get/create interpreter.
>
> And on STARTUP of the apache it also seems to be a little error:
>
> [Thu Aug 16 11:25:14 2007] [notice] Apache/2.0.59 (Win32) DAV/2 SVN/1.4.4
> configured -- resuming normal operations
> [Thu Aug 16 11:25:14 2007] [notice] Server built: Jul 27 2006 15:55:03
> [Thu Aug 16 11:25:14 2007] [notice] Parent: Created child process 520
> [Thu Aug 16 11:25:14 2007] [error] python_init: Python version mismatch,
> expected '2.4.3', found '2.4.4'.
> [Thu Aug 16 11:25:14 2007] [error] python_init: Python executable found
> 'H:\\install\\Apache2\\bin\\Apache.exe'.
> [Thu Aug 16 11:25:14 2007] [error] python_init: Python path being used
> 'H:\\install\\Python24\\python24.zip;.\\DLLs;.\\lib;.\\lib\\plat-win;.\\lib\\lib-tk;H:\\install\\Apache2\\bin'.
> [Thu Aug 16 11:25:14 2007] [notice] mod_python: Creating 8 session mutexes
> based on 0 max processes and 250 max threads.
> [Thu Aug 16 11:25:14 2007] [notice] Child 520: Child process is running
> [Thu Aug 16 11:25:14 2007] [notice] Child 520: Acquired the start mutex.
> [Thu Aug 16 11:25:14 2007] [notice] Child 520: Starting 250 worker threads.
>
> If anyone could help me out with my last error i would be really thankful
> since i have tried to do this for several hours now. I feel really
> disapointed and tired of just trying and trying, thats why i mail in this
> mail list.

If you get totally frustrated and want to try something different,
have a go at mod_wsgi instead of mod_python. :-)

> Some other information that might be useful: (This is how i have it now,
> when apache 2.0.59 is "sort of" working:
>
> CURRENT "PATH" VARIABLE:
>
> ........;H:\install\Python24;H:\install\Subversion\bin;H:\install\Python24\DLLs;H:\install\Python24\Lib;H:\install\Python24\Lib\lib-tk;H:\install\Python24\Lib\site-packages;H:\install\Python24\Lib\site-packages\mod_python
>
> NOTE: Even though i have entered: Lib\site-packages\mod_python etc. It
> doesnet show this in the error log. It only shows DLLs, Lib, lib-tk, and so
> on? Why is that? I have tried restarting but this time it isnt changing?
> Maybe i must reinstall apache when these settigns are set?
>
> CURRENT REGISTRY SETTINGS:
>
> This is my "PythonPath" in the registry, i have tried adding
> "...site-packages\\mod_python" here as well.
>
> Windows Registry Editor Version 5.00
>
> [HKEY_CURRENT_USER\Software\Python\PythonCore\2.4\PythonPath]
> @="H:\\install\\Python24\\Lib;H:\\install\\Python24\\DLLs;H:\\install\\Python24\\Lib\\lib-tk;H:\\install\\Python24\\Lib\\site-packages;H:\\install\\Python24\\Lib\\site-packages\\mod_python"

Did you run Python installer as Administrator? Suggestions made by
people in past gave:

[HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\2.5\PythonPath]
@="<path to python>\\Lib;<path to python>\\DLLs;<path to
python>\\Lib\\lib-tk"

Check KEY_LOCAL_MACHINE to see if there are entries there and post
what they are. If they are missing or wrong and running Apache as
service, might be bypassing your user entries and thus end up with
wrong directories.

> Now, if there are any more details you think i should provide then please
> let me know, i will gladly provide the information if im able to!
> Im not the best on installing these actually advanced programs/modules.
> Installing Trac has been a nightmare for me. Either that wont work or that,
> trac has really succeeded in making the worlds most difficult install if you
> ask me ;).

You might also have a read of thread:

  http://groups.google.com/group/modwsgi/browse_thread/thread/16242447b5890e96

This was for mod_wsgi instead of mod_python, but it gives a whole
bunch of other registry entries which I don't know are relevant or
not.

Maybe a Windows person can make more sense of this than me. I don't
use Windows for this stort of stuff.

Graham

> Thank you for reading!
>
> Best Regards Jacob Carlsson
>
> >From: "Graham Dumpleton" <graham.dumpleton at gmail.com>
> >To: "Colin Bean" <ccbean at gmail.com>
> >CC: "Jacob Carlsson" <jagge_90 at hotmail.com>, list
> ><mod_python at modpython.org>
> >Subject: Re: [mod_python] Apache wont load/start...
> >Date: Thu, 16 Aug 2007 08:19:16 +1000
> >
> >On 16/08/07, Colin Bean <ccbean at gmail.com> wrote:
> > > Try following the links from this message, they seem to address the
> > > same problem:
> > >
> > > http://www.modpython.org/pipermail/mod_python/2007-June/023861.html
> >
> >Actually, possibly don't pay too much attention to that post about
> >adding site-packages as it isn't meant to be listed in the registry
> >entries to begin with. The site-packages directory is only added when
> >the Python site.py file has been loaded. This was only brought to my
> >attention recently when working out Windows issues with mod_wsgi.
> >
> >Thus, if mod_python code modules not being found, more likely to be
> >that correct site.py file isn't being found at startup. This can occur
> >because of access permissions on files if Apache is run as a service
> >and thus a different user. Thus, very important to install
> >Apache/Python/mod_python as administrator so file permissions are
> >okay, DLLs are in system directories and so registry entries setup for
> >machine and not just user.
> >
> >Problems can also arise where you have installed multiple versions of
> >Python and the first one found in PATH is not the same version that
> >mod_python requires. This can occur from installing multiple Python
> >versions explicitly, or can be done inadvertently as there are now a
> >number of Windows applications which provide their own copy of Python.
> >If the Python version from such an application is found in PATH first
> >it can screw everything up. If this Python version was found first
> >when installing mod_python, can also mean that mod_python Python code
> >files were installed in wrong location and not where Python used by
> >Apache is looking. There can also be a problem where real Python was
> >installed as administrator and the application version as normal user,
> >as the application version may put entries in user registry entries
> >and shadow those for machine.
> >
> >I stress though what has already been said, it is vitally important to
> >see what is being logged in the Apache error logs so the reason can be
> >determined.
> >
> >As to not seeing solutions to previous posts, it is generally because
> >people having problems don't explain problems very well and in enough
> >detail. As a consequence we repeat all the commonly suspected issues,
> >such as above. The OP somehow then solves his problem and then doesn't
> >bother responding to say what the problem was and how they fixed it.
> >As a consequence we never learn anything about what the actual problem
> >was and are never able to improve our troubleshooting suggestions.
> >
> >So, please provide details about log messages and help us by feeding
> >back whatever information seems pertinent and how you may have solved
> >the problem.
> >
> >Thanks.
> >
> >Graham
> >
> > > Past that I'm probably not going to be of much help as I don't use
> > > mod_python on windows...
> > > Just to clarify, you are using the installer compiled for apache
> > > 2.0.x, correct?  I'm guessing so, as I doubt you would have gotten
> > > this far otherwise.
> > >
> > > Take care,
> > > Colin
> > >
> > > On 8/15/07, Jacob Carlsson <jagge_90 at hotmail.com> wrote:
> > > > Hey!
> > > >
> > > > Thank you for your fast answer!
> > > >
> > > > There was no errors in the log. Thats why it was so weird. While i
> >waited
> > > > for an answer i downgraded my apache to 2.0.59 again and entered my
> >python
> > > > installation path in the PATH variable. And when i restarted my
> >computer it
> > > > started up fine despite i had entered "LoadModule python_module ...".
> >But
> > > > still it dont work and gives me alot of errors. I'll post my log:
> > > >
> > > >
> > > >
> > > > [Wed Aug 15 21:00:47 2007] [notice] Apache/2.0.59 (Win32) DAV/2
> >SVN/1.4.4
> > > > configured -- resuming normal operations
> > > > [Wed Aug 15 21:00:47 2007] [notice] Server built: Jul 27 2006 15:55:03
> > > > [Wed Aug 15 21:00:47 2007] [notice] Parent: Created child process 4852
> > > > [Wed Aug 15 21:00:48 2007] [error] python_init: Python version
> >mismatch,
> > > > expected '2.4.3', found '2.4.4'.
> > > > [Wed Aug 15 21:00:48 2007] [error] python_init: Python executable
> >found
> > > > 'H:\\install\\Apache2\\bin\\Apache.exe'.
> > > > [Wed Aug 15 21:00:48 2007] [error] python_init: Python path being used
> > > >
> >'H:\\install\\Python24\\python24.zip;.\\DLLs;.\\lib;.\\lib\\plat-win;.\\lib\\lib-tk;H:\\install\\Apache2\\bin'.
> > > > [Wed Aug 15 21:00:48 2007] [notice] mod_python: Creating 8 session
> >mutexes
> > > > based on 0 max processes and 250 max threads.
> > > > [Wed Aug 15 21:00:48 2007] [notice] Child 4852: Child process is
> >running
> > > > [Wed Aug 15 21:00:48 2007] [notice] Child 4852: Acquired the start
> >mutex.
> > > > [Wed Aug 15 21:00:48 2007] [notice] Child 4852: Starting 250 worker
> >threads.
> > > > [Wed Aug 15 21:00:51 2007] [error] make_obcallback: could not import
> > > > mod_python.apache.\n
> > > > [Wed Aug 15 21:00:51 2007] [error] make_obcallback: Python path being
> >used
> > > > "['H:\\\\install\\\\Python24\\\\python24.zip', '.\\\\DLLs',
> >'.\\\\lib',
> > > > '.\\\\lib\\\\plat-win', '.\\\\lib\\\\lib-tk',
> > > > 'H:\\\\install\\\\Apache2\\\\bin']".
> > > > [Wed Aug 15 21:00:51 2007] [error] get_interpreter: no interpreter
> >callback
> > > > found.
> > > > [Wed Aug 15 21:00:51 2007] [error] [client 127.0.0.1] python_handler:
> >Can't
> > > > get/create interpreter.
> > > >
> > > >
> > > > These last errors comes when i try accessing the following:
> > > >
> > > > <Location /mpinfo>
> > > >    SetHandler mod_python
> > > >    PythonInterpreter main_interpreter
> > > >    PythonHandler mod_python.testhandler
> > > > </Location>
> > > >
> > > > Like what does it mean with "Python version mismatch, expected
> >'2.4.3',
> > > > found '2.4.4'.", expected 2.4.3? How could it expect something else?
> > > >
> > > > Also i tried entering some more paths into the PATH variable like
> > > > "Lib,lib-tk,DLLs" but it doesent seem enough...
> > > >
> > > > Best Regards Jacob Carlsson
> > > >
> > > > >From: "Colin Bean" <ccbean at gmail.com>
> > > > >To: "Jacob Carlsson" <jagge_90 at hotmail.com>
> > > > >CC: mod_python at modpython.org
> > > > >Subject: Re: [mod_python] Apache wont load/start...
> > > > >Date: Wed, 15 Aug 2007 11:08:19 -0700
> > > > >
> > > > >Please post the contents from your Apache error log when you try to
> > > > >start the server, can't really tell what the problem is from the
> > > > >information you've given.
> > > > >
> > > > >On 8/15/07, Jacob Carlsson <jagge_90 at hotmail.com> wrote:
> > > > > > Hello!
> > > > > >
> > > > > > Im using Windows XP.
> > > > > >
> > > > > > I have tried to get apache (both 2.2.4 and 2.0.59 to work with
> > > > >mod_python).
> > > > > > I have python 2.4 and I have tried using
> > > > > > "mod_python-3.2.10.win32-py2.4-apache2.2" &
> > > > > > "mod_python-3.3.1.win32-py2.4-Apache2.2" and also some other
> >different
> > > > > > versions when I tested with apache 2.0.59.
> > > > > >
> > > > > > My problem is that apache simply wont load when i enter
> >"LoadModule
> > > > > > python_module modules/mod_python.so" in httpd.conf.
> > > > > > Now I have tried fixing this in many various ways for hours and
> >not
> > > > >succeded
> > > > > > at all.
> > > > > > For example I have searched google and your page for answers and i
> >found
> > > > >out
> > > > > > that some people had the same problem as I but some of their
> >solutions
> > > > >didnt
> > > > > > work out for me.
> > > > > > For example I tried adding python to my "PATH" variable but that
> >didnt
> > > > >help
> > > > > > much.. Maybe i did it incorrect? I added "C:\Python24" (thats
> >simply
> > > > >where I
> > > > > > installed python)
> > > > > > Also many that have the same problem didnt get an answer that i
> >could
> > > > >read.
> > > > > >
> > > > > > So i would appreciate any help so i finally can solve this really
> > > > >annoying
> > > > > > problem!
> > > > > >
> > > > > > Best Regards Jacob Carlsson
> > > > > >
> > > > > > _________________________________________________________________
> > > > > > Luspank? Tjäna pengar på auktion http://tradera.msn.se/
> > > > > >
> > > > > > _______________________________________________
> > > > > > Mod_python mailing list
> > > > > > Mod_python at modpython.org
> > > > > > http://mailman.modpython.org/mailman/listinfo/mod_python
> > > > > >
> > > >
> > > > _________________________________________________________________
> > > > Spela roliga Worms'07 i mobilen
> > > > http://msn.cellus.se/?page=game_order&itemId=878908
> > > >
> > > >
> > >
> > > _______________________________________________
> > > Mod_python mailing list
> > > Mod_python at modpython.org
> > > http://mailman.modpython.org/mailman/listinfo/mod_python
> > >
>
> _________________________________________________________________
> Spela roliga Worms'07 i mobilen
> http://msn.cellus.se/?page=game_order&itemId=878908
>
>



More information about the Mod_python mailing list