Thanks Jonathan, On Wednesday, August 1, 2012 5:56:37 PM UTC+2, Jonathan Lundell wrote: > > On 1 Aug 2012, at 8:52 AM, Daniel Gonzalez <[email protected]> wrote: > > Quoting from the link you posted: > > "The purpose of such Python virtual environments is to allow one to create > multiple distinct Python environments for the same version of Python, but > with different sets of Python modules and packages installed into the > Python 'site-packages' directory." > > > It (virtualenv) also supports different Python versions. Note later in the > text where they talk about making sure that your mod_wsgi is built with the > Python version you're using in the virtualenv. >
I am not building mod_wsgi: I am installing it with apt-get install. I do not know which is the version it was compiled for, since it comes pre-packaged with the apache ubuntu distribution. I assume it is the system-wide python version (2.6.5). But I need to use the python version in my virtualenv for my web2py application (2.7.2). Running *any* python script with *any* python interpreter is usually as easy as making sure that the right python interpreter is selected, by setting the PATH, and putting "#!/usr/bin/env python" on top of the python script. Why is mod_python different in this regard? Isn't it basically a wrapper to call the python interpreter? Do you think there is any chance at all of using the python version in my virtualenv without having to recompile mod_wsgi? I am afraid that if I start recompiling mod_wsgi this will prove very complicated, and it will even force me to recompile apache ... Besides, what happens if tomorrow I need to upgrade my python version? Then I need to recompile mod_wsgi too. Looks complicated :( Thanks, Daniel > > This does not meet my requirements: I have different python versions. > Actually, I have the system-wide python (2.6.5), which I *do not* want to > use for mod_wsgi, and the python in my virtualenv (which I have > bootrstrapped, version 2.7.2), which is the one that I want to use. > > So, my virtualenv has both, packages and python binary. The reason is that > my python (web2py) application needs a specific version of python, which is > not available system wide. > > So, how can I tell mod_wsgi to use the python binary in my virtualenv? > Usually, just by setting the PATH to point to it (preceeding the path of > the system wide python), all scripts starting with "#!/usr/bin/env python" > would use the right python version, but this does not seem to work in case > of mod_wsgi. > > Any ideas? > > Thanks, > Daniel > > On Wednesday, August 1, 2012 5:30:07 PM UTC+2, Jonathan Lundell wrote: >> >> On 1 Aug 2012, at 8:13 AM, Daniel Gonzalez <[email protected]> wrote: >> >> I am deploying a web2py application, and I will be serving it with Apache >> via mod_wsgi. I have the following WSGI directives in my virtual host >> configuration: >> >> WSGIDaemonProcess web2py user=www-data group=www-data \ >> display-name=%{GROUP} >> WSGIProcessGroup web2py >> WSGIScriptAlias / /var/www/web2py/wsgihandler.py >> >> >> This is working, but it is taking the system wide python installation. As >> a result, some packages are not found (since they are only present in my >> virtualenv). I would like to tell this particular virtual host (or the >> whole Apache, if there is no other way), to use the python installation in >> my virtual environment (/home/myuser/.virtualenvs/python2.7.2/bin). >> >> Is it possible to configure this for Apache? Or better, just for my >> virtual host? I would like to cause as little effect as possible to the >> rest of the system (specifically, I do not want to modify the default >> python version used system wide) >> >> >> http://code.google.com/p/modwsgi/wiki/VirtualEnvironments >> > > > > > --

