TRAC/Mod_Apache path problem

I'm trying to get www/trac running on FreeBSD 10.3-RELEASE amd64

I am getting "500 server error" and looking at my logs I see in trac-error_log:

Code:
[Fri Mar 24 11:10:23.282925 2017] [:error] [pid 21554:tid 34741511168] [client xxx.127.65.15:22736] python_handler: Can't get/create interpreter.

And in more detail in httpd-error.log
ImportError: No module named mod_python.apache
Code:
[Fri Mar 24 11:10:23.282850 2017] [:error] [pid 21554:tid 34741511168] make_obcallback: Python path being used "['/usr/local/lib/python27.zip', '/usr/local/lib/python2.7', '/usr/local/lib/python2.7/plat-freebsd10', '/usr/local/lib/python2.7/lib-tk', '/usr/local/lib/python2.7/lib-old', '/usr/local/lib/python2.7/lib-dynload']".
[Fri Mar 24 11:10:23.282888 2017] [:error] [pid 21554:tid 34741511168] get_interpreter: no interpreter callback found.

My /usr/local/etc/apache24/extra/httpd-vhosts.conf looks like:

Code:
<VirtualHost 10.3.69.139:80>
    # registrar nic.st
    DocumentRoot /usr/local/www/trac
    ServerName trac.my.domain
    ErrorLog /var/log/trac-error_log
    CustomLog /var/log/trac-access_log combined
    <Location />
        SetHandler mod_python
        PythonInterpreter main_interpreter
        PythonOption PYTHON_EGG_CACHE /usr/local/www/trac/tmp
        PythonPath "sys.path + ['/usr/local/www/trac', '/usr/local/bin/mod_python']"
        PythonPath /usr/local/bin/mod_python
        PythonHandler trac.web.modpython_frontend
        PythonOption TracEnv /usr/local/www/trac
        PythonOption TracUriRoot /
    </Location>
</VirtualHost>


# pkg version -v | grep 'mod_python\|trac\|apache'
Code:
ap24-mod_python35-3.5.0_2          =   up-to-date with index
apache24-2.4.25_1                  =   up-to-date with index
trac-1.2                           =   up-to-date with index


I am confident it's a trivial misconfiguration issue, but most answers I find by googling are along the lines of "why aren't you using WSGIScript," which may be a valid question.
 
This may be related to Thread 46449. Symptoms such as python not being found while python2 did the right thing seem reminiscent. So I did a portmaster lang/python and python worked, however this hasn't got Trac working. I am rebuilding to see if rebuilding www/trac and www/mod_python35 again will connect things that seem disconnected. However there is another odd symptom suggesting perhaps a few too many pythons in one place:

# pkg version -v | grep python
Code:
ap24-mod_python35-3.5.0_2          =   up-to-date with index
py27-dnspython-1.15.0              =   up-to-date with index
py27-python2-pythondialog-3.4.0    =   up-to-date with index
python-2.7_3,2                     =   up-to-date with index
python2-2_3                        =   up-to-date with index
python27-2.7.13_1                  =   up-to-date with index
 
Last edited by a moderator:
Still no luck: some diagnostics that might help anyone else - despite not getting me there:

# python
Code:
Python 2.7.13 (default, Mar 25 2017, 16:20:16)
[GCC 4.2.1 Compatible FreeBSD Clang 3.4.1 (tags/RELEASE_34/dot1-final 208032)] on freebsd10
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> print (sys.path)
Code:
['', '/usr/local/lib/python27.zip', '/usr/local/lib/python2.7', '/usr/local/lib/python2.7/plat-freebsd10', '/usr/local/lib/python2.7/lib-tk', '/usr/local/lib/python2.7/lib-old', '/usr/local/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/site-packages']

I also tried adjusting the PythonPath Directive - combining the two calls (which shouldn't work) into one and moving it forward before the Egg Cache option, but to no avail:

Code:
<VirtualHost 10.3.69.139:80>
    # registrar nic.st
    DocumentRoot /usr/local/www/trac
    ServerName trac.ova.st
    ServerAdmin gessel@blackrosetech.com
    ErrorLog /var/log/trac-error_log
    CustomLog /var/log/trac-access_log combined
    <Location />
        PythonPath "sys.path + ['/usr/local/www/trac', '/usr/local/bin/mod_python']"
        SetHandler mod_python
        PythonInterpreter main_interpreter
        PythonOption PYTHON_EGG_CACHE /usr/local/www/trac/tmp
        PythonHandler trac.web.modpython_frontend
        PythonOption TracEnv /usr/local/www/trac
        PythonOption TracUriRoot /
    </Location>
</VirtualHost>
 
Seems to be related to this: http://modpython.org/pipermail/mod_python/2004-November/016815.html
as:
# python
Code:
Python 2.7.13 (default, Mar 25 2017, 16:20:16)
[GCC 4.2.1 Compatible FreeBSD Clang 3.4.1 (tags/RELEASE_34/dot1-final 208032)] on freebsd10
Type "help", "copyright", "credits" or "license" for more information.
>>> import mod_python.apache
Code:
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/site-packages/mod_python/apache.py", line 30, in <module>
    import _apache
ImportError: No module named _apache

and
Code:
[Sat Apr 01 08:59:34.694122 2017] [:notice] [pid 75658:tid 34401707008] mod_python: Creating 8 session mutexes based on 7 max processes and 25 max threads.
[Sat Apr 01 08:59:34.694155 2017] [:notice] [pid 75658:tid 34401707008] mod_python: using mutex_directory /tmp
[Sat Apr 01 08:59:34.865517 2017] [mpm_worker:notice] [pid 75658:tid 34401707008] AH00292: Apache/2.4.25 (FreeBSD) OpenSSL/1.0.2k mod_python/3.5.0 Python/2.7.13 PHP/5.6.30 configured -- resuming normal operations
[Sat Apr 01 08:59:34.865568 2017] [core:notice] [pid 75658:tid 34401707008] AH00094: Command line: '/usr/local/sbin/httpd'
[Sat Apr 01 08:59:40.077629 2017] [:error] [pid 46654:tid 34745705472] make_obcallback: could not import mod_python.apache.\n
ImportError: No module named mod_python.apache
[Sat Apr 01 08:59:40.078052 2017] [:error] [pid 46654:tid 34745705472] make_obcallback: Python path being used "['/usr/local/lib/python27.zip', '/usr/local/lib/python2.7', '/usr/local/lib/python2.7/plat-freebsd10', '/usr/local/lib/python2.7/lib-tk', '/usr/local/lib/python2.7/lib-old', '/usr/local/lib/python2.7/lib-dynload']".
[Sat Apr 01 08:59:40.078087 2017] [:error] [pid 46654:tid 34745705472] get_interpreter: no interpreter callback found.
 
Back
Top