Search code examples
pythoniismoduleegg

python app on Windows IIS -- Error: module distribution not found


I am trying to get a python app running on Microsoft IIS, after using iwhelper to get the app "inited", I come across the following error. I tested on my development environment (manually ran python app.py) and everything works just fine, so I'm really confused).

Traceback (most recent call last):
  File "C:\dev\app\app_server.py", line 16, in 
    require("bottle_cork==0.11.1")
  File "C:\Python27\lib\site-packages\pkg_resources\__init__.py", line 921, in require
    needed = self.resolve(parse_requirements(requirements))
  File "C:\Python27\lib\site-packages\pkg_resources\__init__.py", line 808, in resolve
    raise DistributionNotFound(req)
DistributionNotFound: bottle-cork==0.11.1

However, I have the module bottle-cork with version "0.11.1" installed, as is seen here

== SYS.PATH ==

['C:\\dev\\tallgrass_cox_cmp\\server',
 'C:\\Python27\\lib\\site-packages\\wsgiref-0.1.2-py2.7.egg',
 'C:\\Python27\\lib\\site-packages\\isapi_wsgi-0.4.2-py2.7-win32.egg',
 'C:\\Python27\\lib\\site-packages\\argparse-1.3.0-py2.7.egg',
 'C:\\Python27\\lib\\site-packages\\virtualenv-12.0.7-py2.7.egg',
 'C:\\Python27\\lib\\site-packages\\beaker-1.7.0.dev0-py2.7.egg',
 'C:\\Python27\\lib\\site-packages\\bottle_cork-0.11.1-py2.7.egg',
 'C:\\Python27\\lib\\site-packages\\mysql_python-1.2.5-py2.7-win32.egg',
 'C:\\Python27\\lib\\site-packages\\pycrypto-2.6.1-py2.7-win32.egg',
 'C:\\Python27\\lib\\site-packages\\isapiwsgihelper-0.1.3-py2.7.egg',

I have no idea of what's going on, could someone please help me to take a look?


Solution

  • Turns out IIS is not that friendly with Python app. And a bunch other posts on how to run Django/Flask app on Windows Server using IIS all failed in my case. So I ended up making my python app a service using the Non-sucking Service Manager (NSSM). And used cherrypy as a server to bootstrap and run my application.

    For those of you who couldn't get python apps to run on Windows, consider this combination -- cherrypy + NSSM.