在Heroku上安装GDAL Python绑定

时间:2018-12-12 19:55:23

标签: python heroku gdal

我试图制作一个使用osgeo的GDAL python绑定的heroku应用。我尝试了几件事,但没有任何效果。

我无法在部署中安装GDAL python绑定。这些是我当前的构建包

test-gerry的下一版本将使用:   1. heroku / python   2. heroku / nodejs

还有我的requirements.txt

attrs==18.2.0
Click==7.0
click-plugins==1.0.4
cligj==0.5.0
cycler==0.10.0
decorator==4.3.0
Fiona==1.8.4
matplotlib==3.0.2
munch==2.3.2
networkx==2.2
numpy==1.15.1
pandas==0.23.4
pyparsing==2.3.0
python-dateutil==2.7.5
pytz==2018.7
kiwisolver==1.0.1
Shapely==1.6.4.post2
six==1.12.0
scipy==1.1.0
geopandas==0.4.0
gerrychain==0.2.2
pyproj==1.9.5.1

当我将gdal == 2.3.1添加到requirments.txt时会失败

remote: -----> Python app detected
remote: -----> Installing requirements with pip
remote:        Collecting gdal==2.3.1 (from -r /tmp/build_11d41259c199f22382350ebd6af5e868/requirements.txt (line 23))
remote:          Downloading https://files.pythonhosted.org/packages/99/31/2e05c1be3196126fa04028aed51489f40ceea77e8361a80bc8b00fc463db/GDAL-2.3.1.tar.gz (557kB)
remote:        Installing collected packages: gdal
remote:          Running setup.py install for gdal: started
remote:            Running setup.py install for gdal: finished with status 'error'
remote:            Complete output from command /app/.heroku/python/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-m5dctdxu/gdal/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-tsr5btk3-record/install-record.txt --single-version-externally-managed --compile:
remote:            running install
remote:            running build
remote:            running build_py
remote:            creating build
remote:            creating build/lib.linux-x86_64-3.6
remote:            copying gdal.py -> build/lib.linux-x86_64-3.6
remote:            copying ogr.py -> build/lib.linux-x86_64-3.6
remote:            copying osr.py -> build/lib.linux-x86_64-3.6
remote:            copying gdalconst.py -> build/lib.linux-x86_64-3.6
remote:            copying gnm.py -> build/lib.linux-x86_64-3.6
remote:            copying gdalnumeric.py -> build/lib.linux-x86_64-3.6
remote:            creating build/lib.linux-x86_64-3.6/osgeo
remote:            copying osgeo/ogr.py -> build/lib.linux-x86_64-3.6/osgeo
remote:            copying osgeo/gdalconst.py -> build/lib.linux-x86_64-3.6/osgeo
remote:            copying osgeo/gnm.py -> build/lib.linux-x86_64-3.6/osgeo
remote:            copying osgeo/osr.py -> build/lib.linux-x86_64-3.6/osgeo
remote:            copying osgeo/gdal_array.py -> build/lib.linux-x86_64-3.6/osgeo
remote:            copying osgeo/gdal.py -> build/lib.linux-x86_64-3.6/osgeo
remote:            copying osgeo/__init__.py -> build/lib.linux-x86_64-3.6/osgeo
remote:            copying osgeo/gdalnumeric.py -> build/lib.linux-x86_64-3.6/osgeo
remote:            Fixing build/lib.linux-x86_64-3.6/gdal.py build/lib.linux-x86_64-3.6/ogr.py build/lib.linux-x86_64-3.6/osr.py build/lib.linux-x86_64-3.6/gdalconst.py build/lib.linux-x86_64-3.6/gnm.py build/lib.linux-x86_64-3.6/gdalnumeric.py build/lib.linux-x86_64-3.6/osgeo/ogr.py build/lib.linux-x86_64-3.6/osgeo/gdalconst.py build/lib.linux-x86_64-3.6/osgeo/gnm.py build/lib.linux-x86_64-3.6/osgeo/osr.py build/lib.linux-x86_64-3.6/osgeo/gdal_array.py build/lib.linux-x86_64-3.6/osgeo/gdal.py build/lib.linux-x86_64-3.6/osgeo/__init__.py build/lib.linux-x86_64-3.6/osgeo/gdalnumeric.py
remote:            Skipping optional fixer: ws_comma
remote:            Fixing build/lib.linux-x86_64-3.6/gdal.py build/lib.linux-x86_64-3.6/ogr.py build/lib.linux-x86_64-3.6/osr.py build/lib.linux-x86_64-3.6/gdalconst.py build/lib.linux-x86_64-3.6/gnm.py build/lib.linux-x86_64-3.6/gdalnumeric.py build/lib.linux-x86_64-3.6/osgeo/ogr.py build/lib.linux-x86_64-3.6/osgeo/gdalconst.py build/lib.linux-x86_64-3.6/osgeo/gnm.py build/lib.linux-x86_64-3.6/osgeo/osr.py build/lib.linux-x86_64-3.6/osgeo/gdal_array.py build/lib.linux-x86_64-3.6/osgeo/gdal.py build/lib.linux-x86_64-3.6/osgeo/__init__.py build/lib.linux-x86_64-3.6/osgeo/gdalnumeric.py
remote:            Skipping optional fixer: ws_comma
remote:            running build_ext
remote:            gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I../../port -I../../gcore -I../../alg -I../../ogr/ -I../../ogr/ogrsf_frmts -I../../gnm -I../../apps -I/app/.heroku/python/include/python3.6m -I/app/.heroku/python/lib/python3.6/site-packages/numpy/core/include -I/app/.heroku/vendor/include -c gdal_python_cxx11_test.cpp -o gdal_python_cxx11_test.o
remote:            building 'osgeo._gdal' extension
remote:            creating build/temp.linux-x86_64-3.6
remote:            creating build/temp.linux-x86_64-3.6/extensions
remote:            gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I../../port -I../../gcore -I../../alg -I../../ogr/ -I../../ogr/ogrsf_frmts -I../../gnm -I../../apps -I/app/.heroku/python/include/python3.6m -I/app/.heroku/python/lib/python3.6/site-packages/numpy/core/include -I/app/.heroku/vendor/include -c extensions/gdal_wrap.cpp -o build/temp.linux-x86_64-3.6/extensions/gdal_wrap.o -I/app/.heroku/vendor/include
remote:            extensions/gdal_wrap.cpp: In function ‘retStringAndCPLFree* wrapper_VSIGetSignedURL(const char*, char**)’:
remote:            extensions/gdal_wrap.cpp:4067:12: error: ‘VSIGetSignedURL’ was not declared in this scope
remote:                 return VSIGetSignedURL( utf8_path, options );
remote:                        ^~~~~~~~~~~~~~~
remote:            extensions/gdal_wrap.cpp:4067:12: note: suggested alternative: ‘VSIRewindL’
remote:                 return VSIGetSignedURL( utf8_path, options );
remote:                        ^~~~~~~~~~~~~~~
remote:                        VSIRewindL
remote:            extensions/gdal_wrap.cpp: In function ‘PyObject* _wrap_GetErrorCounter(PyObject*, PyObject*)’:
remote:            extensions/gdal_wrap.cpp:7465:14: error: ‘CPLGetErrorCounter’ was not declared in this scope
remote:                 result = CPLGetErrorCounter();
remote:                          ^~~~~~~~~~~~~~~~~~
remote:            extensions/gdal_wrap.cpp:7465:14: note: suggested alternative: ‘_wrap_GetErrorCounter’
remote:                 result = CPLGetErrorCounter();
remote:                          ^~~~~~~~~~~~~~~~~~
remote:                          _wrap_GetErrorCounter
remote:            extensions/gdal_wrap.cpp: In function ‘PyObject* _wrap_MkdirRecursive(PyObject*, PyObject*)’:
remote:            extensions/gdal_wrap.cpp:8553:16: error: ‘VSIMkdirRecursive’ was not declared in this scope
remote:                   result = VSIMkdirRecursive((char const *)arg1,arg2);
remote:                            ^~~~~~~~~~~~~~~~~
remote:            extensions/gdal_wrap.cpp:8553:16: note: suggested alternative: ‘VSIReadDirRecursive’
remote:                   result = VSIMkdirRecursive((char const *)arg1,arg2);
remote:                            ^~~~~~~~~~~~~~~~~
remote:                            VSIReadDirRecursive
remote:            extensions/gdal_wrap.cpp: In function ‘PyObject* _wrap_RmdirRecursive(PyObject*, PyObject*)’:
remote:            extensions/gdal_wrap.cpp:8623:16: error: ‘VSIRmdirRecursive’ was not declared in this scope
remote:                   result = VSIRmdirRecursive((char const *)arg1);
remote:                            ^~~~~~~~~~~~~~~~~
remote:            extensions/gdal_wrap.cpp:8623:16: note: suggested alternative: ‘VSIReadDirRecursive’
remote:                   result = VSIRmdirRecursive((char const *)arg1);
remote:                            ^~~~~~~~~~~~~~~~~
remote:                            VSIReadDirRecursive
remote:            extensions/gdal_wrap.cpp: In function ‘PyObject* _wrap_GetActualURL(PyObject*, PyObject*)’:
remote:            extensions/gdal_wrap.cpp:8788:24: error: ‘VSIGetActualURL’ was not declared in this scope
remote:                   result = (char *)VSIGetActualURL((char const *)arg1);
remote:                                    ^~~~~~~~~~~~~~~
remote:            extensions/gdal_wrap.cpp:8788:24: note: suggested alternative: ‘_wrap_GetActualURL’
remote:                   result = (char *)VSIGetActualURL((char const *)arg1);
remote:                                    ^~~~~~~~~~~~~~~
remote:                                    _wrap_GetActualURL
remote:            extensions/gdal_wrap.cpp: In function ‘PyObject* _wrap_GetFileSystemsPrefixes(PyObject*, PyObject*)’:
remote:            extensions/gdal_wrap.cpp:8962:25: error: ‘VSIGetFileSystemsPrefixes’ was not declared in this scope
remote:                   result = (char **)VSIGetFileSystemsPrefixes();
remote:                                     ^~~~~~~~~~~~~~~~~~~~~~~~~
remote:            extensions/gdal_wrap.cpp:8962:25: note: suggested alternative: ‘_wrap_GetFileSystemsPrefixes’
remote:                   result = (char **)VSIGetFileSystemsPrefixes();
remote:                                     ^~~~~~~~~~~~~~~~~~~~~~~~~
remote:                                     _wrap_GetFileSystemsPrefixes
remote:            extensions/gdal_wrap.cpp: In function ‘PyObject* _wrap_GetFileSystemOptions(PyObject*, PyObject*)’:
remote:            extensions/gdal_wrap.cpp:9026:24: error: ‘VSIGetFileSystemOptions’ was not declared in this scope
remote:                   result = (char *)VSIGetFileSystemOptions((char const *)arg1);
remote:                                    ^~~~~~~~~~~~~~~~~~~~~~~
remote:            extensions/gdal_wrap.cpp:9026:24: note: suggested alternative: ‘_wrap_GetFileSystemOptions’
remote:                   result = (char *)VSIGetFileSystemOptions((char const *)arg1);
remote:                                    ^~~~~~~~~~~~~~~~~~~~~~~
remote:                                    _wrap_GetFileSystemOptions
remote:            error: command 'gcc' failed with exit status 1
remote:            
remote:            ----------------------------------------
remote:        Command "/app/.heroku/python/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-m5dctdxu/gdal/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-tsr5btk3-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-m5dctdxu/gdal/
remote:  !     Push rejected, failed to compile Python app.
remote: 
remote:  !     Push failed
remote: Verifying deploy...
remote: 
remote: !   Push rejected to test-gerry.
remote:

我设置了config var BUILD_WITH_GEO_LIBRARIES = 1,它将正确构建,但是当我尝试在python控制台中导入osgeo时,它不存在。

我看过使用构建包,但找不到包含有效的python绑定的构建包。

如何在heroku上获取GDAL python绑定?

0 个答案:

没有答案