[mod_python] NIGHTMARE Installing mod_python on windows

Nicolas Lehuen nicolas.lehuen at gmail.com
Wed May 4 17:01:00 EDT 2005

2005/5/4, py pan <python.pan at gmail.com>:
> Does mod_pyhton stop supporting windows ?
> I'm trying to install it on windows, which is supporsed to be a
> trivial task. But it's not.
> ---
> First I searched the doc about installation in current version of mp,
> and was surprised to find that the official documentation of mp
> doesn't even have a section for installation in Windows !!.
> ---
> Then I searched the net and found some info, which said that what's
> required is a mod_python.dll and need to copy some folder(s) manually
> into the pythonx.x\Lib.
> I looked for mod_python.dll but couldn't find it. I figured that this
> approach is for the older version of mod_python so I didn't go along.
> ---
> Then I searched the net, and found so-called "mod_python window installer":
> http://www.lehuen.com/nicolas/download/mod_python/
> There are two files in that folder currently:
> mod_python-3.1.3.win32-py2.3.exe
> mod_python-3.2.0-dev-20050428.win32-py2.4.exe
> I tried the first one, which seems to install nicely. But when I tried
> it in python:
>         >>> from mod_python import apache
>         Traceback (most recent call last):
>           File "<interactive input>", line 1, in ?
>           File "C:\Python24\Lib\site-packages\mod_python\apache.py", line 28, in ?
>             import _apache
>         ImportError: No module named _apache
> I went to check the installed mp in
> c:\python2.4\Lib\site-packages\mod_python, and found that there's no
> _apache there. What also surprised me is that there's no subfolders in
> that folder.
> ---
> I tried the second file
> (mod_python-3.2.0-dev-20050428.win32-py2.4.exe) and got the same
> error.
> ---
> So, what's the deal here ? mod_python gave up the windows users or what ?
> pan


First of all, let me reassure you, no, we haven't dropped the support
for Windows. I currently have a production server running Apache
2.0.51 + modpython 3.1.4 without any problems. I'm testing each
version of mod_python 3.2.0dev (including the installer) on a
development computer before making any release.

The proper way to install mod_python is simply to have an Apache 2.0.x
server up and running, to have a working Python 2.4 setup, and to
launch the installer. It should first set-up the python packages (you
should have a few files under site-packages, most importantly
apache.py and publisher.py). Then it should prompt you for the Apache
setup directory, and automatically copy mod_python.so in the modules
subdirectory. Finally, it should give you a warning message telling
you to make changes to your httpd.conf file. If for any reason your
installation experience is not the same, please do tell me.

You can then proceed to testing your installation as described in the
documentation :


It's perfectly normal that "from mod_python import apache" fails at
the python prompt. The _apache module is a special module which is
dynamically created by the mod_python.so Apache module. This means
that importing _apache is only possible within the context of the
interpreters running in Apache, and that the module will not be found
with the standard Python interpreter. This kind of import test is not
the proper way to test your setup, please read the documentation
mentioned above on this subject.

Now, I must say that the windows setup experience is not the best of
all, and that documentation should be written. We will work on that.


Nicolas Lehuen

More information about the Mod_python mailing list