skip to Main Content

I have apache 2.4 installed (64 bit), python 3.7 (64 bit) (installed from Anaconda, if that matters) and VS 2019 C++ build tools, with the SDK and everything else required to build this checked. I still cannot build mod_wsgi with pip install. How can I get this to work on Windows 10?

I have tried uninstalling and reinstalling, python, visual studio & visual studio build tools, and apache. I have tried all the various visual studio command prompts. I have checked stack overflow, github, and other sites. There were others with similar issues but the solution of installing build tools did not work for me because a.) I already had it, b.) I reinstalled everything and it still didn’t work.

pip install mod_wsgi

Resulting error message:

Collecting mod_wsgi
  Using cached https://files.pythonhosted.org/packages/26/03/a3ed5abc2e66c82c40b0735c2f819c898d136879b00be4f5537126b6a4a4/mod_wsgi-4.6.7.tar.gz
Building wheels for collected packages: mod-wsgi
  Building wheel for mod-wsgi (setup.py) ... error
  ERROR: Complete output from command 'C:UsersVC046230AppDataLocalContinuumanaconda3python.exe' -u -c 'import setuptools, tokenize;__file__='"'"'C:\Users\VC046230\AppData\Local\Temp\pip-install-12r9v42f\mod-wsgi\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'rn'"'"', '"'"'n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:UsersVC046230AppDataLocalTemppip-wheel-1q_bver8' --python-tag cp37:
  ERROR: C:UsersVC046230AppDataLocalContinuumanaconda3libdistutilsdist.py:274: UserWarning: Unknown distribution option: 'bugtrack_url'
    warnings.warn(msg)
  running bdist_wheel
  running build
  running build_py
  creating build
  creating buildlib.win-amd64-3.7
  creating buildlib.win-amd64-3.7mod_wsgi
  copying src__init__.py -> buildlib.win-amd64-3.7mod_wsgi
  creating buildlib.win-amd64-3.7mod_wsgiserver
  copying srcserverapxs_config.py -> buildlib.win-amd64-3.7mod_wsgiserver
  copying srcserverenviron.py -> buildlib.win-amd64-3.7mod_wsgiserver
  copying srcserver__init__.py -> buildlib.win-amd64-3.7mod_wsgiserver
  creating buildlib.win-amd64-3.7mod_wsgiservermanagement
  copying srcservermanagement__init__.py -> buildlib.win-amd64-3.7mod_wsgiservermanagement
  creating buildlib.win-amd64-3.7mod_wsgiservermanagementcommands
  copying srcservermanagementcommandsrunmodwsgi.py -> buildlib.win-amd64-3.7mod_wsgiservermanagementcommands
  copying srcservermanagementcommands__init__.py -> buildlib.win-amd64-3.7mod_wsgiservermanagementcommands
  creating buildlib.win-amd64-3.7mod_wsgidocs
  copying docs_buildhtml__init__.py -> buildlib.win-amd64-3.7mod_wsgidocs
  creating buildlib.win-amd64-3.7mod_wsgiimages
  copying images__init__.py -> buildlib.win-amd64-3.7mod_wsgiimages
  copying imagessnake-whiskey.jpg -> buildlib.win-amd64-3.7mod_wsgiimages
  running build_ext
  building 'mod_wsgi.server.mod_wsgi' extension
  creating buildtemp.win-amd64-3.7
  creating buildtemp.win-amd64-3.7Release
  creating buildtemp.win-amd64-3.7Releasesrc
  creating buildtemp.win-amd64-3.7Releasesrcserver
  C:Program Files (x86)Microsoft Visual Studio2019BuildToolsVCToolsMSVC14.23.28105binHostX86x64cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MT -Ic:Apache24/include -IC:UsersVC046230AppDataLocalContinuumanaconda3include -IC:UsersVC046230AppDataLocalContinuumanaconda3include "-IC:Program Files (x86)Microsoft Visual Studio2019BuildToolsVCToolsMSVC14.23.28105include" /Tcsrc/servermod_wsgi.c /Fobuildtemp.win-amd64-3.7Releasesrc/servermod_wsgi.obj
  mod_wsgi.c
  C:UsersVC046230AppDataLocalTemppip-install-12r9v42fmod-wsgisrcserverwsgi_apache.h(39): fatal error C1083: Cannot open include file: 'ws2tcpip.h': No such file or directory
  error: command 'C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.23.28105\bin\HostX86\x64\cl.exe' failed with exit status 2
  ----------------------------------------
  ERROR: Failed building wheel for mod-wsgi

2

Answers


  1. I just solved the same problem. My config is Windows 10, Python 3.8.1, Apache2.4.39-Win64-VC15-OpenSSL1.1.1b, mod-wsgi 4.7.1.

    1) I installed using Build Tools

    • Visual Studio Build Tools Main Components
    • SDK for Windows 10 (10.0.18362.0) since I’m using Windows 10
    • MSVC 140 – C++ VS 2015 (v.14.00)

    2) Then I added C:Program Files (x86)Microsoft Visual Studio 14.0VCbin to PATH

    3) Then I got the next error:

    'apr_perms_set.h': No such file or directory'.
    

    I downloaded the file and put it into $APACHE_DIRinclude

    4) Then I got third error:

    fatal error LNK1158: cannot run ‘rc.exe’.
    error: command 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\link.exe' failed with exit status 1158
    

    I took following files rc.exe rcdll.dll from C:Program Files (x86)Windows Kits10bin10.0.18362.0×86 and paste them into C:Program Files (x86)Microsoft Visual Studio 14.0VCbin

    5) Congratulations!

    Login or Signup to reply.
  2. To anyone who had this issue, the following github issue helped me resolve it: https://github.com/GrahamDumpleton/mod_wsgi/issues/194

    I had already installed Visual C++ Redistributable, so I was confused why pip install mod_wsgi still was not working.

    All I ended up having to do was install Windows 10 SDK from https://developer.microsoft.com/en-us/windows/downloads/sdk-archive/

    (might also need 8.1 if it still does not work)

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search