Two possibilities. The Apache user doesn't have access to the virtual environment directories.
Or, the package is a compressed egg and because PYTHON_EGG_CACHE is not set to a writable location it is failing to unpack the egg so it can be used. The latter doesn't always result in an obvious error. For the first, print out sys.path in the WSGI script file to see what it gets set to. If no sub package directories are listed from virtual environment, likely it or some parent directory isn't readable/searchable to Apache user. Graham On 22 May 2012 10:20, Tamer Higazi <[email protected]> wrote: > Hi! > I am trying to set the pythonpath for the WSGI application, and it > always fails. mod_wsgi always look in the main > > /usr/lib/python27/site-packages folder, and I don't know why. > > I have set up a virtual environment and installed all packages. > > In the VirtualHost section I set the python path: > > WSGIDaemonProcess pyramid user=apache group=apache threads=4 > python-path=/storage/PyENV/lin/UKDMindMapper/lib/python2.7/site-packages > > > For any advises howto tell mod_wsgi to use a differen python-path > successfully, I would kindly thank you. > > > > Tamer > > > > here the virtualhost entry: > > WSGIPythonHome /usr > > <VirtualHost *:80> > ServerName ukd.higazi-it.com > WSGIApplicationGroup %{GLOBAL} > WSGIPassAuthorization On > WSGIDaemonProcess pyramid user=apache group=apache threads=4 > python-path=/storage/PyENV/lin/UKDMindMapper/lib/python2.7/site-packages > WSGIScriptAlias / /storage/PyENV/lin/UKDMindMapper/pyramid.wsgi > > <Directory /storage/PyENV/lin/UKDMindMapper> > WSGIProcessGroup pyramid > Order allow,deny > Allow from all > </Directory> > </VirtualHost> > > > > and here the pyramid.wsgi content: > > from pyramid.paster import get_app > application = > get_app('/storage/PyProjects/UKDMindMapperApp/development.ini','main') > > > which brings me this error in the apache error_log: > > [Tue May 22 02:14:32 2012] [error] [client 127.0.0.1] mod_wsgi > (pid=19068): Target WSGI script > '/storage/PyENV/lin/UKDMindMapper/pyramid.wsgi' cannot be loaded as > Python module. > [Tue May 22 02:14:32 2012] [error] [client 127.0.0.1] mod_wsgi > (pid=19068): Exception occurred processing WSGI script > '/storage/PyENV/lin/UKDMindMapper/pyramid.wsgi'. > [Tue May 22 02:14:32 2012] [error] [client 127.0.0.1] Traceback (most > recent call last): > [Tue May 22 02:14:32 2012] [error] [client 127.0.0.1] File > "/storage/PyENV/lin/UKDMindMapper/pyramid.wsgi", line 2, in <module> > [Tue May 22 02:14:32 2012] [error] [client 127.0.0.1] application = > get_app('/storage/PyProjects/UKDMindMapperApp/development.ini','main') > [Tue May 22 02:14:32 2012] [error] [client 127.0.0.1] File > "/storage/PyENV/lin/UKDMindMapper/lib/python2.7/site-packages/pyramid-1.3.2-py2.7.egg/pyramid/paster.py", > line 32, in get_app > [Tue May 22 02:14:32 2012] [error] [client 127.0.0.1] app = > loadapp(config_name, name=section, relative_to=here_dir) > [Tue May 22 02:14:32 2012] [error] [client 127.0.0.1] File > "/usr/lib/python2.7/site-packages/PasteDeploy-1.5.0-py2.7.egg/paste/deploy/loadwsgi.py", > line 247, in loadapp > [Tue May 22 02:14:32 2012] [error] [client 127.0.0.1] return > loadobj(APP, uri, name=name, **kw) > [Tue May 22 02:14:32 2012] [error] [client 127.0.0.1] File > "/usr/lib/python2.7/site-packages/PasteDeploy-1.5.0-py2.7.egg/paste/deploy/loadwsgi.py", > line 271, in loadobj > [Tue May 22 02:14:32 2012] [error] [client 127.0.0.1] > global_conf=global_conf) > [Tue May 22 02:14:32 2012] [error] [client 127.0.0.1] File > "/usr/lib/python2.7/site-packages/PasteDeploy-1.5.0-py2.7.egg/paste/deploy/loadwsgi.py", > line 296, in loadcontext > [Tue May 22 02:14:32 2012] [error] [client 127.0.0.1] > global_conf=global_conf) > [Tue May 22 02:14:32 2012] [error] [client 127.0.0.1] File > "/usr/lib/python2.7/site-packages/PasteDeploy-1.5.0-py2.7.egg/paste/deploy/loadwsgi.py", > line 320, in _loadconfig > [Tue May 22 02:14:32 2012] [error] [client 127.0.0.1] return > loader.get_context(object_type, name, global_conf) > [Tue May 22 02:14:32 2012] [error] [client 127.0.0.1] File > "/usr/lib/python2.7/site-packages/PasteDeploy-1.5.0-py2.7.egg/paste/deploy/loadwsgi.py", > line 454, in get_context > [Tue May 22 02:14:32 2012] [error] [client 127.0.0.1] section) > [Tue May 22 02:14:32 2012] [error] [client 127.0.0.1] File > "/usr/lib/python2.7/site-packages/PasteDeploy-1.5.0-py2.7.egg/paste/deploy/loadwsgi.py", > line 476, in _context_from_use > [Tue May 22 02:14:32 2012] [error] [client 127.0.0.1] object_type, > name=use, global_conf=global_conf) > [Tue May 22 02:14:32 2012] [error] [client 127.0.0.1] File > "/usr/lib/python2.7/site-packages/PasteDeploy-1.5.0-py2.7.egg/paste/deploy/loadwsgi.py", > line 406, in get_context > [Tue May 22 02:14:32 2012] [error] [client 127.0.0.1] > global_conf=global_conf) > [Tue May 22 02:14:32 2012] [error] [client 127.0.0.1] File > "/usr/lib/python2.7/site-packages/PasteDeploy-1.5.0-py2.7.egg/paste/deploy/loadwsgi.py", > line 296, in loadcontext > [Tue May 22 02:14:32 2012] [error] [client 127.0.0.1] > global_conf=global_conf) > [Tue May 22 02:14:32 2012] [error] [client 127.0.0.1] File > "/usr/lib/python2.7/site-packages/PasteDeploy-1.5.0-py2.7.egg/paste/deploy/loadwsgi.py", > line 328, in _loadegg > [Tue May 22 02:14:32 2012] [error] [client 127.0.0.1] return > loader.get_context(object_type, name, global_conf) > [Tue May 22 02:14:32 2012] [error] [client 127.0.0.1] File > "/usr/lib/python2.7/site-packages/PasteDeploy-1.5.0-py2.7.egg/paste/deploy/loadwsgi.py", > line 620, in get_context > [Tue May 22 02:14:32 2012] [error] [client 127.0.0.1] object_type, > name=name) > [Tue May 22 02:14:32 2012] [error] [client 127.0.0.1] File > "/usr/lib/python2.7/site-packages/PasteDeploy-1.5.0-py2.7.egg/paste/deploy/loadwsgi.py", > line 640, in find_egg_entry_point > [Tue May 22 02:14:32 2012] [error] [client 127.0.0.1] > pkg_resources.require(self.spec) > [Tue May 22 02:14:32 2012] [error] [client 127.0.0.1] File > "/usr/lib/python2.7/site-packages/distribute-0.6.21-py2.7.egg/pkg_resources.py", > line 686, in require > [Tue May 22 02:14:32 2012] [error] [client 127.0.0.1] needed = > self.resolve(parse_requirements(requirements)) > [Tue May 22 02:14:32 2012] [error] [client 127.0.0.1] File > "/usr/lib/python2.7/site-packages/distribute-0.6.21-py2.7.egg/pkg_resources.py", > line 584, in resolve > [Tue May 22 02:14:32 2012] [error] [client 127.0.0.1] raise > DistributionNotFound(req) > [Tue May 22 02:14:32 2012] [error] [client 127.0.0.1] > DistributionNotFound: UKDMindMapperApp > > -- > You received this message because you are subscribed to the Google Groups > "modwsgi" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/modwsgi?hl=en. > -- You received this message because you are subscribed to the Google Groups "modwsgi" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/modwsgi?hl=en.
