I have developed a small app which requires the Shapely python library. I installed it on windows via the .exe file so it automatically put the necessary DLL files (geos.dll , geos_c.dll) in Python27\Lib\site-packages\shapely\DLLs.
When i tried to create a virtualenv on my box , i installed shapely via pip but it didnt put those DLL files and so i got this error:
from shapely.geos import lgeos
File "...\lib\site-packages\shapely\geos.py", line 71, in <module>
_lgeos = CDLL("geos.dll")
File "C:\Python27\Lib\ctypes\__init__.py", line 353, in __init__
self._handle = _dlopen(self._name, mode)
WindowsError: [Error 126] The specified module could not be found
So i manually replaces those 2 DLL files in the virtualenv\Lib\site-packages\shapely\DLLs folder and it worked.
Now i am trying to deploy the app on heroku but again it failed because of the following error:
from shapely.geos import lgeos
_lgeos = load_dll('geos_c', fallbacks=['libgeos_c.so.1', 'libgeos_c.so'])
file "/app/.heroku/python/lib/python2.7/site-packages/shapely/geos.py", line 44, in load_dll
from shapely.coords import required
file "/app/.heroku/python/lib/python2.7/site-packages/shapely/geos.py", line 47, in <module>
libname, fallbacks or []))
Error: Could not find library geos_c or load any of its variants ['libgeos_c.so.1', 'libgeos_c.so']
Process exited with status 1
State changed from starting to crashed
So i assumed its crashing because of those 2 DLL files not being there. I copied those 2 files in a seperate folder and pushed them via git
I made a .profile file in my app root to copy those 2 files to the python environment
.profile
#Copy Shapely DLL Files to Site packages
cp -r $HOME/env_files/DLLs $HOME/.heroku/python/lib/python2.7/site-packages/shapely/
but still the app is crashing with the same error.
Can anyone help me out with this ?