在ubuntu 16.04 gdal compi上安装CartoDB

2024-04-18 22:55:41 发布

您现在位置:Python中文网/ 问答频道 /正文

我遵循了中的安装步骤 https://gist.github.com/azvoleff/f8f06d22a8a4d89401e09d6607a5ecc4

将cartoDB安装到Ubuntu16.04。在

一切都很好并且安装正确(尽管我使用了RVM而不是按照步骤中的建议获取ruby的源代码并自己编译)。在

但跑步时: pip install --no-use-wheel -r python_requirements.txt

有一个错误,关于gdal说,但它与步骤中提到的错误不同。在

DEPRECATION: --no-use-wheel is deprecated and will be removed in the future.  Please use --no-binary :all: instead.
Requirement already satisfied: chardet==2.3.0 in /usr/local/lib/python2.7/dist-packages (from -r python_requirements.txt (line 1))
Requirement already satisfied: argparse==1.2.1 in /usr/lib/python2.7 (from -r python_requirements.txt (line 2))
Requirement already satisfied: brewery==0.6 in /usr/local/lib/python2.7/dist-packages (from -r python_requirements.txt (line 3))
Requirement already satisfied: redis==2.4.9 in /usr/local/lib/python2.7/dist-packages (from -r python_requirements.txt (line 4))
Requirement already satisfied: python-varnish==0.1.2 in /usr/local/lib/python2.7/dist-packages (from -r python_requirements.txt (line 5))
Collecting gdal==1.10.0 (from -r python_requirements.txt (line 6))
  Using cached GDAL-1.10.0.tar.gz
Collecting csvkit==0.9.0 (from -r python_requirements.txt (line 7))
  Using cached csvkit-0.9.0.tar.gz
Collecting openpyxl==2.1.3 (from -r python_requirements.txt (line 8))
  Using cached openpyxl-2.1.3.tar.gz
Collecting xlrd>=0.7.1 (from csvkit==0.9.0->-r python_requirements.txt (line 7))
  Using cached xlrd-1.1.0.tar.gz
Collecting sqlalchemy>=0.6.6 (from csvkit==0.9.0->-r python_requirements.txt (line 7))
  Using cached SQLAlchemy-1.2.0.tar.gz
Collecting six>=1.6.1 (from csvkit==0.9.0->-r python_requirements.txt (line 7))
  Using cached six-1.11.0.tar.gz
Collecting python-dateutil==2.2 (from csvkit==0.9.0->-r python_requirements.txt (line 7))
  Using cached python-dateutil-2.2.tar.gz
Collecting dbf==0.94.003 (from csvkit==0.9.0->-r python_requirements.txt (line 7))
  Using cached dbf-0.94.003.tar.gz
Collecting jdcal (from openpyxl==2.1.3->-r python_requirements.txt (line 8))
  Using cached jdcal-1.3.tar.gz
Skipping bdist_wheel for gdal, due to binaries being disabled for it.
Skipping bdist_wheel for csvkit, due to binaries being disabled for it.
Skipping bdist_wheel for openpyxl, due to binaries being disabled for it.
Skipping bdist_wheel for xlrd, due to binaries being disabled for it.
Skipping bdist_wheel for sqlalchemy, due to binaries being disabled for it.
Skipping bdist_wheel for six, due to binaries being disabled for it.
Skipping bdist_wheel for python-dateutil, due to binaries being disabled for it.
Skipping bdist_wheel for dbf, due to binaries being disabled for it.
Skipping bdist_wheel for jdcal, due to binaries being disabled for it.
Installing collected packages: gdal, xlrd, sqlalchemy, jdcal, openpyxl, six, python-dateutil, dbf, csvkit
  Found existing installation: GDAL 2.2.0
    Uninstalling GDAL-2.2.0:
      Successfully uninstalled GDAL-2.2.0
  Running setup.py install for gdal ... error
    Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-U2YlBY/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-UB4Lg0-record/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-2.7
    copying gdal.py -> build/lib.linux-x86_64-2.7
    copying ogr.py -> build/lib.linux-x86_64-2.7
    copying osr.py -> build/lib.linux-x86_64-2.7
    copying gdalconst.py -> build/lib.linux-x86_64-2.7
    creating build/lib.linux-x86_64-2.7/osgeo
    copying osgeo/gdalconst.py -> build/lib.linux-x86_64-2.7/osgeo
    copying osgeo/gdal_array.py -> build/lib.linux-x86_64-2.7/osgeo
    copying osgeo/gdalnumeric.py -> build/lib.linux-x86_64-2.7/osgeo
    copying osgeo/osr.py -> build/lib.linux-x86_64-2.7/osgeo
    copying osgeo/__init__.py -> build/lib.linux-x86_64-2.7/osgeo
    copying osgeo/ogr.py -> build/lib.linux-x86_64-2.7/osgeo
    copying osgeo/gdal.py -> build/lib.linux-x86_64-2.7/osgeo
    running build_ext
    building 'osgeo._gdal' extension
    creating build/temp.linux-x86_64-2.7
    creating build/temp.linux-x86_64-2.7/extensions
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I../../port -I../../gcore -I../../alg -I../../ogr/ -I/usr/include/python2.7 -I. -I/usr/include -c extensions/gdal_wrap.cpp -o build/temp.linux-x86_64-2.7/extensions/gdal_wrap.o
    cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
    extensions/gdal_wrap.cpp:2853:22: fatal error: cpl_port.h: No such file or directory
    compilation terminated.
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

    ----------------------------------------
  Rolling back uninstall of GDAL
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-U2YlBY/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-UB4Lg0-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-U2YlBY/gdal/

我是ubuntu的新手,以前我试着在centos上设置它(因为我对centos比较熟悉),但它比使用ubuntu更糟糕,因为很多依赖项已经丢失/过时。在

有人对如何在ubuntu/任何其他基于linux的机器上成功安装cartoodb有什么建议吗?(或者我应该如何处理这个编译错误?)在

我想我应该买gdal 1.10.0版?但是如何在ubuntu中做到这一点。。。在

[更新-1]

可能是因为这个错误没有找到cpl_port.h extensions/gdal_wrap.cpp:2853:22: fatal error: cpl_port.h: No such file or directory

所以,我确实按照Oz123的建议安装了libgdal dev。在

^{pr2}$

我的GDAL版本是

gdalinfo --version
GDAL 2.2.2, released 2017/09/15

可悲的是,错误依然存在。 我仍然在尝试如何将安装的GDAL版本编译/更改为1.10.0,因为我假设需求是gdal1.10.0,而我拥有的是2.2.2,这就是为什么它会再次尝试编译,我说的对吗?在

...
Collecting gdal==1.10.0 (from -r python_requirements.txt (line 6))
Using cached GDAL-1.10.0.tar.gz
...
Installing collected packages: gdal, xlrd, sqlalchemy, jdcal, openpyxl, six, python-dateutil, dbf, csvkit
Found existing installation: GDAL 2.2.0
Uninstalling GDAL-2.2.0:
  Successfully uninstalled GDAL-2.2.0
Running setup.py install for gdal ... error
...

[更新-2-此特定问题的答案]

thx到Oz123,我执行:

export CPLUS_INCLUDE_PATH=/usr/include/gdal
export C_INCLUDE_PATH=/usr/include/gdal

然后重试编译,它修复了这个cpl_port.h问题。但是在同一个安装步骤(GDAL compile)中安装仍然失败,但是我认为我应该在不同的线程中询问这个问题,以保持堆栈干净。在


Tags: frompybuildtxtforlinuxlibusr
1条回答
网友
1楼 · 发布于 2024-04-18 22:55:41

这可能是因为缺少libgdal-devfound through ubuntu package content search)。在

当您安装带有硬编码的C依赖项的包时,您应该确保您有构建依赖项。在

I guess I should get gdal version 1.10.0 ? but how to do that in ubuntu...

如果您遵循此步骤:

sudo add-apt-repository ppa:ubuntugis/ppa
sudo apt-get update

您将获得更高版本的GDAL。在

更重要的是,您应该安装构建依赖项,libgdal-devsudo apt-get install libgdal-dev,repeatpip install no-use-wheel -r python_requirements.txt,如果出现更多错误,请在ubuntu包内容搜索页面中查找丢失的头文件,安装包并重复直到完成。在

您还应该将路径传递给pip:

^{pr2}$

相关问题 更多 >