0

I can't install WSGI for Python. I have tried lots of things.
I have installed the latest versions of pip, python, apache, setuptools. I can't understand why WSGI is not installing I have started learning python a few days ago on my own. I have watched lots of videos and i've read lots of informations in different forums. But i couldn't solve this problem Maybe i'm doing something wrong

D:\It\Console2>pip install mod_wsgi
Collecting mod_wsgi
  Using cached mod_wsgi-4.7.1.tar.gz (498 kB)
Building wheels for collected packages: mod-wsgi
  Building wheel for mod-wsgi (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: 'd:\it\python\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\TheFlash\\AppData\\Local\\Temp\\pip-install-ih8ke_\\mod-wsgi\\setup.py'"'"'; __file__='"'"'C:\\Users\\TheFlash\\AppData\\Local\\Temp\\pip-install-55ih8ke_\\mod-wsgi\\setup.py'"'"';f=getattr(tokeniz '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheeld 'C:\Users\TheFlash\AppData\Local\Temp\pip-wheel-xh383iwl'
       cwd: C:\Users\TheFlash\AppData\Local\Temp\pip-install-55ih8ke_\mod-wsgi\
  Complete output (33 lines):
  d:\it\python\lib\distutils\dist.py:261: UserWarning: Unknown distribution option: 'bugtrack_url'
    warnings.warn(msg)
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build\lib.win-amd64-3.6
  creating build\lib.win-amd64-3.6\mod_wsgi
  copying src\__init__.py -> build\lib.win-amd64-3.6\mod_wsgi
  creating build\lib.win-amd64-3.6\mod_wsgi\server
  copying src\server\apxs_config.py -> build\lib.win-amd64-3.6\mod_wsgi\server
  copying src\server\environ.py -> build\lib.win-amd64-3.6\mod_wsgi\server
  copying src\server\__init__.py -> build\lib.win-amd64-3.6\mod_wsgi\server
  creating build\lib.win-amd64-3.6\mod_wsgi\server\management
  copying src\server\management\__init__.py -> build\lib.win-amd64-3.6\mod_wsgi\server\management
  creating build\lib.win-amd64-3.6\mod_wsgi\server\management\commands
  copying src\server\management\commands\runmodwsgi.py -> build\lib.win-amd64-3.6\mod_wsgi\server\management\commands
  copying src\server\management\commands\__init__.py -> build\lib.win-amd64-3.6\mod_wsgi\server\management\commands
  creating build\lib.win-amd64-3.6\mod_wsgi\docs
  copying docs\_build\html\__init__.py -> build\lib.win-amd64-3.6\mod_wsgi\docs
  creating build\lib.win-amd64-3.6\mod_wsgi\images
  copying images\__init__.py -> build\lib.win-amd64-3.6\mod_wsgi\images
  copying images\snake-whiskey.jpg -> build\lib.win-amd64-3.6\mod_wsgi\images
  running build_ext
  building 'mod_wsgi.server.mod_wsgi' extension
  creating build\temp.win-amd64-3.6
  creating build\temp.win-amd64-3.6\Release
  creating build\temp.win-amd64-3.6\Release\src
  creating build\temp.win-amd64-3.6\Release\src\server
  C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.25.28610\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -IDIt\Apache/include -Id:\it\python\include -Id:\it\python\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.25.286\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared" "-I\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt" "-IC:\Program Files (6)\Windows Kits\10\include\10.0.18362.0\cppwinrt" /Tcsrc/server\mod_wsgi.c /Fobuild\temp.win-amd64-3.6\Release\src/server\mod_wsgi.obj
  mod_wsgi.c
  C:\Users\TheFlash\AppData\Local\Temp\pip-install-55ih8ke_\mod-wsgi\src\server\wsgi_apache.h(42): fatal error C1083: ?? г¤ ?вбп RвЄалвм д c< ўЄ<оз?-Ё?:
tpd.h: No such file or directory,
  error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.25.28610\\bin\\HostX86\\x64\\cl.exe' failed witexit status 2
  ----------------------------------------
  ERROR: Failed building wheel for mod-wsgi
  Running setup.py clean for mod-wsgi
Failed to build mod-wsgi
Installing collected packages: mod-wsgi
    Running setup.py install for mod-wsgi ... error
    ERROR: Command errored out with exit status 1:
     command: 'd:\it\python\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\TheFlash\\AppData\\Local\\Temp\\pip-instal55ih8ke_\\mod-wsgi\\setup.py'"'"'; __file__='"'"'C:\\Users\\TheFlash\\AppData\\Local\\Temp\\pip-install-55ih8ke_\\mod-wsgi\\setup.py'"'"';f=getattr(tokene, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install -ecord 'C:\Users\TheFlash\AppData\Local\Temp\pip-record-vqudmtwm\install-record.txt' --single-version-externally-managed --compile --install-headers 'd:\ipython\Include\mod-wsgi'
         cwd: C:\Users\TheFlash\AppData\Local\Temp\pip-install-55ih8ke_\mod-wsgi\
    Complete output (33 lines):
    d:\it\python\lib\distutils\dist.py:261: UserWarning: Unknown distribution option: 'bugtrack_url'
      warnings.warn(msg)
    running install
    running build
    running build_py
    creating build
    creating build\lib.win-amd64-3.6
    creating build\lib.win-amd64-3.6\mod_wsgi
    copying src\__init__.py -> build\lib.win-amd64-3.6\mod_wsgi
    creating build\lib.win-amd64-3.6\mod_wsgi\server
    copying src\server\apxs_config.py -> build\lib.win-amd64-3.6\mod_wsgi\server
    copying src\server\environ.py -> build\lib.win-amd64-3.6\mod_wsgi\server
    copying src\server\__init__.py -> build\lib.win-amd64-3.6\mod_wsgi\server
    creating build\lib.win-amd64-3.6\mod_wsgi\server\management
    copying src\server\management\__init__.py -> build\lib.win-amd64-3.6\mod_wsgi\server\management
    creating build\lib.win-amd64-3.6\mod_wsgi\server\management\commands
    copying src\server\management\commands\runmodwsgi.py -> build\lib.win-amd64-3.6\mod_wsgi\server\management\commands
    copying src\server\management\commands\__init__.py -> build\lib.win-amd64-3.6\mod_wsgi\server\management\commands
    creating build\lib.win-amd64-3.6\mod_wsgi\docs
    copying docs\_build\html\__init__.py -> build\lib.win-amd64-3.6\mod_wsgi\docs
    creating build\lib.win-amd64-3.6\mod_wsgi\images
    copying images\__init__.py -> build\lib.win-amd64-3.6\mod_wsgi\images
    copying images\snake-whiskey.jpg -> build\lib.win-amd64-3.6\mod_wsgi\images
    running build_ext
    building 'mod_wsgi.server.mod_wsgi' extension
    creating build\temp.win-amd64-3.6
    creating build\temp.win-amd64-3.6\Release
    creating build\temp.win-amd64-3.6\Release\src
    creating build\temp.win-amd64-3.6\Release\src\server
    C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.25.28610\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -:\It\Apache/include -Id:\it\python\include -Id:\it\python\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.25.210\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared" "C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt" "-IC:\Program Filesx86)\Windows Kits\10\include\10.0.18362.0\cppwinrt" /Tcsrc/server\mod_wsgi.c /Fobuild\temp.win-amd64-3.6\Release\src/server\mod_wsgi.obj
    mod_wsgi.c
    C:\Users\TheFlash\AppData\Local\Temp\pip-install-55ih8ke_\mod-wsgi\src\server\wsgi_apache.h(42): fatal error C1083: ?? г¤ ?вбп RвЄалвм д c< ўЄ<оз?-Ё?httpd.h: No such file or directory,
    error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.25.28610\\bin\\HostX86\\x64\\cl.exe' failed wh exit status 2
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'd:\it\python\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\TheFlash\ppData\\Local\\Temp\\pip-install-55ih8ke_\\mod-wsgi\\setup.py'"'"'; __file__='"'"'C:\\Users\\TheFlash\\AppData\\Local\\Temp\\pip-install-55ih8ke_\\mod-ws\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __fi__, '"'"'exec'"'"'))' install --record 'C:\Users\TheFlash\AppData\Local\Temp\pip-record-vqudmtwm\install-record.txt' --single-version-externally-managed
compile --install-headers 'd:\it\python\Include\mod-wsgi' Check the logs for full command output.
User85619
  • 19
  • 5

2 Answers2

0

If pip install mod_wsgi-binary is not working. Then try to download this from source instead of pip. Download from the given link by following the instructions in readme file.

Nimra Tahir
  • 391
  • 1
  • 6
-1

EDIT:

You might be able to find your solution from this answer

Here are steps that I took:

Install python x64 (may need to double check you downloaded the right one for your OS)

Install pip

Install Apache

Moved the extracted Apache24 folder to C:\

Set the env variable for apache with set "MOD_WSGI_APACHE_ROOTDIR=C:\Apache24"

Install Microsoft C++ build tools

Restart machine

Run pip install mod_wsgi

sharif
  • 34
  • 2
  • they are clearly present, as you can see in the error message – FlyingTeller May 11 '20 at 19:19
  • Can you point out what part of the error message references them being present? Not trying to be snarky, I'd genuinely like to know. – sharif May 11 '20 at 19:27
  • 1
    It finds the exe to be `C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.25.28610\bin\HostX86\x64\cl.exe` and runs commands with it and get's an error message that can only come from the compilation, i.e. it is not able to find some header file `C:\Users\TheFlash\AppData\Local\Temp\pip-install-55ih8ke_\mod-wsgi\src\server\wsgi_apache.h(42): fatal error C1083: ?? г¤ ?вбп RвЄалвм д c< ўЄ<оз?-Ё?: tpd.h: No such file or directory` – FlyingTeller May 11 '20 at 20:16
  • 1
    But since it is missing the `apache` header, your new instructions that include the step to install apache might solve the issue – FlyingTeller May 11 '20 at 20:17
  • I have done all your instructions. But now i have another error – Rustam Tashmatov May 12 '20 at 11:20
  • `C:\Apache24\include\apr_network_io.h(29): fatal error C1083: ?? г¤ ?вбп RвЄа лвм д c< ўЄ<оз?-Ё?: apr_perms_set.h: No such file or directory,` I don't know what to do with this – Rustam Tashmatov May 12 '20 at 11:25
  • `Command errored out with exit status 1: 'd:\it\python\python.exe' -u -c ' import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\TheFlash\\AppDat a\\Local\\Temp\\pip-install-3mi5wumg\\mod-wsgi\\setup.py'"'"'; __file__='"'"'C:\ \Users\\TheFlash\\AppData\\Local\\Temp\\pip-install-3mi5wumg\\mod-wsgi\\setup.py '"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace( '"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'" '"'))' install --record(it"s not the end)` – Rustam Tashmatov May 12 '20 at 11:29
  • `'C:\Users\TheFlash\AppData\Local\Temp\pip-record-fat3167 _\install-record.txt' --single-version-externally-managed --compile --install-he aders 'd:\it\python\Include\mod-wsgi` That's the whole error – Rustam Tashmatov May 12 '20 at 11:30
  • I have installed Apache Lounge but it didn't help. Then I've installed Apache Haus and it's now on my machine. My OS is WIndows 7 SP1 Python 3.8 – Rustam Tashmatov May 12 '20 at 11:33
  • Maybe try `set "MOD_WSGI_APACHE_ROOTDIR=C:/Apache24"` Instead of `set "MOD_WSGI_APACHE_ROOTDIR=C:\Apache24"` (forward slash instead of back slash). [This post](https://stackoverflow.com/questions/42298503/how-to-install-mod-wsgi-for-apache-2-4-and-python-3-4-on-windows/42307082#42307082) may be useful – sharif May 12 '20 at 19:08