Uploaded image for project: 'mod_python'
  1. mod_python
  2. MODPYTHON-158

Improve Installation / Troubleshooting section in documentation

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 3.3.x
    • Fix Version/s: None
    • Component/s: documentation
    • Labels:
      None
    • Environment:
      All

      Description

      Some of the more commonly asked questions asked on the mailing list relate to mod_python configuration issues that are not currently covered in the documentation.

      Apache can't load mod_python.so
      ---------------------------------------------

      This more common problem on Windows, but can occur on other platforms. A typical apache error message looks like this:

      Syntax error on line 173 of C:/Program Files/Apache
      Group/Apache2/conf/httpd.conf:
      Cannot load C:/Program Files/Apache
      Group/Apache2/modules/mod_python.so into server: The
      specified module could not be found.

      On Windows this may indicate a problem with missing D
      Nicolas offered the following as an explanation on Windows:

      """
      One of the possible cause of your problem is that Apache does find
      mod_python.so but not one of the DLL it relies on. Unfortunately the error
      reporting in this case is quite scarce and misguiding.

      The candidates missing DLLs are python24.dll and the Microsoft Runtime DLLS
      (normally msvcr71.dll and msvcp71.dll).

      Make sure that your Python directory and the runtime DLLs can be found on
      your PATH. The runtime DLLs are normaly copied in your Python directory, so
      putting the Python directory on your PATH variable should do the trick.

      Also, make sure that the user which is running Apache has its PATH variable
      properly set. The best way to do this is to define it at the system-wide
      level, but logging it under the user and defining the variable at the user
      level is also possible.
      """

      Apache can't load mod_python.so - undefined symbol
      -----------------------------------------------------------------------

      This may look similar to the first example, but indicates a deeper problem. Typical error message:

      httpd: Syntax error on line 231 of /usr/local/apache2/conf/httpd.conf: Cannot load /usr/local/apache2/modules/mod_python.so into server: /usr/local/apache2/modules/mod_python.so: undefined symbol: apr_sockaddr_port_get

      This error could indicate an actual bug in mod_python, or a mismatch between the Apache version used to compile mod_python versus the one being used to run it. I'm not sure there is an easy answer, but we should offer some initial troubleshooting suggestions.

      make_obcallback: could not import mod_python.apache
      --------------------------------------------------------------------------

      This one seems to occur on all platforms with similar frequency, and is usually related to having python multiple versions on the same system. Typical error message:

      [Sun Apr 09 14:03:46 2006] [error] make_obcallback: could not import
      mod_python.apache.\n
      [Sun Apr 09 14:03:46 2006] [error] python_handler: no interpreter
      callback found.
      [Sun Apr 09 14:03:46 2006] [error] [client 192.168.2.100]
      python_handler: Can't get/create interpreter., referer:
      http://localhost/mptest.py

      The solution is to adjust that PATH apache uses so it finds the correct python version. This will be platform specific.

        Activity

        Hide
        grahamd Graham Dumpleton added a comment -

        I have checked into subversion some new code to support a better troubleshooting guide. The checks that the code does is as follows:

        1. On initialisation of mod_python, will compare the version string from the version of Python that mod_python was compiled against, with that which was found at runtime. If they differ, it will log error messages like:

        [Mon Apr 10 16:06:22 2006] [error] python_init: Python version mismatch, expected '2.3.4', found '2.3'.
        [Mon Apr 10 16:06:22 2006] [error] python_init: Python executable found '/usr/bin/python'.
        [Mon Apr 10 16:06:22 2006] [error] python_init: Python path being used '/Users/grahamd/lib/python:/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python23.zip:/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/:/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/plat-darwin:/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/plat-mac:/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/plat-mac/lib-scriptpackages:/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/lib-tk:/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/lib-dynload'.
        [Mon Apr 10 16:06:22 2006] [notice] mod_python: Creating 8 session mutexes based on 6 max processes and 25 max threads.
        [Mon Apr 10 16:06:22 2006] [notice] mod_python: using mutex_directory /tmp
        [Mon Apr 10 16:06:22 2006] [notice] Apache/2.0.55 (Unix) mod_python/3.3.0-dev-20060410 Python/2.3 configured – resuming normal operations

        2. When it goes to import "mod_python.apache" when a request is first received, if it cannot be found, it will dump out Python path that was used in the search:

        [Mon Apr 10 16:10:09 2006] [error] make_obcallback: could not import mod_python.apache.\n
        ImportError: No module named mod_python.apache
        [Mon Apr 10 16:10:09 2006] [error] make_obcallback: Python path being used "['/Users/grahamd/lib/python', '/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python23.zip', '/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3', '/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/plat-darwin', '/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/plat-mac', '/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/plat-mac/lib-scriptpackages', '/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/lib-tk', '/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/lib-dynload', '/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages', '/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/PIL', '/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/PyObjC', '/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/ZopePageTemplates', '/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/py2app', '/usr/local/src/reportlab_1_20', '/usr/local/src/trml2pdf', '/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/wx-2.6-mac-ansi']".
        [Mon Apr 10 16:10:09 2006] [error] get_interpreter: no interpreter callback found.
        [Mon Apr 10 16:10:09 2006] [error] [client 127.0.0.1] python_handler: Can't get/create interpreter.

        A similar error error is logged where "mod_python.apache" can be imported but an error occurred when doing so. This can happen when Apache module is 3.2+ and Python module code files are 2.7.X.

        [Mon Apr 10 16:13:15 2006] [error] make_obcallback: could not import mod_python.apache.\n
        Traceback (most recent call last):
        File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/mod_python/apache.py", line 616, in ?
        make_table = _apache.make_table
        AttributeError: 'module' object has no attribute 'make_table'
        [Mon Apr 10 16:13:15 2006] [error] make_obcallback: Python path being used "['/Users/grahamd/lib/python', '/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python23.zip', '/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3', '/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/plat-darwin', '/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/plat-mac', '/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/plat-mac/lib-scriptpackages', '/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/lib-tk', '/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/lib-dynload', '/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages', '/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/PIL', '/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/PyObjC', '/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/ZopePageTemplates', '/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/py2app', '/usr/local/src/reportlab_1_20', '/usr/local/src/trml2pdf', '/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/wx-2.6-mac-ansi']".
        [Mon Apr 10 16:13:15 2006] [error] get_interpreter: no interpreter callback found.
        [Mon Apr 10 16:13:15 2006] [error] [client 127.0.0.1] python_handler: Can't get/create interpreter.

        3. If it was able to import "mod_python.apache" but a failure occurred when calling "apache.init()", it will compare the version of the Apache mod_python module load against the version of mod_python Python code files found. If the version disagrees it will complain. This can occur where Apache module is 3.2+ but Python code files found are 3.1.X.

        [Mon Apr 10 16:18:24 2006] [error] make_obcallback: could not call init.\n
        TypeError: init() takes no arguments (2 given)
        [Mon Apr 10 16:18:24 2006] [error] make_obcallback: mod_python version mismatch, expected '3.3.0-dev-20060410', found '<unknown>'.
        [Mon Apr 10 16:18:24 2006] [error] get_interpreter: no interpreter callback found.
        [Mon Apr 10 16:18:24 2006] [error] [client 127.0.0.1] python_handler: Can't get/create interpreter.

        Unfortunately though, and I onlly just realised, the version string in mod_python/_init_.py file was only added in 3.2.

        All the same, all this extra information should hopefully be enough for people to see there is a misconfiguration problem and work out what is missing or wrongly installed.

        I'll possibly tweak this a bit more. Suggestions of other stuff to output and when, most welcome. For example, maybe should output _file_ from "mod_python" module so know where module is being picked up from.

        Show
        grahamd Graham Dumpleton added a comment - I have checked into subversion some new code to support a better troubleshooting guide. The checks that the code does is as follows: 1. On initialisation of mod_python, will compare the version string from the version of Python that mod_python was compiled against, with that which was found at runtime. If they differ, it will log error messages like: [Mon Apr 10 16:06:22 2006] [error] python_init: Python version mismatch, expected '2.3.4', found '2.3'. [Mon Apr 10 16:06:22 2006] [error] python_init: Python executable found '/usr/bin/python'. [Mon Apr 10 16:06:22 2006] [error] python_init: Python path being used '/Users/grahamd/lib/python:/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python23.zip:/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/:/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/plat-darwin:/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/plat-mac:/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/plat-mac/lib-scriptpackages:/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/lib-tk:/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/lib-dynload'. [Mon Apr 10 16:06:22 2006] [notice] mod_python: Creating 8 session mutexes based on 6 max processes and 25 max threads. [Mon Apr 10 16:06:22 2006] [notice] mod_python: using mutex_directory /tmp [Mon Apr 10 16:06:22 2006] [notice] Apache/2.0.55 (Unix) mod_python/3.3.0-dev-20060410 Python/2.3 configured – resuming normal operations 2. When it goes to import "mod_python.apache" when a request is first received, if it cannot be found, it will dump out Python path that was used in the search: [Mon Apr 10 16:10:09 2006] [error] make_obcallback: could not import mod_python.apache.\n ImportError: No module named mod_python.apache [Mon Apr 10 16:10:09 2006] [error] make_obcallback: Python path being used " ['/Users/grahamd/lib/python', '/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python23.zip', '/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3', '/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/plat-darwin', '/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/plat-mac', '/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/plat-mac/lib-scriptpackages', '/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/lib-tk', '/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/lib-dynload', '/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages', '/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/PIL', '/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/PyObjC', '/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/ZopePageTemplates', '/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/py2app', '/usr/local/src/reportlab_1_20', '/usr/local/src/trml2pdf', '/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/wx-2.6-mac-ansi'] ". [Mon Apr 10 16:10:09 2006] [error] get_interpreter: no interpreter callback found. [Mon Apr 10 16:10:09 2006] [error] [client 127.0.0.1] python_handler: Can't get/create interpreter. A similar error error is logged where "mod_python.apache" can be imported but an error occurred when doing so. This can happen when Apache module is 3.2+ and Python module code files are 2.7.X. [Mon Apr 10 16:13:15 2006] [error] make_obcallback: could not import mod_python.apache.\n Traceback (most recent call last): File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/mod_python/apache.py", line 616, in ? make_table = _apache.make_table AttributeError: 'module' object has no attribute 'make_table' [Mon Apr 10 16:13:15 2006] [error] make_obcallback: Python path being used " ['/Users/grahamd/lib/python', '/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python23.zip', '/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3', '/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/plat-darwin', '/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/plat-mac', '/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/plat-mac/lib-scriptpackages', '/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/lib-tk', '/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/lib-dynload', '/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages', '/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/PIL', '/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/PyObjC', '/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/ZopePageTemplates', '/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/py2app', '/usr/local/src/reportlab_1_20', '/usr/local/src/trml2pdf', '/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/wx-2.6-mac-ansi'] ". [Mon Apr 10 16:13:15 2006] [error] get_interpreter: no interpreter callback found. [Mon Apr 10 16:13:15 2006] [error] [client 127.0.0.1] python_handler: Can't get/create interpreter. 3. If it was able to import "mod_python.apache" but a failure occurred when calling "apache.init()", it will compare the version of the Apache mod_python module load against the version of mod_python Python code files found. If the version disagrees it will complain. This can occur where Apache module is 3.2+ but Python code files found are 3.1.X. [Mon Apr 10 16:18:24 2006] [error] make_obcallback: could not call init.\n TypeError: init() takes no arguments (2 given) [Mon Apr 10 16:18:24 2006] [error] make_obcallback: mod_python version mismatch, expected '3.3.0-dev-20060410', found '<unknown>'. [Mon Apr 10 16:18:24 2006] [error] get_interpreter: no interpreter callback found. [Mon Apr 10 16:18:24 2006] [error] [client 127.0.0.1] python_handler: Can't get/create interpreter. Unfortunately though, and I onlly just realised, the version string in mod_python/_ init _.py file was only added in 3.2. All the same, all this extra information should hopefully be enough for people to see there is a misconfiguration problem and work out what is missing or wrongly installed. I'll possibly tweak this a bit more. Suggestions of other stuff to output and when, most welcome. For example, maybe should output _ file _ from "mod_python" module so know where module is being picked up from.
        Hide
        grahamd Graham Dumpleton added a comment -

        With "_file_" output, last case now looks like:

        [Mon Apr 10 16:29:09 2006] [error] make_obcallback: could not call init.\n
        TypeError: init() takes no arguments (2 given)
        [Mon Apr 10 16:29:09 2006] [error] make_obcallback: mod_python version mismatch, expected '3.3.0-dev-20060410', found '<unknown>'.
        [Mon Apr 10 16:29:09 2006] [error] make_obcallback: mod_python modules location '/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/mod_python/_init_.pyc'.
        [Mon Apr 10 16:29:09 2006] [error] get_interpreter: no interpreter callback found.
        [Mon Apr 10 16:29:09 2006] [error] [client 127.0.0.1] python_handler: Can't get/create interpreter.

        All this output should hopefully eliminate a lot of issues down the track.

        Do we want to look at backporting these changes to 3.2.9????

        Show
        grahamd Graham Dumpleton added a comment - With "_ file _" output, last case now looks like: [Mon Apr 10 16:29:09 2006] [error] make_obcallback: could not call init.\n TypeError: init() takes no arguments (2 given) [Mon Apr 10 16:29:09 2006] [error] make_obcallback: mod_python version mismatch, expected '3.3.0-dev-20060410', found '<unknown>'. [Mon Apr 10 16:29:09 2006] [error] make_obcallback: mod_python modules location '/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/mod_python/_ init _.pyc'. [Mon Apr 10 16:29:09 2006] [error] get_interpreter: no interpreter callback found. [Mon Apr 10 16:29:09 2006] [error] [client 127.0.0.1] python_handler: Can't get/create interpreter. All this output should hopefully eliminate a lot of issues down the track. Do we want to look at backporting these changes to 3.2.9????

          People

          • Assignee:
            Unassigned
            Reporter:
            jgallacher Jim Gallacher
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:

              Development