On 16 July 2012 22:40, Alan Kesselmann <[email protected]> wrote:
> Why is it wrong - thats my default 2.7.2 installation that all other sites
> should work with.

It is wrong because WSGIPythonHome is not meant to be set to the name
of the Python binary.

http://code.google.com/p/modwsgi/wiki/VirtualEnvironments

It is meant to be set to the value of sys.prefix for that Python
installation. This is only needed if want to refer to a Python
installation in a non standard location, or if using a virtual
environment.

So, if using your Python virtual environment it must be:

WSGIPythonHome /home/alan/python/virtualenvs/py273ucs2

You cannot list WSGIPythonHome more than once and you cannot go
switching it back to point explicitly, or let it default back to the
system wide Python. Especially in your case because the Linux distro
have hacked the system wide Python to be incompatible with your self
compiled Python installation. A mod_wsgi.so file, even though compiled
for 2.7, cannot be used with both your 2.7.2 and 2.7.3 installations.

So, you cannot support both Python 2.7.2 (system wide) and 2.7.3
(virtual environment) on the same Apache without also changing the
mod_wsgi.so file to an appropriately compiled one, in addition to
commenting/uncommenting the different configurations.

If you do switch mod_wsgi.so back to one compiled against system wide
Python, simply do not set WSGIPythonHome.

Graham

> Since only my testing site should run with the ucs2 python 2.7.3 and all
> other sites should work with python 2.7.2 i have used this config file to
> either comment in or out the sites
>
> Alias /admin-media/
> "/home/alan/python/Django-1.3/django/contrib/admin/media/"
> <Directory "/home/alan/python/Django-1.3/django/contrib/admin/media">
> Order allow,deny
> Allow from all
> </Directory>
>
> Alias /media/cms/
> "/home/alan/python/divio-django-cms-3fff03a/cms/media/cms/"
> <Directory "/home/alan/python/divio-django-cms-3fff03a/cms/media/cms/">
> Order allow,deny
> Allow from all
> </Directory>
>
> Alias /media/ "/home/alan/projects/pin/media/"
> <Directory "/home/alan/projects/pin/media/">
> #Alias /media/ "/home/alan/projects/avalve_v2/media/"
> #<Directory "/home/alan/projects/avalve_v2/media/">
> #Alias /media/ "/home/alan/projects/printer/media/"
> #<Directory "/home/alan/projects/printer/media/">
> Order allow,deny
> Allow from all
> </Directory>
>
> WSGIPythonHome /usr/bin/python
> WSGIPythonPath /usr/local/lib/python2.7/site-packages/
> WSGIDaemonProcess pin user=alan group=alan processes=5 threads=1
> python-path=/usr/local/lib/python2.7/site-packages/
> WSGIProcessGroup pin
> WSGIScriptAlias / /home/alan/projects/pin/pin.wsgi
>
> #WSGIDaemonProcess autovalve user=alan group=alan processes=5 threads=5
> #WSGIProcessGroup autovalve
> #WSGIScriptAlias / /home/alan/projects/avalve_v2/avalve.wsgi
>
> #WSGIPythonHome /home/alan/python/virtualenvs/py273ucs2/
> #WSGIPythonPath
> /home/alan/python/virtualenvs/py273ucs2/lib/python2.7/site-packages/
> #WSGIDaemonProcess printer user=alan group=alan processes=5 threads=5
> python-path=/home/alan/python/virtualenvs/py273ucs2/lib/python2.7/site-packages/
> #WSGIProcessGroup printer
> #WSGIScriptAlias / /home/alan/projects/printer/printer.wsgi
>
> Alan
>
> On Monday, July 16, 2012 9:10:23 PM UTC+3, Graham Dumpleton wrote:
>>
>> Python home in log should not say /use/bin/python. That is very wrong.
>> That would suggest you have a rouge WSGIPythonHome directive in your Apache
>> config somewhere. Can you check.
>>
>> Graham
>>
>> On 16/07/2012, at 10:25 AM, Alan Kesselmann <[email protected]>
>> wrote:
>>
>>
>>
>> On Monday, July 16, 2012 5:19:41 PM UTC+3, Graham Dumpleton wrote:
>>>
>>> Lets summarise where believe things are up to.
>>>
>>> You have mod_wsgi.so correctly linking in the libpython2.6.so for your
>>> own Python installation.
>>
>>
>>  This must be mistake (should probably say libpython2.7.so ) because both
>> of the python installations are 2.7. System python was/is 2.7.2 and new
>> installation is 2.7.3.
>>>
>>>
>>> Your virtual environment is constructed using your Python installation.
>>
>> correct
>>>
>>>
>>> You believe you have removed mod_python from your Apache.
>>
>>
>> i have ran sudo aptitude purge libapache2-mod-python.
>>
>> libapache2-mod-wsgi which was installed for initial python still remains.
>>
>>>
>>> Even though mod_python is not loaded, WSGIPythonHome seems to be
>>> getting ignored.
>>>
>>> This is resulting in system wide Python system .py files to be used on
>>> startup.
>>>
>>> The specific OS you are using doesn't use standard Python code base.
>>> Instead they hack it to allow them to have parallel Python standard
>>> and debug binaries. Part of this is that they hack the compiled in sys
>>> module to have a pydebug flag. The system wide .py files are looking
>>> for that flag, but because the libpython2.7.so that is being used is
>>> actually from your installation it doesn't have it and fails.
>>
>>
>> this went completely over my head :)
>>>
>>>
>>> Things to do:
>>>
>>> 1. Please verify this again using:
>>>
>>>   httpd -M
>>
>>
>> Hmm no such command for ubuntu... googled around and found that apache2ctl
>> command should work the same magic:
>>
>> root@alan:/home/alan# apache2ctl -M
>> apache2: Could not reliably determine the server's fully qualified domain
>> name, using 127.0.1.1 for ServerName
>> Loaded Modules:
>>  core_module (static)
>>  log_config_module (static)
>>  logio_module (static)
>>  mpm_prefork_module (static)
>>  http_module (static)
>>  so_module (static)
>>  alias_module (shared)
>>  auth_basic_module (shared)
>>  authn_file_module (shared)
>>  authz_default_module (shared)
>>  authz_groupfile_module (shared)
>>  authz_host_module (shared)
>>  authz_user_module (shared)
>>  autoindex_module (shared)
>>  cgi_module (shared)
>>  dav_module (shared)
>>  dav_fs_module (shared)
>>  deflate_module (shared)
>>  dir_module (shared)
>>  env_module (shared)
>>  include_module (shared)
>>  mime_module (shared)
>>  negotiation_module (shared)
>>  php5_module (shared)
>>  reqtimeout_module (shared)
>>  rewrite_module (shared)
>>  ruby_module (shared)
>>  setenvif_module (shared)
>>  ssl_module (shared)
>>  status_module (shared)
>>  suexec_module (shared)
>>  wsgi_module (shared)
>> Syntax OK
>> root@alan:/home/alan#
>>
>>
>>
>>>
>>>
>>> or by looking at the 'pldd' equivalent that mod_python is not being
>>> loaded, as this prevents WSGIPythonHome from working.
>>>
>>> 2. Set LogLevel to 'debug' in Apache at global scope so that mod_wsgi
>>> logs extra details. This extra detail should include when it is
>>> overriding Python home based on WSGIPythonHome.
>>
>>
>> Changed. i get more/different stuff in error.log now. Spam like this:
>>
>> [Mon Jul 16 20:14:10 2012] [info] mod_wsgi (pid=5052): Process 'pin' has
>> died, restarting.
>> [Mon Jul 16 20:14:10 2012] [info] mod_wsgi (pid=5056): Starting process
>> 'pin' with uid=1000, gid=1000 and threads=1.
>> [Mon Jul 16 20:14:10 2012] [info] mod_wsgi (pid=5056): Python home
>> /usr/bin/python.
>> [Mon Jul 16 20:14:10 2012] [info] mod_wsgi (pid=5056): Initializing
>> Python.
>> [Mon Jul 16 20:14:10 2012] [info] mod_wsgi (pid=5053): Process 'pin' has
>> died, restarting.
>> [Mon Jul 16 20:14:10 2012] [info] mod_wsgi (pid=5054): Process 'pin' has
>> died, restarting.
>> [Mon Jul 16 20:14:10 2012] [info] mod_wsgi (pid=5059): Starting process
>> 'pin' with uid=1000, gid=1000 and threads=1.
>> [Mon Jul 16 20:14:10 2012] [info] mod_wsgi (pid=5058): Starting process
>> 'pin' with uid=1000, gid=1000 and threads=1.
>> ImportError: No module named site
>> [Mon Jul 16 20:14:10 2012] [info] mod_wsgi (pid=5059): Python home
>> /usr/bin/python.
>> [Mon Jul 16 20:14:10 2012] [info] mod_wsgi (pid=5058): Python home
>> /usr/bin/python.
>> [Mon Jul 16 20:14:10 2012] [info] mod_wsgi (pid=5059): Initializing
>> Python.
>> [Mon Jul 16 20:14:10 2012] [info] mod_wsgi (pid=5058): Initializing
>> Python.
>> ImportError: No module named site
>> [Mon Jul 16 20:14:10 2012] [info] mod_wsgi (pid=5057): Starting process
>> 'pin' with uid=1000, gid=1000 and threads=1.
>> ImportError: No module named site
>> ImportError: No module named site
>> [Mon Jul 16 20:14:10 2012] [info] mod_wsgi (pid=5057): Python home
>> /usr/bin/python.
>> [Mon Jul 16 20:14:10 2012] [info] mod_wsgi (pid=5057): Initializing
>> Python.
>> ImportError: No module named site
>>
>>>
>>> 3. Try and set the environment variable:
>>>
>>> PYTHONVERBOSE=1
>>> export PYTHONVERBOSE
>>>
>>> in the 'envvars' file for Apache, or if that doesn't exist in same
>>> directory as 'httpd' binary, use the init.d startup scripts to set it.
>>>
>>> This will result in Python logging lots of details about where it is
>>> importing stuff from on startup.
>>
>>
>> Even more spam in error.log now:
>> root@alan:/etc/apache2# cat /var/log/apache2/error.log | tail -100
>> import zipimport # builtin
>> # installed zipimport hook
>> ImportError: No module named site
>> # clear __builtin__._
>> # clear sys.path
>> # clear sys.argv
>> # clear sys.ps1
>> # clear sys.ps2
>> # clear sys.exitfunc
>> # clear sys.exc_type
>> # clear sys.exc_value
>> # clear sys.exc_traceback
>> # clear sys.last_type
>> # clear sys.last_value
>> # clear sys.last_traceback
>> # clear sys.path_hooks
>> # clear sys.path_importer_cache
>> # clear sys.meta_path
>> # clear sys.flags
>> # clear sys.float_info
>> # restore sys.stdin
>> # restore sys.stdout
>> # restore sys.stderr
>> # cleanup __main__
>> # cleanup[1] zipimport
>> # cleanup[1] signal
>> # cleanup[1] exceptions
>> # cleanup[1] _warnings
>> # cleanup sys
>> # cleanup __builtin__
>> # cleanup ints: 5 unfreed ints
>> # cleanup floats
>> [Mon Jul 16 20:19:31 2012] [info] mod_wsgi (pid=7728): Python home
>> /usr/bin/python.
>> [Mon Jul 16 20:19:31 2012] [info] mod_wsgi (pid=7728): Initializing
>> Python.
>> # installing zipimport hook
>> import zipimport # builtin
>> # installed zipimport hook
>> ImportError: No module named site
>> # clear __builtin__._
>> # clear sys.path
>> # clear sys.argv
>> # clear sys.ps1
>> # clear sys.ps2
>> # clear sys.exitfunc
>> # clear sys.exc_type
>> # clear sys.exc_value
>> # clear sys.exc_traceback
>> # clear sys.last_type
>> # clear sys.last_value
>> # clear sys.last_traceback
>> # clear sys.path_hooks
>> # clear sys.path_importer_cache
>> # clear sys.meta_path
>> # clear sys.flags
>> # clear sys.float_info
>> # restore sys.stdin
>> # restore sys.stdout
>> # restore sys.stderr
>> # cleanup __main__
>> # cleanup[1] zipimport
>> # cleanup[1] signal
>> # cleanup[1] exceptions
>> # cleanup[1] _warnings
>> # cleanup sys
>> # cleanup __builtin__
>> # cleanup ints: 5 unfreed ints
>> # cleanup floats
>> # installing zipimport hook
>> import zipimport # builtin
>> # installed zipimport hook
>> ImportError: No module named site
>> # clear __builtin__._
>> # clear sys.path
>> # clear sys.argv
>> # clear sys.ps1
>> # clear sys.ps2
>> # clear sys.exitfunc
>> # clear sys.exc_type
>> # clear sys.exc_value
>> # clear sys.exc_traceback
>> # clear sys.last_type
>> # clear sys.last_value
>> # clear sys.last_traceback
>> # clear sys.path_hooks
>> # clear sys.path_importer_cache
>> # clear sys.meta_path
>> # clear sys.flags
>> # clear sys.float_info
>> # restore sys.stdin
>> # restore sys.stdout
>> # restore sys.stderr
>> # cleanup __main__
>> # cleanup[1] zipimport
>> # cleanup[1] signal
>> # cleanup[1] exceptions
>> # cleanup[1] _warnings
>> # cleanup sys
>> # cleanup __builtin__
>> # cleanup ints: 5 unfreed ints
>> # cleanup floats
>> root@alan:/etc/apache2#
>>
>>>
>>>
>>> Graham
>>
>> alan
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "modwsgi" group.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msg/modwsgi/-/ZuKDdktwdhsJ.
>> 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 view this discussion on the web visit
> https://groups.google.com/d/msg/modwsgi/-/80Jrom1r4cwJ.
>
> 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.

Reply via email to