Unable to install pygeoprocessing on Windows 10

Hello all,

Good day, I hope this topic reaches you well. I’m trying to install Pygeoprocessing on Windows 10 and I think after much tinkering, the main issue is the installation process not “seeing” my GDAL installation. Here’s a brief rundown of what I’ve done and tried:

  1. Tried installing pygeoprocessing using pip and the command line
    – Used py -m pip install pygeoprocessing
    – Failed when it got to the part where it was installing GDAL

  2. Per a previous topic (Unable To Install Pygeoprocessing on Mac), tried installing GDAL some other way first
    – After trying and failing with other methods, I ended up using OSGeo4W to install it
    – When I checked on the command line with gdalinfo --version, it returns GDAL 3.1.4, released 2020/10/20 so it looks like GDAL has successfully been installed

  3. But when I try to run py -m pip install pygeoprocessing from the command line, I see Running setup.py install for GDAL … and it eventually throws an error. So I’m wondering if I made a mistake in the installation somewhere that pip is just not “seeing” GDAL?

  4. Tried editing the environment variables per this tutorial (Setting up your GDAL and OGR Environmental Variables | GISforThought) and tried again, but that didn’t seem to work as I got the same error when trying Step 3 again.

I’m sure I’ve just made some very beginner mistake with paths, environment variables, or maybe in my GDAL install, but after searching and trying different things, I’m not sure how exactly to resolve the issue. If anyone has any previous experience, or has encountered this error before, I would greatly appreciate your input.

Thank you so much for your time.

2 Likes

Well, since gdalinfo --version works, that means that you’ve got your GDAL installation all setup properly, which is great!

My guess is that, in this case, I think OSGEO4W provides its own python … is that the case? If so, you may need to re-alias py to the python that’s in the OSGEO4W installation. Once that’s been done, you can test that GDAL is importable by running:

py -c "from osgeo  import gdal"

And if that crashes with an error, then there’s still a problem. If there’s no message at all, then it worked.

There’s an alternate solution, which is that pygeoprocessing is available on the conda-forge channel. So if you have conda installed, setting up a virtual environment would be a matter of:

conda create -y -p ./env -c conda-forge pygeoprocessing
conda activate ./env

And that should do the trick, with an environment in your current working directory that has GDAL and everything else needed for pygeoprocessing to execute (including pygeoprocessing).

Let us know how this goes!
James

2 Likes