Testing installation of mod_wsgi on Windows.

1,727 views
Skip to first unread message

Graham Dumpleton

unread,
Nov 27, 2016, 8:21:47 PM11/27/16
to mod...@googlegroups.com
Do I still have any users left out there still using Windows?

I have an easier way of installing mod_wsgi on Windows that I need others to test in different setups. If you can help that would be great.

Requirements are that you have Apache 2.4 installed in the ‘C:/Apache24’ directory. That you have appropriate Microsoft C++ compiler installed for your Python version such that you can pip install Python packages which have C extension components. That your Python installation is installed for all users if running Apache as a service.

I am going to assume you are all knowledgable enough about Windows to know what you need to do to get pip installed, as well as use Python virtual environments to avoid installing in main Python installation if security execution policies make life difficult for you. Whatever you do know, it is still probably going to be more than what I know about Windows.

If you think you are all good to go, then simply run:


If this succeeds, run:

    mod_wsgi-express module-config

This should output some Apache configuration to put in your httpd.conf file to load mod_wsgi and tell it where the Python DLL is and where your Python installation or virtual environment is. Use this in place of what you might already have for the LoadModule directive for wsgi_module.

Configure Apache to setup your WSGI application as you would normally do and restart Apache.

So does it work or does it break?

I have tested this with Python 3.5 and Apache 2.4 (VC14 64 bit version) from apachelounge.com.

Technically it could work for older Python versions but I am not going to try myself as I don’t want to go through the trouble of installing older Python versions. So if you have older Python versions, let me know.

If pip fails on installation, what error do you get?

If Apache fails to start, what does ‘mod_wsgi-express module-config’ generate?

Thanks.

Graham

Graham Dumpleton

unread,
Nov 29, 2016, 12:56:33 AM11/29/16
to mod...@googlegroups.com
No takers?

If anyone does eventually try it, you can now do it as:

    pip install mod_wsgi

as have released changes in mod_wsgi version 4.5.8.

Graham

Stuart

unread,
Jan 15, 2017, 12:57:04 PM1/15/17
to modwsgi
Hi Graham,

I am using Apache 2.4 (installed in C:\Apache24, 32-bit running as a service), Python 3.6 (32-bit), VC10, running on 64-bit Windows 10.
I followed your instructions (I think) and the output was as follows (truncated):

(env) pip install mod_wsgi
Collecting mod_wsgi
  Using cached mod_wsgi-4.5.13.tar.gz
Building wheels for collected packages: mod-wsgi
  Running setup.py bdist_wheel for mod-wsgi ... error
  Complete output from command c:\users\stuart\\env\scripts\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\stuart\\AppData\\Local\\Temp\\pip-build-wbqil05d\\mod-wsgi\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d C:\Users\stuart\AppData\Local\Temp\tmpxo3oabeypip-wheel- --python-tag cp36:
  c:\users\stuart\appdata\local\programs\python\python36-32\Lib\distutils\dist.py:261: UserWarning: Unknown distribution option: 'bugtrack_url'

...

 running build_ext
  building 'mod_wsgi.server.mod_wsgi' extension
  error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": http://landinghub.visualstudio.com/visual-cpp-build-tools

  ----------------------------------------
  Failed building wheel for mod-wsgi
  Running setup.py clean for mod-wsgi
Failed to build mod-wsgi

I had previously made sure I had VC10 binaries as per a previous post of yours. Does this make sense?

Stuart

Graham Dumpleton

unread,
Jan 15, 2017, 6:35:49 PM1/15/17
to mod...@googlegroups.com
On 16 Jan 2017, at 1:54 AM, Stuart <stuart....@gmail.com> wrote:

Hi Graham,

I am using Apache 2.4 (installed in C:\Apache24, 32-bit running as a service), Python 3.6 (32-bit), VC10, running on 64-bit Windows 10.
I followed your instructions (I think) and the output was as follows (truncated):

(env) pip install mod_wsgi
Collecting mod_wsgi
  Using cached mod_wsgi-4.5.13.tar.gz
Building wheels for collected packages: mod-wsgi
  Running setup.py bdist_wheel for mod-wsgi ... error
  Complete output from command c:\users\stuart\\env\scripts\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\stuart\\AppData\\Local\\Temp\\pip-build-wbqil05d\\mod-wsgi\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d C:\Users\stuart\AppData\Local\Temp\tmpxo3oabeypip-wheel- --python-tag cp36:
  c:\users\stuart\appdata\local\programs\python\python36-32\Lib\distutils\dist.py:261: UserWarning: Unknown distribution option: 'bugtrack_url'

...

 running build_ext
  building 'mod_wsgi.server.mod_wsgi' extension
  error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": http://landinghub.visualstudio.com/visual-cpp-build-tools

  ----------------------------------------
  Failed building wheel for mod-wsgi
  Running setup.py clean for mod-wsgi
Failed to build mod-wsgi

I had previously made sure I had VC10 binaries as per a previous post of yours. Does this make sense

It is thinking you don't have it installed. All I can say is that you need to have compiler link from:


installed.

Is there a specific reason you are using 32 bit vs 64 bit? Using 64bit would generally be better.

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 modwsgi+u...@googlegroups.com.
To post to this group, send email to mod...@googlegroups.com.
Visit this group at https://groups.google.com/group/modwsgi.
For more options, visit https://groups.google.com/d/optout.

Michael Gonzalez

unread,
Mar 14, 2017, 9:51:38 AM3/14/17
to modwsgi
I can confirm that the "hello world" test described here works using "pip install mod_wsgi" with the following configuration:

Windows Server 2016 (64 bit)
Apache Lounge VC14 Server built: Dec 17 2016 11:15:57
Python 3.6 (64 bit)

From the Apache error log:

AH00455: Apache/2.4.25 (Win64) mod_wsgi/4.5.15 Python/3.6 configured -- resuming normal operations

A few notes of things I ran into as a complete beginner:
  • Orginally (before I came across this thread) I was searching for the .so file to use with the LoadModule directive, I thought this may have been output when the mod_wsgi package was installed, maybe this could be clarified in the docs / console output. (or maybe I can't read, haha)
  • I ran into a "403 Forbidden" when testing the "Hello World" example, the access control directives are different for Apache 2.4 as described here. So I changed "Order allow,deny / Allow from All" to "Require all granted"

Tom Graham

unread,
Mar 15, 2017, 11:28:07 AM3/15/17
to modwsgi
You don't know how long I spent to 1) find mod_wsgi.so and 2) find this thread
For me it is:
 LoadModule wsgi_module "c:/python36/lib/site-packages/mod_wsgi/server/mod_wsgi.cp36-win32.pyd"
Reply all
Reply to author
Forward
0 new messages