# Windows Python Development Guide A guide for working with Unearth data projects using Python and Windows. This document favors brevity over completeness, practically meaning "just enough info to search Google" which will be far more current than anything posted here. ## Prerequisites The following guide assumes the following software is installed on the user's machine - Windows 10 - [Visual Studio Community 2019](https://visualstudio.microsoft.com/vs/community/) - needed to collect Windows required to install open source software packages - Docker - necessary if you will be containerizing applications for distribution ## Process 1. Install Visual Studio Community extensions 2. Install Visual Studio Build Tools 3. Install a python version 4. Install a python version manager 5. Checkout the code with git 6. Create a virtual environment ### Install Visual Studio Community Extensions ![](https://i.imgur.com/MaKcVO3.png) 1. Refer to the example [Visual Studio 2019 config file](https://drive.google.com/open?id=1PRErxe3sJ8skMDKH8Eq8BRA0xv32g5yG) to review the list of dependencies. Most important include the C++ family which will allow compilation of open source projects like GDAL, OSGEO, and the crew 1. MSVC VS2019 C++ build tools 2. C++ CMake tools for windows 2. Install the [windows 8.1 sdk](https://go.microsoft.com/fwlink/p/?LinkId=323507) ### Install Visual Studio Build Tool Extensions 1. Refer to the example [Visual Studio 2019 Build Tool config file](https://drive.google.com/open?id=1PRErxe3sJ8skMDKH8Eq8BRA0xv32g5yG) for minimum required dependencies ### install a python version Go to python org site and install a 3.7.X or 3.8.X python interpreter. ### Install a version manager Follow the [instructions to install pyenv](https://github.com/pyenv-win/pyenv-win). Pyenv will allow you to install more than one version of Python in your environment at one time. ### Create a development environment After installing and activating python 3.7.6, create a pristine python development environment ```power # Install and activate the python interpreter pyenv install 3.7.6-amd64 pyenv local 3.7.6-amd64 # Chekout repository and enter directory git clone {project github repo url} cd {project_dir} # Setup a python virtual environment python -m venv . # Activate the virtual environment, using the newly created Scripts directory . Scripts\activate ``` ### Install project dependencies #### Install pre-compiled windows binaries with pip One way to install open source software on Windows machines is to install pre-compiled binaries. This is different than running a command like `pip install pandas`, which will often install dependencies that are incompatible with Windows. The following Go to the [Data Google Team Drive](https://drive.google.com/open?id=1cJky3mbxJwz8IoEG9aHnOKvZMR35FzKF&authuser=nate@unearthlabs.com&usp=drive_fs) and download all of the files. T ```power cd {download_path} pip install Rtree-0.9.3-cp37-cp37m-win_amd64.whl pip install GDAL-2.4.1-cp37-cp37m-win_amd64.whl pip install pyproj-2.4.2.post1-cp37-cp37m-win_amd64.whl pip install GDAL-3.0.4-cp37-cp37m-win_amd64.whl pip install Fiona-1.8.13-cp37-cp37m-win_amd64.whl pip install rasterio-1.0.24+gdal24-cp37-cp37m-win_amd64.whl ``` #### Install remaining dependencies ```power cd {project_dir} pip install -r requirements.txt pip install -e . # for cli commands ``` #### ## Faraday This section outlines steps necessary to run the Faraday app ```power ```