logging module in virtualenv
<p>Ubuntu 12.10</p>

<p>While trying to get flask+logging to work in a virtualenv, I discovered that it seems the logging module is NOT getting imported from the virtualenv (last line in snippet below).</p>

<p>(I think this is having the side effect of not printing to the log file when my flask app is run inside a virtualenv, but I'll ask that separately if this question doesn't help)</p>

<p>Why is this?? Is the logging module somehow special?</p>

<pre><code># system python
# imports come from /usr/lib/python2.7 as expected

me@home:~/Desktop$ python
Python 2.7.3 (default, Apr 10 2013, 05:13:16) 
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
&gt;&gt;&gt; import re; print re
&lt;module 're' from '/usr/lib/python2.7/re.pyc'&gt;                          # OK
&gt;&gt;&gt; import logging; print logging
&lt;module 'logging' from '/usr/lib/python2.7/logging/__init__.pyc'&gt;       # OK
&gt;&gt;&gt; exit()

# make virtual env

me@home:~/Desktop$ virtualenv --version
14.0.0
me@home:~/Desktop$ virtualenv testenv
New python executable in /home/me/Desktop/testenv/bin/python
Installing setuptools, pip, wheel...done.

# Try again inside venv

me@home:~/Desktop$ source testenv/bin/activate
(testenv) me@home:~/Desktop$ python
Python 2.7.3 (default, Apr 10 2013, 05:13:16) 
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
&gt;&gt;&gt; import re; print re
&lt;module 're' from '/home/me/Desktop/testenv/lib/python2.7/re.pyc'&gt;     # OK!
&gt;&gt;&gt; import logging; print logging
&lt;module 'logging' from '/usr/lib/python2.7/logging/__init__.pyc'&gt;      # WHY?
</code></pre>