0

In the interest of having a working solution accepted on Stack overflow with as much info as possible on the issues that come up with using pip to install Geopandas or a package like OSMnx that depends on it using pip on Windows 10 I'll post my workflow below

Hugh_Kelley
  • 988
  • 1
  • 9
  • 23

1 Answers1

1

Three possible problems and they have to do with the difference between pip and conda discussed here

First, pip requires Visual C++ to compile packages, while conda does not.

The easiest way to ensure that you have Visual C++ available is to install the community distribution of Visual Studio. Depending on the options selected this is potentially several gbs so a good internet connection helps a lot.

Second, use pip to install the wheels of GDAL version 2.4 not 3.0, Fiona Shapely and possibly Rtree. These can be found here.

If you have GDAL already installed via OSGeoW64 you'll need to uninstall that by deleteing the entire OSGEo4w folder in the C: drive

Pick the version for the architecture of python that you have installed, NOT the architecture of your computer. Check using this clever line that offers an indication of what the difference between architectures actually is.

import struct;print(struct.calcsize("P") * 8 )

Finally, you may need to set environmental variables. It's important to know that gdal-config and GDAL_CONFIG are specific to linux based OS's and for windows, you're looking for GDAL_VERSION and GDAL_DATA.

Be sure to pip uninstall <package> before installing from a wheel or otherwise, and be sure to actually import the packages before assuming that they have installed correctly, even if there weren't any error messages upon pip install

Lastly, there is a lot of helpful info already out there but not collected in a sinlge place so if there's something missing of course edit the answer to include.

edit: just tried this with a python environement using the 64bit version of python 3.7.4 and it also worked.

One note, initially, the install failed, OSError: could not find or load spatialindex_c.dll

To solve this and possibly other errors, pip uninstall and pip install the wheels for numpy GDAL Rtree Shapely and Fiona a second time. Either I did not install them in the correct order initially or their is a circular dependency that installing everything twice resolves.

edit: Stackoverflow just told me this q/a has over 1000 views while receiving 0 votes. I'm not concerned about the points or whatever but in the interest of having a working answer, if this doesn't work for you consider leaving a comment or adding an answer of your own.

Hugh_Kelley
  • 988
  • 1
  • 9
  • 23