title: Installing gdal with conda and setting environmental variables
body: <p>I have been trying to get the <strong>gdal</strong> library work using Python 2.7 and Anaconda in Windows 8 environment. </p>
  
  <p>Besides gdal, I have also installed libgdal (frankly, I don't really understand the difference between the two). I now seem to have gdal 2.1.0 and 2.0.2 as well as libgdal 2.1.0. </p>
  
  <p>However, when I run my Py code, there is a gdal error:</p>
  
  <blockquote>
    <p>'gdalwarp' is not recognized as an internal or external command,
    operable program or batch file.</p>
  </blockquote>
  
  <p>I have already set the GDAL_DATA environmental variable to point to </p>
  
  <blockquote>
    <p>C:\Anaconda\pkgs\libgdal-2.1.0-vc9_0\Library\share\gdal</p>
  </blockquote>
  
  <p>I have also added a path, although I am not entirely sure where this should point to:</p>
  
  <blockquote>
    <p>C:\Anaconda\pkgs\libgdal-2.1.0-vc9_0\Library\bin</p>
  </blockquote>
  
  <p>I have tried the same with gdal 2.0.2 without success. gdalwarp.exe does seem to exist under libgdal 2.1.0 and gdal 2.0.2.</p>
  
  <p>Any ideas? Is there an issue with the installation or have I not set the environmental variables correctly? </p>
  
  <p>FYI, I have tried various installation commands, notably:</p>
  
  <pre><code>conda install gdal
  conda install -c conda-forge gdal
  conda install -c anaconda gdal
  </code></pre>
  
  <p><strong>Addendum</strong>: I have found a manual solution: I set the GDAL_DATA and PATH variables in the terminal (pointing to libgdal 2.1.0) before running the code...</p>
  
  <p>However, there is still an issue when I run my Py code: it is supposed to convert a tiff file to shp with gdal_polygonize:</p>
  
  <pre><code>cmd = 'gdal_polygonize.py %s -f "ESRI Shapefile" %s'%(dst_tif, dst_shp)
  </code></pre>
  
  <p>There is no error but the shapefile is not created (which leads to an error later on in the code). Any ideas as to why gdal is still not working correctly?</p>
  
  <p>I have tried pointing the env variables to osgeo:</p>
  
  <pre><code>set PATH=%PATH%;C:\Anaconda2\Lib\site-packages\osgeo\scripts
  set GDAL_DATA=C:\Anaconda2\Lib\site-packages\osgeo\data\gdal
  </code></pre>
  
  <p>Gdalinfo works but the gdal_polygonize used in my Py code does not appear to work. </p>