Borealis
Borealis

Reputation: 8480

Installing Rasterio on Ubuntu fails with ImportError

I have an AWS EC2 p2.xlarge instance running on Ubuntu 16.04.4 LTS that was created using the AWS Deep Learning AMI (DLAMI). I am using the keras/Tensor Flow conda environment:

$ source activate tensorflow_p36

I am attempting to install Rasterio and GDAL on top of the Keras - Tensor Flow AMI installations using these commands (source):

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

The GDAL install seems to work:

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

However, when I try to import rasterio in Python, it yields the following error:

(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
>>> 

How can I clear this error so that I can import and use rasterio in Python?

Upvotes: 3

Views: 951

Answers (1)

L. Chaumartin
L. Chaumartin

Reputation: 54

I had a similar issue trying to import rasterio with GDAL 2.x installed. You should try to install GDAL 1.11 instead.

Upvotes: 0

Related Questions