简体   繁体   English

在Ubuntu 16.04 Gdal上安装CartoDB编译错误

[英]CartoDB installation on ubuntu 16.04 gdal compile error

I followed the installation steps in https://gist.github.com/azvoleff/f8f06d22a8a4d89401e09d6607a5ecc4 我按照https://gist.github.com/azvoleff/f8f06d22a8a4d89401e09d6607a5ecc4中的安装步骤进行操作

to install cartoDB to Ubuntu 16.04. 将cartoDB安装到Ubuntu 16.04。

everything is fine and installed correctly (although i used RVM instead of getting ruby's source code and compile it myself as suggested from the steps). 一切都很好并且安装正确(尽管我使用了RVM而不是获取ruby的源代码并按照步骤中的建议自己进行编译)。

but when running: pip install --no-use-wheel -r python_requirements.txt 但是在运行时: pip install --no-use-wheel -r python_requirements.txt

there is an error, says about gdal, but it's different with the error mentioned in the steps. 关于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/

i'm new in ubuntu, previously i tried to set this up on centos (because i'm more familiar with centos), but it was worse than using ubuntu because many dependencies are missing / out of date. 我是ubuntu的新手,以前我曾尝试过在centos上进行设置(因为我对centos更为熟悉),但是它比使用ubuntu糟糕,因为缺少许多依赖项/过时了。

do anyone have any suggestion on how to successfully setup cartoDB in ubuntu / any other linux based machine? 有没有人对如何在ubuntu /其他基于Linux的机器上成功设置cartoDB有任何建议? (or what should i do with this compile error?) (或者我应该怎么处理这个编译错误?)

i guess i should get gdal version 1.10.0 ? 我想我应该得到gdal版本1.10.0吗? but how to do that in ubuntu... 但是如何在Ubuntu中做到这一点...

[UPDATE-1] [UPDATE-1]

Maybe it's because cpl_port.h not found from this error extensions/gdal_wrap.cpp:2853:22: fatal error: cpl_port.h: No such file or directory 也许是因为从此错误extensions/gdal_wrap.cpp:2853:22: fatal error: cpl_port.h: No such file or directory

so, i did install libgdal-dev per Oz123 suggests. 因此,我确实按照Oz123的建议安装了libgdal-dev。

apt-get install libgdal-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
libgdal-dev is already the newest version (2.2.2+dfsg-1~xenial1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

and my GDAL version is 而我的GDAL版本是

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

and sadly, error is still the same. 可悲的是,错误仍然存​​在。 i'm still trying to find out how to compile / change installed GDAL version to 1.10.0 because i assume the requirement is GDAL 1.10.0 and what i have is 2.2.2, that's why it tries to compile again, am i correct with this? 我仍在尝试查找如何将已安装的GDAL版本编译/更改为1.10.0,因为我假设要求是GDAL 1.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
...

[UPDATE-2-ANSWER FOR THIS SPECIFIC PROBLEM] [此特定问题的更新2-答案]

thx to Oz123, I execute: 到Oz123,我执行:

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

and retry the compile, and it fix this cpl_port.h problem. 然后重试编译,它可以解决此cpl_port.h问题。 but the installation still failed at the same installation step (GDAL compile), but i think i should ask this in different thread to keep this stack clean. 但安装仍在同一安装步骤(GDAL编译)中失败,但是我认为我应该在其他线程中询问此问题以保持堆栈清洁。

This is probably because you are missing libgdal-dev ( found through ubuntu package content search ). 这可能是因为您缺少libgdal-dev可通过ubuntu软件包内容搜索找到 )。

When ever you install a package with hard coded C dependecies you should make sure you have the build-dependencies. 每当您安装具有硬编码C依赖关系的软件包时,都应确保您具有构建依赖关系。

I guess I should get gdal version 1.10.0 ? 我想我应该得到gdal版本1.10.0吗? but how to do that in ubuntu... 但是如何在Ubuntu中做到这一点...

If you followed this step: 如果您遵循此步骤:

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

You will get a later version of GDAL. 您将获得更高版本的GDAL。

Never the less, you should install the build dependency, libgdal-dev with sudo apt-get install libgdal-dev , the repeat pip install --no-use-wheel -r python_requirements.txt , if you get more errors, look for the missing header file in the ubuntu packages content search pages, install the package and repeat until complete. libgdal-dev ,您应该使用sudo apt-get install libgdal-dev安装构建依赖libgdal-dev sudo apt-get install libgdal-dev ,重复pip install --no-use-wheel -r python_requirements.txt ,如果遇到更多错误,请查找ubuntu软件包内容搜索页面中缺少头文件,请安装该软件包并重复直到完成。

You should also pass the paths to pip: 您还应该将路径传递给pip:

export CPLUS_INCLUDE_PATH=/usr/include/gdal

export C_INCLUDE_PATH=/usr/include/gdal

pip install --no-use-wheel -r python_requirements.txt

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM