Skip to content

Instantly share code, notes, and snippets.

@moosetraveller
Last active January 9, 2023 19:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save moosetraveller/1261fc849c1cc6019eedcbf929f7b460 to your computer and use it in GitHub Desktop.
Save moosetraveller/1261fc849c1cc6019eedcbf929f7b460 to your computer and use it in GitHub Desktop.
Prepare Embedded Python with GIS Packages for Windows

Prepare Embedded Python with GIS Packages for Windows

Download Python

Get PIP for Python

  • download get-pip.py from here
  • move to your python folder
  • open command prompt, change to your folder
  • open python39._pth in text editor and uncomment import site, save
  • run python get-pip.py

Install GDAL and Fiona

  • download and install Visual Studio Build Tools (if not yet installed)
    • select "Desktop development with C++"
  • download the wheel file for (unofficial) Fiona binaries from here, eg., Fiona-1.8.21-cp39-cp39-win_amd64.whl
  • download the wheel file for (unofficial) GDAL binaries from here, eg., GDAL-3.4.3-cp39-cp39-win_amd64.whl
  • download the wheel file for (unofficial) GDAL binaries from here, eg., hdbscan-0.8.28-cp39-cp39-win_amd64.whl
  • move both wheel files to your Python folder
  • install with python -m pip install GDAL-3.4.3-cp39-cp39-win_amd64.whl Fiona-1.8.21-cp39-cp39-win_amd64.whl hdbscan-0.8.28-cp39-cp39-win_amd64.whl

Install SpatiaLite

Note: Reason why we overwrite sqlite3.dll is because creation of the spatial enviroment fails with updateTableTriggers: "no such module: rtree".

Install Packages

  • create requirements.txt, for example:
geopandas
geojson
  • run python -m pip install -r requirements.txt

Verify

  • run python -c "import geopandas;" (no error should occur)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment