5

I have some BigTiff files that I need to read into Python using gdal to do some analyses. According to GDAL's documentation:

When built with internal libtiff or with libtiff >= 4.0, GDAL also supports reading and writing BigTIFF files (evolution of the TIFF format to support files larger than 4 GB).

My version of libtiff is 4.0.9, so there should be no problem. However, if I try

bt = gdal.Open('path_to_bigtiff.tif'), 

bt is a NoneType. I tested to ensure that non-BigTIFF files are readable with gdal.Open(), which they are.

Furthermore, if I check the list of gdal's supported drivers' metadata like this:

md = gdal.GetDriverByName('GTiff').GetMetadata()
if md['DMD_CREATIONOPTIONLIST'].find('BigTIFF') == -1:
    return 'BigTIFF is not supported'

BigTIFFs are not supported. My version of gdal is 2.2.2.

Using Anaconda, I created a new environment with

conda create --name test1 gdal

but I get the same result--gdal 2.2.2 is installed along with libtiff 4.0.9 and BigTiff files still cannot be read.

Using Anaconda again, I created a new environment with

conda create --name test2 gdal=2.3.1 -c conda-forge

but when I run import gdal in the test2 environment, I get the error message

ImportError: DLL load failed: The specified module could not be found.

How can I install a version of gdal that will permit me to load BigTiffs? I would also like it to be compatible with rasterio and fiona if possible.

Here is the output from conda info for the environment containing 2.2.2: (geoenv) C:\Users\Jon>conda info

     active environment : geoenv
    active env location : C:\Users\Jon\Anaconda3\envs\geoenv
            shell level : 2
       user config file : C:\Users\Jon\.condarc
 populated config files : C:\Users\Jon\.condarc
          conda version : 4.5.9
    conda-build version : 3.0.27
         python version : 3.6.3.final.0
       base environment : C:\Users\Jon\Anaconda3  (writable)
           channel URLs : https://repo.anaconda.com/pkgs/main/win-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/free/win-64
                          https://repo.anaconda.com/pkgs/free/noarch
                          https://repo.anaconda.com/pkgs/r/win-64
                          https://repo.anaconda.com/pkgs/r/noarch
                          https://repo.anaconda.com/pkgs/pro/win-64
                          https://repo.anaconda.com/pkgs/pro/noarch
                          https://repo.anaconda.com/pkgs/msys2/win-64
                          https://repo.anaconda.com/pkgs/msys2/noarch
          package cache : C:\Users\Jon\Anaconda3\pkgs
                          C:\Users\Jon\AppData\Local\conda\conda\pkgs
       envs directories : C:\Users\Jon\Anaconda3\envs
                          C:\Users\Jon\AppData\Local\conda\conda\envs
                          C:\Users\Jon\.conda\envs
               platform : win-64
             user-agent : conda/4.5.9 requests/2.18.4 CPython/3.6.3 Windows/10 Windows/10.0.15063
          administrator : False
             netrc file : None
           offline mode : False
  • @Luke I added the output of conda info. I have tried every possible install combo I could think of--when I install from conda-forge, I always get the ImportError, and when I install from conda, I can't read BigTiffs. – Jon Aug 6 '18 at 23:15
  • @Luke I also just tried installing gdal 2.2.4 from conda-forge--same result. Cannot import. – Jon Aug 6 '18 at 23:23
  • I having this problem even after the conda create -n testgdal -c conda-forge gdal vs2015_runtime=14 procedure. It appears a problem related to DLL. And when I don't install this gdal version the problem is that the spyder can't read BigTIFF files. I don't know what to do anymore :( – user132356 Nov 22 '18 at 13:56
  • This does not really answer the question. If you have a different question, you can ask it by clicking Ask Question. You can also add a bounty to draw more attention to this question once you have enough reputation. - From Review – aldo_tapia Nov 22 '18 at 15:00
8

Issues:

  1. The Anaconda default gdal may be built without BigTIFF support. If I create a non conda-forge env, i.e conda create -n testgdal gdal I can reproduce the md['DMD_CREATIONOPTIONLIST'].find('BigTIFF') == -1 no BigTIFF issue.
  2. There seems to be an incompatibility between the latest version of conda and vs2015_runtime and conda-forge. I updated my conda to 4.5.9 to match yours and vs2015_runtime (the Visual C++ runtime for applications compiled with MS Visual Studio) was upgraded from 14 to 15. If I then create a conda env with gdal from the conda-forge channel, I get the same ImportError: DLL load failed.

Fix:

If I create a conda-forge env and specify vs2015_runtime=14, everything works:

conda create -n testgdal -c conda-forge gdal vs2015_runtime=14
activate testgdal 

(testgdal)  python
Python 3.6.6 | packaged by conda-forge | (default, Jul 26 2018, 11:48:23) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from osgeo import gdal
>>> md = gdal.GetDriverByName('GTiff').GetMetadata()
>>> md['DMD_CREATIONOPTIONLIST'].find('BigTIFF')
2953
  • I did leave out an important step--the issues started after I updated conda. I thought that previously I could read BigTiffs but I wasn't sure, and I had forgotten until I read your answer that I had updated conda this morning. I'll check tomorrow if specifying the v14 runtime fixes things. – Jon Aug 7 '18 at 0:55
  • It worked--could you add a little about what the runtime variable does? Now off to make it play nice with rasterio... – Jon Aug 7 '18 at 17:22
  • @Jon edited. It's not a variable, it's a package – user2856 Aug 7 '18 at 20:04
3

Here's the discussion on the conda-forge lists with the background on the DLL load error. I encountered the same issue where it stopped working after doing a conda update gdal, and pinning vs2015_runtime to 14 works as noted.

  • hey can you share more insights? I have the same error when opening a BigTiff "ERROR 4: This is a BigTIFF file. BigTIFF is not supported by this version of GDAL and libtiff." with GDAL 2.3.2, vs2015_runtime and libtiff 4.0.10 – lorenzori Jul 9 at 13:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.