title: twisted threadpool import fail
body: <p><strong>Context:</strong> </p>
  
  <p>I am trying to launch graphite with pypy interpreter.</p>
  
  <p><strong>Error:</strong> </p>
  
  <p>launching graphite(*) leads to  </p>
  
  <p><code>ImportError: cannot import name 'threadpool'</code>,</p>
  
  <p>even though launching a python (pypy) interpreter and typing <code>from twisted.python import threadpool</code> works.</p>
  
  <p><strong>Full stacktrace:</strong></p>
  
  <pre><code>15/09/2014 13:29:09 ::   File "app_main.py", line 75, in run_toplevel
  15/09/2014 13:29:09 ::   File "/opt/graphite/bin/carbon-cache.py", line 30, in &lt;module&gt;
  15/09/2014 13:29:09 ::     run_twistd_plugin(__file__)
  15/09/2014 13:29:09 ::   File "/opt/graphite/lib/carbon/util.py", line 93, in run_twistd_plugin
  15/09/2014 13:29:09 ::     runApp(config)
  15/09/2014 13:29:09 ::   File "/home/vagrant/test2/site-packages/twisted/scripts/twistd.py", line 23, in runApp
  15/09/2014 13:29:09 ::   File "/home/vagrant/test2/site-packages/twisted/application/app.py", line 380, in run
  15/09/2014 13:29:09 ::   File "/home/vagrant/test2/site-packages/twisted/scripts/_twistd_unix.py", line 193, in postApplication
  15/09/2014 13:29:09 ::   File "/home/vagrant/test2/site-packages/twisted/scripts/_twistd_unix.py", line 390, in startApplication
  15/09/2014 13:29:09 ::   File "/home/vagrant/test2/site-packages/twisted/application/app.py", line 658, in startApplication
  15/09/2014 13:29:09 ::   File "/home/vagrant/test2/site-packages/twisted/application/service.py", line 282, in startService
  15/09/2014 13:29:09 ::   File "/home/vagrant/test2/site-packages/twisted/application/service.py", line 282, in startService
  15/09/2014 13:29:09 ::   File "/opt/graphite/lib/carbon/writer.py", line 191, in startService
  15/09/2014 13:29:09 ::     reactor.callInThread(writeForever)
  15/09/2014 13:29:09 ::   File "/home/vagrant/test2/site-packages/twisted/internet/base.py", line 997, in callInThread
  15/09/2014 13:29:09 ::   File "/home/vagrant/test2/site-packages/twisted/internet/base.py", line 989, in getThreadPool
  15/09/2014 13:29:09 ::   File "/home/vagrant/test2/site-packages/twisted/internet/base.py", line 954, in _initThreadPool
  15/09/2014 13:29:09 :: ImportError: cannot import name 'threadpool'
  </code></pre>
  
  <p>I am using pypy (2.3.1-linux_x86_64-portable) on centos 6.5
  and have run pip to install twisted, whisper (and applied an additional <a href="https://stackoverflow.com/questions/19894708/cant-start-carbon-12-04-python-error-importerror-cannot-import-name-daem">patch</a>)</p>
  
  <p>(*) test2/bin/python /opt/graphite/bin/carbon-cache.py --instance=a start</p>
  
  <p><strong>Edit:</strong></p>
  
  <ul>
  <li><p>the virtualenv is called test2.</p></li>
  <li><p>test2/site-packages/twisted/python/threadpool.py{,c} shows twisted has threadpool</p></li>
  <li><p><code>test2/bin/pypy --info</code> shows <code>[usemodules] thread = True</code></p></li>
  <li><p><code>'twisted.python.threadpool' in sys.modules</code> returns false just before the failing import</p></li>
  </ul>
  
  <p><strong>Edit2:</strong></p>
  
  <p>adding <code>from twisted.python import threadpool</code> earlier in the call stack (in /opt/graphite/lib/carbon/util.py for instance) works and make graphite work.</p>