title: installing Gdal on Windows 10 with python 3.6.4: fatal error C1083: Cannot open include file: 'cpl_port.h'
body: <p>So I am trying to pip install gdal but got an error. </p>
  
  <pre><code>  extensions/gdal_wrap.cpp(3168): fatal error C1083: Cannot open include file: 'cpl_port.h': No such file or directory
    error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\BuildTools\\VC\\Tools\\MSVC\\14.13.26128\\bin\\HostX86\\x64\\cl.exe' failed with exit status 2
  </code></pre>
  
  <p>So I am running the following:</p>
  
  <ul>
  <li>Python 3.6.4 anaconda distribution</li>
  <li>Windows 10 (x64)</li>
  <li>Microsoft Visual 2017 Redistribute both x64 and x86 (both installed by the vs builder tool)</li>
  </ul>
  
  <p>MS Visual was installed because of this error before</p>
  
  <pre><code>error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": http://landinghub.visualstudio.com/visual-cpp-build-tools
  </code></pre>
  
  <p>Here is the trace log for the error:</p>
  
  <pre><code> C:\Users\0\Desktop\&gt;pip install gdal
  Collecting gdal
    Using cached GDAL-2.2.4.tar.gz
  Building wheels for collected packages: gdal
    Running setup.py bdist_wheel for gdal ... error
    Complete output from command c:\users\0\envs\ecoscan\scripts\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\0\\AppData\\Local\\Temp\\pip-build-wc3za_f8\\gdal\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d C:\Users\0\AppData\Local\Temp\tmp9t7nk1ompip-wheel- --python-tag cp36:
    running bdist_wheel
    running build
    running build_py
    creating build
    creating build\lib.win-amd64-3.6
    copying gdal.py -&gt; build\lib.win-amd64-3.6
    copying ogr.py -&gt; build\lib.win-amd64-3.6
    copying osr.py -&gt; build\lib.win-amd64-3.6
    copying gdalconst.py -&gt; build\lib.win-amd64-3.6
    copying gnm.py -&gt; build\lib.win-amd64-3.6
    creating build\lib.win-amd64-3.6\osgeo
    copying osgeo\gdal.py -&gt; build\lib.win-amd64-3.6\osgeo
    copying osgeo\gdalconst.py -&gt; build\lib.win-amd64-3.6\osgeo
    copying osgeo\gdalnumeric.py -&gt; build\lib.win-amd64-3.6\osgeo
    copying osgeo\gdal_array.py -&gt; build\lib.win-amd64-3.6\osgeo
    copying osgeo\gnm.py -&gt; build\lib.win-amd64-3.6\osgeo
    copying osgeo\ogr.py -&gt; build\lib.win-amd64-3.6\osgeo
    copying osgeo\osr.py -&gt; build\lib.win-amd64-3.6\osgeo
    copying osgeo\__init__.py -&gt; build\lib.win-amd64-3.6\osgeo
    Fixing build\lib.win-amd64-3.6\gdal.py build\lib.win-amd64-3.6\ogr.py build\lib.win-amd64-3.6\osr.py build\lib.win-amd64-3.6\gdalconst.py build\lib.win-amd64-3.6\gnm.py build\lib.win-amd64-3.6\osgeo\gdal.py build\lib.win-amd64-3.6\osgeo\gdalconst.py build\lib.win-amd64-3.6\osgeo\gdalnumeric.py build\lib.win-amd64-3.6\osgeo\gdal_array.py build\lib.win-amd64-3.6\osgeo\gnm.py build\lib.win-amd64-3.6\osgeo\ogr.py build\lib.win-amd64-3.6\osgeo\osr.py build\lib.win-amd64-3.6\osgeo\__init__.py
    Skipping optional fixer: ws_comma
    Fixing build\lib.win-amd64-3.6\gdal.py build\lib.win-amd64-3.6\ogr.py build\lib.win-amd64-3.6\osr.py build\lib.win-amd64-3.6\gdalconst.py build\lib.win-amd64-3.6\gnm.py build\lib.win-amd64-3.6\osgeo\gdal.py build\lib.win-amd64-3.6\osgeo\gdalconst.py build\lib.win-amd64-3.6\osgeo\gdalnumeric.py build\lib.win-amd64-3.6\osgeo\gdal_array.py build\lib.win-amd64-3.6\osgeo\gnm.py build\lib.win-amd64-3.6\osgeo\ogr.py build\lib.win-amd64-3.6\osgeo\osr.py build\lib.win-amd64-3.6\osgeo\__init__.py
    Skipping optional fixer: ws_comma
    running build_ext
    building 'osgeo._gdal' extension
    creating build\temp.win-amd64-3.6
    creating build\temp.win-amd64-3.6\Release
    creating build\temp.win-amd64-3.6\Release\extensions
    C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.13.26128\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -I../../port -I../../gcore -I../../alg -I../../ogr/ -I../../ogr/ogrsf_frmts -I../../gnm -I../../apps -Ic:\users\0\anaconda3\include -Ic:\users\0\anaconda3\include -I. "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.13.26128\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\cppwinrt" /EHsc /Tpextensions/gdal_wrap.cpp /Fobuild\temp.win-amd64-3.6\Release\extensions/gdal_wrap.obj
    gdal_wrap.cpp
    extensions/gdal_wrap.cpp(3168): fatal error C1083: Cannot open include file: 'cpl_port.h': No such file or directory
    error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\BuildTools\\VC\\Tools\\MSVC\\14.13.26128\\bin\\HostX86\\x64\\cl.exe' failed with exit status 2
  </code></pre>
  
  <p>Any ideas how to fix this? I just want use the <code>ogr2ogr</code> in gdal to convert .shp to GeoJSON then to topojson. </p>