I’d like to use Python's Shapely in this environment:
- In a Python 2.6 script implementing a WSGI application
- Deployed on Windows behind Apache httpd 2.x
Alas, I get this error logged by Apache:
WindowsError: [Error 126] The specified module could not be found
The traceback reveals a problem loading the “geos_c.dll”:
File "C:\\Python\\Python26\\lib\\site-packages\\shapely\\geos.py", line 76, in <module>
_lgeos = CDLL("geos_c.dll") # DJH
File "C:\\Python\\Python26\\lib\\ctypes\\__init__.py", line 354, in __init__
self._handle = _dlopen(self._name, mode)
This is thrown immediately upon “import shapely.wkb”, or any other Shapely library that imports shapely.geos.
This has the smell of some sort of “path problem”, but I have fiddled with every possible PATH and PYTHONPATH setting both inside and outside of Apache.
I can repeat this in a diminutive app (not only my larger application), which shows that even loading nothing else, I can trip this error. I’d be willing to post/share my sample code and fragment from my Apache conf... but you’d have to already have some familiarity with Apache and Python WSGI on Windows for it to mean much.
Note that calling similar script (using Shapely) as a CGI (behind Apache) work fine. So this sounds like a DLL loading problem peculiar to Windows+Apache+mod_wsgi. (Not a Shapely or geos_c.dll bug, per se.) However, none of my other Python+WSGI+Window+Apache scripts are having the same problem.
Any advice? Thanks in advance!