title: I upgraded Python 2.5 to 2.6 but now get "ImportError: No module named tagging.views"
body: <p><strong>THE ISSUE</strong></p>
  
  <p>The problem: it seems like the <code>tagging</code> module which I have in my <code>/srv/python-environments/saltycrane/lib/python2.5/site-packages/tagging</code> is not being included because I upgraded the system to 2.6, despite my assumption of relying on 2.5 in virtualenv mode.</p>
  
  <p>Here's the error in <code>/var/log/apache2/error.log</code>:</p>
  
  <pre><code>[Thu Mar 24 00:08:35 2011] [error] [client 127.0.0.1] mod_wsgi (pid=10470): Exception occurred processing WSGI script '/srv/workarounds/apache/django.wsgi'.
  [Thu Mar 24 00:08:35 2011] [error] [client 127.0.0.1] Traceback (most recent call last):
  [Thu Mar 24 00:08:35 2011] [error] [client 127.0.0.1]   File "/usr/lib/pymodules/python2.6/django/core/handlers/wsgi.py", line 241, in __call__
  [Thu Mar 24 00:08:35 2011] [error] [client 127.0.0.1]     response = self.get_response(request)
  [Thu Mar 24 00:08:35 2011] [error] [client 127.0.0.1]   File "/usr/lib/pymodules/python2.6/django/core/handlers/base.py", line 141, in get_response
  [Thu Mar 24 00:08:35 2011] [error] [client 127.0.0.1]     return self.handle_uncaught_exception(request, resolver, sys.exc_info())
  [Thu Mar 24 00:08:35 2011] [error] [client 127.0.0.1]   File "/usr/lib/pymodules/python2.6/django/core/handlers/base.py", line 176, in handle_uncaught_exception
  [Thu Mar 24 00:08:35 2011] [error] [client 127.0.0.1]     if resolver.urlconf_module is None:
  [Thu Mar 24 00:08:35 2011] [error] [client 127.0.0.1]   File "/usr/lib/pymodules/python2.6/django/core/urlresolvers.py", line 239, in _get_urlconf_module
  [Thu Mar 24 00:08:35 2011] [error] [client 127.0.0.1]     self._urlconf_module = import_module(self.urlconf_name)
  [Thu Mar 24 00:08:35 2011] [error] [client 127.0.0.1]   File "/usr/lib/pymodules/python2.6/django/utils/importlib.py", line 35, in import_module
  [Thu Mar 24 00:08:35 2011] [error] [client 127.0.0.1]     __import__(name)
  [Thu Mar 24 00:08:35 2011] [error] [client 127.0.0.1]   File "/srv/workarounds/urls.py", line 3, in &lt;module&gt;
  [Thu Mar 24 00:08:35 2011] [error] [client 127.0.0.1]     from tagging.views import tagged_object_list
  [Thu Mar 24 00:08:35 2011] [error] [client 127.0.0.1] ImportError: No module named tagging.views
  </code></pre>
  
  <p><strong>MY SETUP</strong></p>
  
  <p>Firstly, here's my setup:</p>
  
  <pre><code>$ python --version
  Python 2.6.6
  $ python
  &gt;&gt;&gt; import django
  django.VERSION
  (1, 2, 3, 'final', 0)
  </code></pre>
  
  <p>My django projects live in <code>/srv</code>. My virtual envs live in <code>/srv/python-environments</code></p>
  
  <p>If I <code>cd</code> into <code>/srv/</code> and do:</p>
  
  <p><code>source python-environments/saltycrane/bin/activate</code></p>
  
  <p>The python version becomes:</p>
  
  <pre><code>$ python --version
  Python 2.5.2
  </code></pre>
  
  <p>My project, <code>/srv/workarounds</code> uses <code>/srv/workarounds/apache/django.wsgi</code>, which is composed of:</p>
  
  <pre><code>import os, sys, site
  
  virtualenv = '/srv/python-environments/saltycrane/'
  
  ALLDIRS = [os.path.join(virtualenv, 'lib', 'python%s' % sys.version[:3], 'site-packages')]
  
  # Remember original sys.path.
  prev_sys_path = list(sys.path)
  
  # Add project directory
  sys.path.append( '/srv/' )
  sys.path.append( '/srv/workarounds/' )
  
  for directory in ALLDIRS:
      site.addsitedir( directory )
  
  new_sys_path = []
  for item in list(sys.path):
      if item not in prev_sys_path:
          new_sys_path.append(item)
          sys.path.remove(item)
  
  sys.path[:0] = new_sys_path
  
  os.environ['DJANGO_SETTINGS_MODULE'] = 'workarounds.settings'
  
  import django.core.handlers.wsgi
  application = django.core.handlers.wsgi.WSGIHandler()
  </code></pre>
  
  <p>The code basically adds <code>/srv/</code> and <code>/srv/workarounds</code> to the python path when the wsgi is run by Apache.</p>
  
  <p><strong>SO....</strong></p>
  
  <p>How can I adjust my wsgi to keep using Python 2.5.2 instead of 2.6? Or if not, how can I update my virtualenv to use python 2.6 packages with <code>pip</code>? </p>
  
  <p><strong>THINGS IM NOT SURE ABOUT</strong></p>
  
  <ol>
  <li><p>Perhaps it runs on 2.6 and <em>does</em> grab the <code>tagging</code> module, but the tagging module or a part of it isn't compatible, therefore that's why it complains of <code>No module named tagging.views</code> ?</p></li>
  <li><p>Maybe this has nothing to do with 2.5 to 2.6 and was always present? But I doubt this very much because I did several restarts with that code in place, and it worked fine. </p></li>
  <li><p>It could have been a Django subtle version update, I might have updated 1.1 or 1.2beta to 1.2.3 final.</p></li>
  </ol>
  
  <p><strong>EDIT</strong>: If I have the right mod_wsgi.so, it's compiled for 2.6. </p>
  
  <pre><code>/usr/lib/apache2/modules$ ldd mod_wsgi.so
      linux-gate.so.1 =&gt;  (0xf57fe000)
      libpython2.6.so.1.0 =&gt; /usr/lib/libpython2.6.so.1.0 (0xb760f000)
      libpthread.so.0 =&gt; /lib/libpthread.so.0 (0xb75f6000)
      libdl.so.2 =&gt; /lib/libdl.so.2 (0xb75f2000)
      libutil.so.1 =&gt; /lib/libutil.so.1 (0xb75ed000)
      libm.so.6 =&gt; /lib/libm.so.6 (0xb75c7000)
      libc.so.6 =&gt; /lib/libc.so.6 (0xb7482000)
      libssl.so.0.9.8 =&gt; /usr/lib/i686/cmov/libssl.so.0.9.8 (0xb7438000)
      libcrypto.so.0.9.8 =&gt; /usr/lib/i686/cmov/libcrypto.so.0.9.8 (0xb72e0000)
      libz.so.1 =&gt; /usr/lib/libz.so.1 (0xb72cc000)
      /lib/ld-linux.so.2 (0xb788e000)
  </code></pre>