ImportError when installing GDAL for Python 3.6

I am trying to install the GDAL library for my Anaconda Python 3.6. The conda install gdal usually the best way to do this job in the past, but it has not been updated for the new version of Python. This leaves me with pip installation and building from source code. I did this in both directions, but I still have the same error message when I do this:

 >>> import gdal Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/user/anaconda3/lib/python3.6/site-packages/GDAL-2.2.0-py3.6-linux-x86_64.egg/gdal.py", line 2, in <module> from osgeo.gdal import deprecation_warn File "/home/user/anaconda3/lib/python3.6/site-packages/GDAL-2.2.0-py3.6-linux-x86_64.egg/osgeo/__init__.py", line 21, in <module> _gdal = swig_import_helper() File "/home/user/anaconda3/lib/python3.6/site-packages/GDAL-2.2.0-py3.6-linux-x86_64.egg/osgeo/__init__.py", line 17, in swig_import_helper _mod = imp.load_module('_gdal', fp, pathname, description) File "/home/user/anaconda3/lib/python3.6/imp.py", line 242, in load_module return load_dynamic(name, filename, file) File "/home/user/anaconda3/lib/python3.6/imp.py", line 342, in load_dynamic return _load(spec) ImportError: /usr/local/lib/libgdal.so.20: undefined symbol: sqlite3_column_table_name 

I have Ubuntu 16.04. I searched the Internet extensively to find a solution, but none of these methods worked for me. Any thoughts?

+5
source share
2 answers

If you have not done so already, I suggest updating the condo. I had the same problem both on my local Mac OS machine and in my Debian Docker container container, and updating to 4.3.30 fixed this for both.

0
source

You need to call from osgeo import gdal

he even says that in your error the import of gdal is depreciating.

0
source

All Articles