title: Using scipy.stats.stats in django after deployment
body: <p>I am in the process of creating an django-powered (1.3) interface to a package that relies heavily in scipy.stats.stats (scipy version 0.9.0), called <code>ovl</code> . During early development phases, using djangos own development-server, this was no problem. After deployment using apache debian/2.2.9 and mod_wsgi 3.3, this causes a serious problem.</p>
  
  <p>Whatever view I'm trying to load in the browser, it starts loading, and keeps doing that for a good 5 minutes (until time-out) and a 500 page appears. 
  Just importing scipy works but, does <i>not</i> make scipy.stats.stats or even scipy.stats available. This is no surprise; in the documentation in scipy's <strong>init</strong>.py it is stated that the subpackage <code>stats</code> needs to be imported explicitly. However, the same is said about the subpackage <code>cluster</code>, which imports in django (from the web <i>and</i> in the django-shell) without any problem and indeed shows up in <code>dir(scipy)</code>, which it <i>doesn't</i> in an ipython(0.10.2)-session, where it just doesn't show up, like I kinda expected.</p>
  
  <p>On the command <code>dir(scipy)</code>; it returns different results when coming from the web (a list of 568 strings, including the subpackage <code>cluster</code>) in the normal ipython shell (564 strings, no subpackage <code>cluster</code>) and surprise, surprise, in the django shell. In the django shell scipy has 570 attributes, including both <code>cluster</code> and <code>stats</code> packages.</p>
  
  <p>Another thing is, if I keep importing the <code>ovl</code>-package, while keeping the scipy.stats imports at a bit of a distance (not in one of the files of the app itself), sometimes I get a ViewDoesNotExist error stating that there is no method index in the views module while there clearly is one. Which reminds me of <a href="http://groups.google.com/group/django-users/browse_thread/thread/56ad04c5537db02d/8db31cb46d22dcd6?lnk=gst&amp;q=import+scipy#8db31cb46d22dcd6" rel="nofollow">this</a>.</p>
  
  <p>So now I'm thinking of these rather ugly solutions:</p>
  
  <ul>
  <li>Editing scipy's init to import the stats package so it appears 'normally' in dir(scipy) and is accessible through scipy.stats and I can use the old code.</li>
  <li>Snatching scipy's stat subpackage and making a regular package out of it (perhaps using a symlink)</li>
  </ul>
  
  <p>I'm reluctant in applying these solutions, however. The fact cluster shows up in scipy in a django environment worries me a bit. I thought maybe this has something to do with being www-data user when logging in from the web, but I don't know how to check for that. </p>
  
  <p>Did anyone else encounter this? Parts of this?
  Or otherwise helpful thoughts? </p>
  
  <p>Oh and another django deployment <i>does</i> work.</p>