Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to build mod_wsgi using pip method on Fedora 38 workstation & RPM package #840

Open
SomeAB opened this issue Jun 5, 2023 · 4 comments

Comments

@SomeAB
Copy link

SomeAB commented Jun 5, 2023

Okay I'm trying to install mod_wsgi using pip method inside my virtual environment

what I have done:

  • install httpd and httpd-devel both using dnf
  • inside venv, install wheel and setuptools latest versions
  • restart httpd service

also, since I'm on Fedora 38, I could just install mod_wsgi via dnf
sudo dnf install mod_wsgi -y

My question is whether the RPM package I installed for now, good enough for use with Django (what additional steps I have to be careful about here?)

my current error reads as follows:

pip install mod_wsgi --use-pep517
Collecting mod_wsgi
  Using cached mod_wsgi-4.9.4.tar.gz (497 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: mod_wsgi
  Building wheel for mod_wsgi (pyproject.toml) ... error
  error: subprocess-exited-with-error
 
  × Building wheel for mod_wsgi (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [33 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.linux-x86_64-cpython-311
      creating build/lib.linux-x86_64-cpython-311/mod_wsgi
      copying src/__init__.py -> build/lib.linux-x86_64-cpython-311/mod_wsgi
      creating build/lib.linux-x86_64-cpython-311/mod_wsgi/server
      copying src/server/apxs_config.py -> build/lib.linux-x86_64-cpython-311/mod_wsgi/server
      copying src/server/environ.py -> build/lib.linux-x86_64-cpython-311/mod_wsgi/server
      copying src/server/__init__.py -> build/lib.linux-x86_64-cpython-311/mod_wsgi/server
      creating build/lib.linux-x86_64-cpython-311/mod_wsgi/server/management
      copying src/server/management/__init__.py -> build/lib.linux-x86_64-cpython-311/mod_wsgi/server/management
      creating build/lib.linux-x86_64-cpython-311/mod_wsgi/server/management/commands
      copying src/server/management/commands/runmodwsgi.py -> build/lib.linux-x86_64-cpython-311/mod_wsgi/server/management/commands
      copying src/server/management/commands/__init__.py -> build/lib.linux-x86_64-cpython-311/mod_wsgi/server/management/commands
      creating build/lib.linux-x86_64-cpython-311/mod_wsgi/docs
      copying docs/_build/html/__init__.py -> build/lib.linux-x86_64-cpython-311/mod_wsgi/docs
      creating build/lib.linux-x86_64-cpython-311/mod_wsgi/images
      copying images/__init__.py -> build/lib.linux-x86_64-cpython-311/mod_wsgi/images
      copying images/snake-whiskey.jpg -> build/lib.linux-x86_64-cpython-311/mod_wsgi/images
      running build_ext
      building 'mod_wsgi.server.mod_wsgi-py311' extension
      creating build/temp.linux-x86_64-cpython-311
      creating build/temp.linux-x86_64-cpython-311/src
      creating build/temp.linux-x86_64-cpython-311/src/server
      gcc -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I/usr/include/httpd -I/home/someab/Desktop/Project_01/pyenv_01/include -I/usr/include/python3.11 -c src/server/mod_wsgi.c -o build/temp.linux-x86_64-cpython-311/src/server/mod_wsgi.o -I/usr/include/httpd -I. -I/usr/include/apr-1 -DLINUX -D_REENTRANT -D_GNU_SOURCE -O2 -g -Wall -I/usr/include/apr-1 -I/usr/include/apr-1
      In file included from src/server/mod_wsgi.c:22:
      src/server/wsgi_python.h:26:10: fatal error: Python.h: No such file or directory
         26 | #include <Python.h>
            |          ^~~~~~~~~~
      compilation terminated.
      error: command '/usr/bin/gcc' failed with exit code 1
      [end of output]
 
  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
@GrahamDumpleton
Copy link
Owner

You don't have the Python development package installed. It needs to be installed before you can install any Python package that has a C extension component. From memory it is called python3-devel on Fedora.

Can't comment on Fedora package for mod_wsgi. Using pip install method does get you mod_wsgi-express which is better used when doing development of your project as is easier to run.

@orangbilangciperipampam

from the log you don't have installed python development tools
instal it using this command dnf install python3-devel

and try again

@SomeAB
Copy link
Author

SomeAB commented Jun 16, 2023

Ok, I will try it out today or tomorrow, and comment back

@SomeAB
Copy link
Author

SomeAB commented Jun 18, 2023

Okay it seems to work @GrahamDumpleton.

There are few closing comments I want to make, feel free to close this issue afterwards.

  • The issue stems from the fact that python3-devel being a requirement isn't written either in Fedora's documentation, nor on Pypi (it briefly mentions it in general, without package name), nor the Readme Overview of this repo. If it is written, please point me, because I couldn't find it. I propose it be made a bit clearer.

If you are running RHEL, CentOS or Fedora, you would need both:

httpd
httpd-devel

I propose it being added in this section atleast here on Github Overview.

However this too doesn't mention python3-devel, nor mod-wsgi. I'm assuming it install Django without mod-wsgi, and fails to inform about that. Just mentioning it, I'm adding a Edit request there as well.

  • Thirdly, when I successfully install mod-wsgi under my python venv, I get the following warning:

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 behavior change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559

Which can be avoided, if one does pip install wheel before installing mod_wsgi in venv (pip install mod_wsgi).

I guess that can be added in list of dependencies? Or just fairly mentioned in the Overview.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants