在Ubuntu上安装Rasterio失败,导致ImportError

时间:2018-05-17 03:30:53

标签: python amazon-web-services tensorflow gdal rasterio

我在使用AWS Deep Learning AMI (DLAMI)创建的Ubuntu 16.04.4 LTS上运行AWS EC2 p2.xlarge实例。我正在使用keras / Tensor Flow conda环境:

$ source activate tensorflow_p36

我正在尝试使用这些命令(source)在Keras - Tensor Flow AMI安装之上安装Rasterio和GDAL:

$ sudo add-apt-repository ppa:ubuntugis/ppa
$ sudo apt-get update
$ sudo apt-get install python-numpy gdal-bin libgdal-dev
$ pip install rasterio

GDAL安装似乎有效:

$ gdalinfo --version
GDAL 2.1.3, released 2017/20/01

但是,当我尝试在Python中导入rasterio时,会产生以下错误:

(tensorflow_p36) ubuntu@ip-171-11-7-03:~$ python
Python 3.6.4 |Anaconda, Inc.| (default, Jan 16 2018, 18:10:19) 
[GCC 7.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import rasterio
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/ubuntu/anaconda3/envs/tensorflow_p36_test/lib/python3.6/site-packages/rasterio/__init__.py", line 15, in <module>
    from rasterio._base import (
ImportError: /usr/lib/libgdal.so.20: undefined symbol: sqlite3_column_table_name
>>> 

如何清除此错误以便我可以在Python中导入和使用rasterio?

1 个答案:

答案 0 :(得分:0)

我在尝试导入安装了GDAL 2.x的rasterio时遇到了类似的问题。您应该尝试安装GDAL 1.11。