[Grok-dev] Grok + Wsgi + Apache = Distribution not found (grokcore.startup)

Hector Blanco white.lists at gmail.com
Fri Jul 20 15:20:52 UTC 2012

Hello everyone

I've been trying to make grok run directly with Apache and mod_wsgi,
without using Paster.

I followed the tutorial in
and everything works fine in a Ubuntu 11.10 with Apache 2.2.20 (It's
even working without compiling the latest version of wgsi, but with
the one in the Ubuntu repositories, which is the 3.3-2, I believe).
Thank you very much by the tutorial, by the way. It's great.

Now, the problem comes when I try to do the same thing in a CentOS
6.3. That CentOS has a little bit older Apache version (2.2.15, which
is still using "old style" directory layouts, meaning, the
configuration is done through httpd.conf). I'm also using the system's
mod_wsgi (mod_wsgi-3.2-1.el6.x86_64) installed through yum.

When I run the grok application through Paster, everything works fine,
but when I try to start Apache, I get this in the

-------------------------   error_log  ---------------------------------
[Thu Jul 19 19:14:20 2012] [alert] (13)Permission denied: mod_wsgi
(pid=29437): Unable to change working directory to '/home/hector'.
[Thu Jul 19 19:14:20 2012] [error] [client] mod_wsgi
(pid=29437): Target WSGI script
'/usr/share/myGrokApp/server/parts/wsgi_app/wsgi' cannot be loaded as
Python module.
[Thu Jul 19 19:14:20 2012] [error] [client] mod_wsgi
(pid=29437): Exception occurred processing WSGI script
[Thu Jul 19 19:14:20 2012] [error] [client] Traceback
(most recent call last):
[Thu Jul 19 19:14:20 2012] [error] [client]   File
"/usr/share/myGrokApp/server/parts/wsgi_app/wsgi", line 137, in
[Thu Jul 19 19:14:20 2012] [error] [client]
application = loadapp("config:" + configfile, name=None)
[Thu Jul 19 19:14:20 2012] [error] [client]   File
line 247, in loadapp
[Thu Jul 19 19:14:20 2012] [error] [client]     return
loadobj(APP, uri, name=name, **kw)
[ . . . ]
[Thu Jul 19 19:14:20 2012] [error] [client]   File
line 690, in require
[Thu Jul 19 19:14:20 2012] [error] [client]     needed =
[Thu Jul 19 19:14:20 2012] [error] [client]   File
line 588, in resolve
[Thu Jul 19 19:14:20 2012] [error] [client]     raise
[Thu Jul 19 19:14:20 2012] [error] [client]
DistributionNotFound: grokcore.startup

I've had errors like this when running grok through the application
regular paster, and it usually meant that there was a conflict in
Python packages, but I tried deleting every package related to this,
recreating the "grokproject myGrokApp" , rebuilding the application...
(with usr/share/myGrokApp/server/bin/buildout) and nothing.

This is the /etc/httpd/conf/httpd.conf:

-------------------- httpd.conf ----------------------------------------
LoadModule ssl_module modules/mod_ssl.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_connect_module modules/mod_proxy_connect.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule wsgi_module modules/mod_wsgi.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule env_module modules/mod_env.so

User hector
Group hector

WSGIPythonHome /usr
WSGISocketPrefix /var/run/accessibleByHector/wsgiGrok
WSGIDaemonProcess grokProcesses user=hector group=hector threads=20

# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, in addition to the default. See also the <VirtualHost>
# directive.
# Change this to Listen on specific IP addresses as shown below to
# prevent Apache from glomming onto all bound IP addresses (
Listen *:80

# ServerAdmin: Your address, where problems with the server should be
# e-mailed.  This address appears on some server-generated pages, such
# as error documents.  e.g. admin at your-domain.com
ServerAdmin root at localhost

# ServerName gives the name and port that the server uses to identify itself.
# This can often be determined automatically, but we recommend you specify
# it explicitly to prevent problems during startup.
# If this is not set to valid DNS name for your host, server-generated
# redirections will not work.  See also the UseCanonicalName directive.
# If your host doesn't have a registered DNS name, enter its IP address here.
# You will have to access it by its address anyway, and this will make
# redirections work in a sensible way.

# The following directives define some format nicknames for use with
# a CustomLog directive (see below).
# Defaults for virtual hosts

# Logs

# Virtual hosts
<VirtualHost *:80>
	ServerName localhost
	WSGIScriptAlias / /usr/share/myGrokApp/server/parts/wsgi_app/wsgi
	WSGIProcessGroup grokProcesses
 	WSGIPassAuthorization On
	SetEnv HTTP_X_VHM_HOST http://localhost/
	LogLevel debug

I've checked the wsgi script generated by the buildout
(/usr/share/myGrokApp/server/parts/wsgi_app/wsgi) and the grokcore
thing seems to be properly added to the syspath:

----------------------- wsgi --------------------------
import ConfigParser
import sys
syspaths = [
     [ . . . ]
     [ . . . ]

My concern is that maybe SELinux may be messing up with my life?? I
have no idea of what may be going on here.

Any idea, clue or... something will be appreciated because, at this
point, I don't know what else I can do...

Thank you in advance.

More information about the Grok-dev mailing list