[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.
ImportError: No module named mod_python.apache
[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.
<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']"
PythonPath /usr/local/bin/mod_python
PythonHandler trac.web.modpython_frontend
PythonOption TracEnv /usr/local/www/trac
PythonOption TracUriRoot /
</Location>
</VirtualHost>
WSGIScript
There's an obvious crude attempt to add the path for mod_python explicitly in my vhost declaration, which didn't help.
A shot in the dark because I haven't really messed with FreeBSD in years..Is it possible you have python3 on the system and the version of mod_python is compiled for python3 while you are using python2.7 for Trac? Or vice versa, is it compiled for 2.7 and you only have python3 installed?Just because you are calling mod_python doesn't mean you installed the module.. have you installed it?
Im guessing apache on FreeBSD has support for mod_wsgi, that may be a reasonable alternative to mod_python. This may be why the links you are seeing reference using that instead.
# pkg version -v | grep py
ap24-mod_python35-3.5.0_2 = up-to-date with index
py27-Babel-2.3.4 = up-to-date with index
py27-Genshi-0.7_1 = up-to-date with index
py27-acme-0.12.0,1 = up-to-date with index
py27-cffi-1.7.0 = up-to-date with index
py27-configargparse-0.11.0 = up-to-date with index
py27-configobj-5.0.6_1 = up-to-date with index
py27-cryptography-1.7.2 = up-to-date with index
py27-dnspython-1.15.0 = up-to-date with index
py27-docutils-0.13.1 = up-to-date with index
py27-enum34-1.1.6 = up-to-date with index
py27-funcsigs-1.0.2 = up-to-date with index
py27-idna-2.0 = up-to-date with index
py27-ipaddress-1.0.18 = up-to-date with index
py27-mock-1.3.0_1 = up-to-date with index
py27-ndg_httpsclient-0.4.2 = up-to-date with index
py27-openssl-16.2.0 = up-to-date with index
py27-parsedatetime-2.1 = up-to-date with index
py27-pbr-1.8.1 = up-to-date with index
py27-pip-9.0.1 = up-to-date with index
py27-psutil-5.2.0_1 = up-to-date with index
py27-pyasn1-0.2.2 = up-to-date with index
py27-pycparser-2.10 = up-to-date with index
py27-pygments-2.1.3_1 = up-to-date with index
py27-pyrfc3339-1.0 = up-to-date with index
py27-python2-pythondialog-3.4.0 = up-to-date with index
py27-pytz-2016.10,1 = up-to-date with index
py27-requests-2.11.1 = up-to-date with index
py27-setuptools-32.1.0_1 = up-to-date with index
py27-six-1.10.0 = up-to-date with index
py27-sqlite3-2.7.13_7 = up-to-date with index
py27-subversion-1.9.5 = up-to-date with index
py27-werkzeug-0.12.1 = up-to-date with index
py27-zope.component-4.2.2 = up-to-date with index
py27-zope.event-4.1.0 = up-to-date with index
py27-zope.interface-4.1.3 = up-to-date with index
python2-2_3 = up-to-date with index
python27-2.7.13_1 = up-to-date with index
# less Makefile
# Created by: Hye-Shik Chang
# $FreeBSD: head/www/mod_python35/Makefile 422338 2016-09-17 18:13:34Z ohauer $
PORTNAME= mod_python
PORTVERSION= 3.5.0
PORTREVISION= 2
CATEGORIES= www python
MASTER_SITES= http://dist.modpython.org/dist/ \
LOCAL/ohauer
PKGNAMEPREFIX= ${APACHE_PKGNAMEPREFIX}
PKGNAMESUFFIX= 35
DIST_SUBDIR= apache2
MAINTAINER= apache@FreeBSD.org
COMMENT= Apache module that embeds the Python interpreter within the server
LICENSE= APACHE20
CONFLICTS_INSTALL= ap2[24]-mod_python3[^5]*
USE_APACHE= 22+
USES= cpe python:2.7 tar:tgz
CPE_VENDOR= apache
SUB_FILES= pkg-message 270_mod_python.conf.sample
GNU_CONFIGURE= yes
CONFIGURE_ARGS+= --with-apxs="${APXS}" \
--with-python="${PYTHON_CMD}" \
--without-flex
LDFLAGS+= -L${LOCALBASE}/lib
MAKE_ARGS+= APXS=${APXS}
MAKE_ENV= EXPR_COMPAT=yes
PLIST_SUB+= PORTVERSION=${PORTVERSION} \
PYTHON_VER=${PYTHON_VER}
post-install:
@${MKDIR} ${STAGEDIR}${PREFIX}/${APACHEETCDIR}/modules.d
${INSTALL_DATA} ${WRKDIR}/270_mod_python.conf.sample ${STAGEDIR}${PREFIX}/${APACHEETCDIR}/modules.d
# You need to install apache & mod_python before you run this
regression-test: build
${REINPLACE_CMD} -e 's|%%APACHEMODDIR%%|${APACHEMODDIR}|' ${WRKSRC}/test/test.py
-@${MAKE} test -C ${WRKSRC}
# pkg version -v | grep apache
apache24-2.4.25_1 = up-to-date with indexEnter code here.Sat Mar 25 09:50:25.025855 2017] [:error] [pid 69623:tid 34741511168] make_obcallback: could not import mod_python.apache.\n
ImportError: No module named mod_python.apache
[Sat Mar 25 09:50:25.026263 2017] [:error] [pid 69623: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']".
[Sat Mar 25 09:50:25.026292 2017] [:error] [pid 69623:tid 34741511168] get_interpreter: no interpreter callback found.
..Thanks! I tried and
# apachectl graceful
but no change, though the error log might provide a clue with respect to what paths are still getting called (no change):Enter code here.Sat Mar 25 09:50:25.025855 2017] [:error] [pid 69623:tid 34741511168] make_obcallback: could not import mod_python.apache.\n
ImportError: No module named mod_python.apache
[Sat Mar 25 09:50:25.026263 2017] [:error] [pid 69623: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']".
[Sat Mar 25 09:50:25.026292 2017] [:error] [pid 69623:tid 34741511168] get_interpreter: no interpreter callback found.
..
First step fail!
Thanks for the diagnostic - good starting point.
# python2
Python 2.7.13 (default, Mar 22 2017, 10:45:35)
[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)
['', '/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']
>>>
ImportError: No module named mod_python.apache
[Sat Mar 25 15:20:19.399938 2017] [:error] [pid 83737: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']".
[Sat Mar 25 15:20:19.399964 2017] [:error] [pid 83737:tid 34741511168] get_interpreter: no interpreter callback foundAlas, I rebuilt the system and rebooted the jail to no avail.
An additional detail is that when I test trac with the internal server, it works fine. Not surprising, but reinforces this is almost certainly a mod_python issue. :/
Thanks! I tried and
# apachectl graceful
but no change, though the error log might provide a clue with respect to what paths are still getting called (no change):Enter code here.Sat Mar 25 09:50:25.025855 2017] [:error] [pid 69623:tid 34741511168] make_obcallback: could not import mod_python.apache.\n
ImportError: No module named mod_python.apache
[Sat Mar 25 09:50:25.026263 2017] [:error] [pid 69623: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']".
[Sat Mar 25 09:50:25.026292 2017] [:error] [pid 69623:tid 34741511168] get_interpreter: no interpreter callback found.
..
[Sat Apr 01 08:19:28.674481 2017] [core:notice] [pid 75658:tid 34401707008] AH00094: Command line: '/usr/local/sbin/httpd'
[Sat Apr 01 08:20:28.444978 2017] [:error] [pid 45481:tid 34741511168] make_obcallback: could not import mod_python.apache.\n
ImportError: No module named mod_python.apache
[Sat Apr 01 08:20:28.445426 2017] [:error] [pid 45481: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']".
[Sat Apr 01 08:20:28.445464 2017] [:error] [pid 45481:tid 34741511168] get_interpreter: no interpreter callback found.
# python
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
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
[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.
Also, given your helpful hint (thanks) I tracked down this : https://code.activestate.com/lists/python-tutor/23472/
however, adding the paths to site.py didn't help. There are two further hints, but I'm not sure where to apply them - adding the paths to the Trac code or creating *.pth files (as suggested in site.py) but it isn't clear where to install them or if they'll only enumerate subdirectories of an existing path directory (sort of implied).
/usr/local/lib/python2.7/site-packages/mod_python
/usr/local/lib/python2.7/site-packages/mod_python/Cookie.py
/usr/local/lib/python2.7/site-packages/mod_python/Cookie.pyc
/usr/local/lib/python2.7/site-packages/mod_python/Cookie.pyo
/usr/local/lib/python2.7/site-packages/mod_python/Session.py
/usr/local/lib/python2.7/site-packages/mod_python/Session.pyc
/usr/local/lib/python2.7/site-packages/mod_python/Session.pyo
/usr/local/lib/python2.7/site-packages/mod_python/__init__.py
/usr/local/lib/python2.7/site-packages/mod_python/__init__.pyc
/usr/local/lib/python2.7/site-packages/mod_python/__init__.pyo
/usr/local/lib/python2.7/site-packages/mod_python/_psp.so
/usr/local/lib/python2.7/site-packages/mod_python/apache.py
/usr/local/lib/python2.7/site-packages/mod_python/apache.pyc
/usr/local/lib/python2.7/site-packages/mod_python/apache.pyo
/usr/local/lib/python2.7/site-packages/mod_python/cache.py
/usr/local/lib/python2.7/site-packages/mod_python/cache.pyc
/usr/local/lib/python2.7/site-packages/mod_python/cache.pyo
/usr/local/lib/python2.7/site-packages/mod_python/cgihandler.py
/usr/local/lib/python2.7/site-packages/mod_python/cgihandler.pyc
/usr/local/lib/python2.7/site-packages/mod_python/cgihandler.pyo
/usr/local/lib/python2.7/site-packages/mod_python/httpdconf.py
/usr/local/lib/python2.7/site-packages/mod_python/httpdconf.pyc
/usr/local/lib/python2.7/site-packages/mod_python/httpdconf.pyo
/usr/local/lib/python2.7/site-packages/mod_python/psp.py
/usr/local/lib/python2.7/site-packages/mod_python/psp.pyc
/usr/local/lib/python2.7/site-packages/mod_python/psp.pyo
/usr/local/lib/python2.7/site-packages/mod_python/publisher.py
/usr/local/lib/python2.7/site-packages/mod_python/publisher.pyc
/usr/local/lib/python2.7/site-packages/mod_python/publisher.pyo
/usr/local/lib/python2.7/site-packages/mod_python/python22.py
/usr/local/lib/python2.7/site-packages/mod_python/python22.pyc
/usr/local/lib/python2.7/site-packages/mod_python/python22.pyo
/usr/local/lib/python2.7/site-packages/mod_python/testhandler.py
/usr/local/lib/python2.7/site-packages/mod_python/testhandler.pyc
/usr/local/lib/python2.7/site-packages/mod_python/testhandler.pyo
/usr/local/lib/python2.7/site-packages/mod_python/util.py
/usr/local/lib/python2.7/site-packages/mod_python/util.pyc
/usr/local/lib/python2.7/site-packages/mod_python/util.pyo
/usr/local/lib/python2.7/site-packages/mod_python/version.py
/usr/local/lib/python2.7/site-packages/mod_python/version.pyc
/usr/local/lib/python2.7/site-packages/mod_python/version.pyo
/usr/local/lib/python2.7/site-packages/mod_python/wsgi.py
/usr/local/lib/python2.7/site-packages/mod_python/wsgi.pyc
/usr/local/lib/python2.7/site-packages/mod_python/wsgi.pyo
/usr/local/lib/python2.7/site-packages/mod_python-3.5.0-py2.7.egg-info