GrahamDumpleton / mod_wsgi

Source code for Apache/mod_wsgi.
Apache License 2.0
1.02k stars 268 forks source link

Failed to load wsgi_module ): symbol not found in flat namespace '_PyBool_Type' #888

Open ranajah opened 2 weeks ago

ranajah commented 2 weeks ago

I installed mod_wsgi on Mac system by

cd /Users/gringotts/Downloads/mod_wsgi ./configure --with-python=/usr/local/bin/python --with-apxs=/opt/homebrew/Cellar/httpd/2.4.59/bin/apxs make sudo make install

then I added LoadModule wsgi_module /opt/homebrew/lib/httpd/modules/mod_wsgi.so to the http.conf file sudo /opt/homebrew/bin/apachectl -k restart gives below error

httpd: Syntax error on line 183 of /opt/homebrew/etc/httpd/httpd.conf: Cannot load /opt/homebrew/lib/httpd/modules/mod_wsgi.so into server: dlopen(/opt/homebrew/lib/httpd/modules/mod_wsgi.so, 0x000A): symbol not found in flat namespace '_PyBool_Type'

GrahamDumpleton commented 2 weeks ago

Where did you get your Python installation from? Python 3 should not be python, but python3. Are you sure you are using normal python3 from Homebrew?

ranajah commented 2 weeks ago

our flask application is with python 2 unfortunately.

ranajah commented 2 weeks ago

Does wsgi_module work with python2?

GrahamDumpleton commented 2 weeks ago

It isn't tested with Python 2.7 anymore, but may still work as no changes have been made yet that breaks Python 2.7 compatibility.

The error you are having is more to do with how your Python installation was built. That reference to "flat namespace" indicates it may have been built to use macOS library frameworks rather than more library library archives. The framework based builds of Python sometimes don't work properly for embedding.

What distro is that Python 2.X version from?

ranajah commented 2 weeks ago

It is the python came with OSX Python 2.7.13 (default, Apr 4 2017, 08:47:57) [GCC 4.2.1 Compatible Apple LLVM 8.1.0 (clang-802.0.38)] on darwin Type "help", "copyright", "credits" or "license" for more information.

GrahamDumpleton commented 2 weeks ago

From memory, for the last macOS versions that supplied Python 2.7, that old cut down version of Python 2.7 Apple supplied did not work for embedded systems.

Is there a reason you cannot use the last Python 2.7 distribution from the Python Software Foundation.

https://www.python.org/downloads/release/python-2718/