Error: Running setup.py install for mod-wsgi ... error
Hello, I am trying to install mod-wsgi in a virtual environment using pip install mod-wsgi but I am getting the following error:
Installing collected packages: mod-wsgi DEPRECATION: mod-wsgi is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559 Running setup.py install for mod-wsgi ... error error: subprocess-exited-with-error
× Running setup.py install for mod-wsgi did not run successfully. │ exit code: 1 ╰─> [334 lines of output]
....
note: This error originates from a subprocess, and is likely not a problem with pip. error: legacy-install-failure
× Encountered error while trying to install package. ╰─> mod-wsgi
note: This is an issue with the package mentioned above, not pip.
OS: windows 11 mod_wsgi version: 4.9.4
Thank you in advance for your consideration and help. Best regards
Ensure you have latest pip installed. I believe there was an issue with one version on Windows that caused this.
It is the latest version (23.0.1).
Try using one of more -v options to pip then to try and coax it to give more detailed log output so can see where problem comes from.
I tried different versions of mod_wsgi (4.6.7, 4.9.1 - 4.9.3) and also tried to install them using a different pip version but I am still getting the same error.
These are the error messages and hint being pointed out: (1)
Installing collected packages: mod-wsgi DEPRECATION: mod-wsgi is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559 Running setup.py install for mod-wsgi ... error error: subprocess-exited-with-error
× Running setup.py install for mod-wsgi did not run successfully. │ exit code: 1 ╰─> [37 lines of output]
(2)
C:\Users\testuser\AppData\Local\Temp\pip-install-4t5w6pjg\mod-wsgi_3fc90f010c19446c958fdae46f671ac2\src\server\wsgi_python.h(44): fatal error C1083: Cannot open include file: 'node.h': No such file or directory error: command 'C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\bin\HostX86\x86\cl.exe' failed with exit code 2 [end of output]
(3)
note: This error originates from a subprocess, and is likely not a problem with pip. error: legacy-install-failure
I also tried to run this command as indicated pip install mod-wsgi==4.9.3 --use-pep517 but I got this result:
note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for mod-wsgi Failed to build mod-wsgi ERROR: Could not build wheels for mod-wsgi, which is required to install pyproject.toml-based projects
The error:
C:\Users\testuser\AppData\Local\Temp\pip-install-4t5w6pjg\mod-wsgi_3fc90f010c19446c958fdae46f671ac2\src\server\wsgi_python.h(44): fatal error C1083: Cannot open include file: 'node.h': No such file or directory
would only come up if you are using mod_wsgi version < 4.9.0. Older versions do not support Python 3.10.
I need to see relevant part of errors (pip install -v -v mod_wsgi) when using latest mod_wsgi. Don't use --use-pep517.
Command run: pip install -v -v mod_wsgi
Anomalies encountered: (1)
"C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\bin\HostX86\x86\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -IC:/xampp/apache/include -IC:\Users\testuser\Desktop\code_main\web_application\web_application\env2\include -IC:\Python310\include -IC:\Python310\Include "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\include" "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\ATLMFC\include" "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\cppwinrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\include" "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\ATLMFC\include" "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\cppwinrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" /Tcsrc/server\mod_wsgi.c /Fobuild\temp.win32-cpython-310\Release\src/server\mod_wsgi.obj mod_wsgi.c C:\Python310\include\pyconfig.h(300): warning C4005: 'PLATFORM': macro redefinition C:\xampp\apache\include\os.h(44): note: see previous definition of 'PLATFORM' src/server\mod_wsgi.c(1331): warning C4244: 'function': conversion from '__int64' to 'Py_ssize_t', possible loss of data src/server\mod_wsgi.c(1343): warning C4244: 'function': conversion from 'apr_off_t' to 'size_t', possible loss of data src/server\mod_wsgi.c(1349): warning C4244: 'function': conversion from 'apr_off_t' to 'size_t', possible loss of data src/server\mod_wsgi.c(1366): warning C4244: 'function': conversion from 'apr_off_t' to 'apr_size_t', possible loss of data src/server\mod_wsgi.c(1390): warning C4244: 'function': conversion from 'apr_off_t' to 'Py_ssize_t', possible loss of data src/server\mod_wsgi.c(1431): warning C4244: 'function': conversion from '__int64' to 'Py_ssize_t', possible loss of data
" " " more of such prompts
(2)
"C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\bin\HostX86\x86\link.exe" /nologo /INCREMENTAL:NO /LTCG /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO /LIBPATH:C:\Users\testuser\Desktop\code_main\web_application\web_application\env2\libs /LIBPATH:C:\Python310\libs /LIBPATH:C:\Python310 /LIBPATH:C:\Users\testuser\Desktop\code_main\web_application\web_application\env2\PCbuild\win32 "/LIBPATH:C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\ATLMFC\lib\x86" "/LIBPATH:C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\lib\x86" "/LIBPATH:C:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\lib\um\x86" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.22621.0\ucrt\x86" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.22621.0\um\x86" "/LIBPATH:C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\ATLMFC\lib\x86" "/LIBPATH:C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\lib\x86" "/LIBPATH:C:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\lib\um\x86" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.22621.0\ucrt\x86" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.22621.0\um\x86" /EXPORT:PyInit_mod_wsgi build\temp.win32-cpython-310\Release\src/server\mod_wsgi.obj build\temp.win32-cpython-310\Release\src/server\wsgi_apache.obj build\temp.win32-cpython-310\Release\src/server\wsgi_buckets.obj build\temp.win32-cpython-310\Release\src/server\wsgi_convert.obj build\temp.win32-cpython-310\Release\src/server\wsgi_daemon.obj build\temp.win32-cpython-310\Release\src/server\wsgi_interp.obj build\temp.win32-cpython-310\Release\src/server\wsgi_logger.obj build\temp.win32-cpython-310\Release\src/server\wsgi_memory.obj build\temp.win32-cpython-310\Release\src/server\wsgi_metrics.obj build\temp.win32-cpython-310\Release\src/server\wsgi_restrict.obj build\temp.win32-cpython-310\Release\src/server\wsgi_server.obj build\temp.win32-cpython-310\Release\src/server\wsgi_stream.obj build\temp.win32-cpython-310\Release\src/server\wsgi_thread.obj build\temp.win32-cpython-310\Release\src/server\wsgi_validate.obj /OUT:build\lib.win32-cpython-310\mod_wsgi\server\mod_wsgi.cp310-win_amd64.pyd /IMPLIB:build\temp.win32-cpython-310\Release\src/server\mod_wsgi.cp310-win_amd64.lib C:\Python310/libs/python310.lib C:/xampp/apache/lib/libhttpd.lib C:/xampp/apache/lib/libapr-1.lib C:/xampp/apache/lib/libaprutil-1.lib C:/xampp/apache/lib/libapriconv-1.lib Creating library build\temp.win32-cpython-310\Release\src/server\mod_wsgi.cp310-win_amd64.lib and object build\temp.win32-cpython-310\Release\src/server\mod_wsgi.cp310-win_amd64.exp mod_wsgi.obj : error LNK2001: unresolved external symbol __imp__apr_brigade_flatten@12 mod_wsgi.obj : error LNK2001: unresolved external symbol __imp__apr_thread_mutex_create@12 mod_wsgi.obj : error LNK2001: unresolved external symbol __imp__apr_ipsubnet_test@8 mod_wsgi.obj : error LNK2001: unresolved external symbol __imp__apr_pool_cleanup_register@16 mod_wsgi.obj : error LNK2001: unresolved external symbol __imp__PyEval_ReleaseThread mod_wsgi.obj : error LNK2001: unresolved external symbol __imp__ap_md5@8 mod_wsgi.obj : error LNK2001: unresolved external symbol __imp__apr_time_now@0 mod_wsgi.obj : error LNK2001: unresolved external symbol __imp__apr_itoa@8 mod_wsgi.obj : error LNK2001: unresolved external symbol __imp__ap_get_server_banner@0
" " " more of such prompts
Error message:
error: command 'C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.35.32215\\bin\\HostX86\\x86\\link.exe' failed with exit code 1120
error: subprocess-exited-with-error
× Running setup.py install for mod_wsgi did not run successfully.
│ exit code: 1
╰─> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip.
full command: 'C:\Users\testuser\Desktop\code_main\web_application\web_application\env2\Scripts\python.exe' -u -c '
exec(compile('"'"''"'"''"'"'
# This is <pip-setuptools-caller> -- a caller that pip uses to run setup.py
#
# - It imports setuptools before invoking setup.py, to enable projects that directly
# import from `distutils.core` to work with newer packaging standards.
# - It provides a clear error message when setuptools is not installed.
# - It sets `sys.argv[0]` to the underlying `setup.py`, when invoking `setup.py` so
# setuptools doesn'"'"'t think the script is `-c`. This avoids the following warning:
# manifest_maker: standard file '"'"'-c'"'"' not found".
# - It generates a shim setup.py, for handling setup.cfg-only projects.
import os, sys, tokenize
try:
import setuptools
except ImportError as error:
print(
"ERROR: Can not execute `setup.py` since setuptools is not available in "
"the build environment.",
file=sys.stderr,
)
sys.exit(1)
__file__ = %r
sys.argv[0] = __file__
if os.path.exists(__file__):
filename = __file__
with tokenize.open(__file__) as f:
setup_py_code = f.read()
else:
filename = "<auto-generated setuptools caller>"
setup_py_code = "from setuptools import setup; setup()"
exec(compile(setup_py_code, filename, "exec"))
'"'"''"'"''"'"' % ('"'"'C:\\Users\\testuser\\AppData\\Local\\Temp\\pip-install-irb4kvua\\mod-wsgi_70da159e744c4e4ea2de4593abd505f6\\setup.py'"'"',), "<pip-setuptools-caller>", "exec"))' install --record 'C:\Users\testuser\AppData\Local\Temp\pip-record-of1qxd1x\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Users\testuser\Desktop\code_main\web_application\web_application\env2\include\site\python3.10\mod_wsgi'
cwd: C:\Users\testuser\AppData\Local\Temp\pip-install-irb4kvua\mod-wsgi_70da159e744c4e4ea2de4593abd505f6\
Running setup.py install for mod_wsgi ... error
error: legacy-install-failure
× Encountered error while trying to install package.
╰─> mod_wsgi
note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
Exception information:
Traceback (most recent call last):
File "C:\Users\testuser\Desktop\code_main\web_application\web_application\env2\lib\site-packages\pip\_internal\operations\install\legacy.py", line 97, in install
runner(
File "C:\Users\testuser\Desktop\code_main\web_application\web_application\env2\lib\site-packages\pip\_internal\utils\subprocess.py", line 252, in runner
call_subprocess(
File "C:\Users\testuser\Desktop\code_main\web_application\web_application\env2\lib\site-packages\pip\_internal\utils\subprocess.py", line 224, in call_subprocess
raise error
pip._internal.exceptions.InstallationSubprocessError: Running setup.py install for mod_wsgi exited with 1
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\testuser\Desktop\code_main\web_application\web_application\env2\lib\site-packages\pip\_internal\cli\base_command.py", line 160, in exc_logging_wrapper
status = run_func(*args)
File "C:\Users\testuser\Desktop\code_main\web_application\web_application\env2\lib\site-packages\pip\_internal\cli\req_command.py", line 247, in wrapper
return func(self, options, args)
File "C:\Users\testuser\Desktop\code_main\web_application\web_application\env2\lib\site-packages\pip\_internal\commands\install.py", line 507, in run
installed = install_given_reqs(
File "C:\Users\testuser\Desktop\code_main\web_application\web_application\env2\lib\site-packages\pip\_internal\req\__init__.py", line 73, in install_given_reqs
requirement.install(
File "C:\Users\testuser\Desktop\code_main\web_application\web_application\env2\lib\site-packages\pip\_internal\req\req_install.py", line 843, in install
raise exc
File "C:\Users\testuser\Desktop\code_main\web_application\web_application\env2\lib\site-packages\pip\_internal\req\req_install.py", line 825, in install
success = install_legacy(
File "C:\Users\testuser\Desktop\code_main\web_application\web_application\env2\lib\site-packages\pip\_internal\operations\install\legacy.py", line 109, in install
raise LegacyInstallFailure(package_details=req_name) from e
pip._internal.exceptions.LegacyInstallFailure: <LegacyInstallFailure: legacy-install-failure>
Remote version of pip: 23.0.1
Local version of pip: 23.0.1
Was pip installed by pip? True
Removed build tracker: 'C:\\Users\\testuser\\AppData\\Local\\Temp\\pip-build-tracker-akybnxm3'
Use Apache from ApacheLounge. The XAMPP distribution doesn't usually work. Never been able to work out whether their Apache libraries are broken, but trying to create third party Apache modules against fails at the time of linking, which is why you see the errors:
mod_wsgi.obj : error LNK2001: unresolved external symbol __imp__apr_brigade_flatten@12
...
That said, make sure you have both 64 bit Python and 64 bit Apache. The name win32-cpython-310 suggests you might only have 32 bit Python, which can't work with 64 bit Apache.