borizzzzz
borizzzzz

Reputation: 620

Pip install --global-option="-L/<library path>": option -L not recongnised

I am trying to install cartopy on a Windows machine, and have previously installed QGIS and GEOS through OSGeo4W64. Now, when I try installing cartopy, I get the following error:

fatal error: 'geos_c.h' file not found

As mentioned, GEOS does exist and the file is also to be found within the directory. I the tried giving Pip the absolute path to the library as a global option, as follows:

pip install --global-option="-Lc:\OSGeo4W64\include"

This, unfortunately didn't work because Pip didn't recognise the -L library option:

error: option -L not recognized.

I tried -I, -l, and -i as well, just to see what would happen, but I get the same error every time. I also found examples on how to give paths to global-option and they did use -L and -I without problems. What could I be doing wrong?

Any help would be greatly appreciated.

Upvotes: 4

Views: 1215

Answers (1)

pelson
pelson

Reputation: 21849

It depends where you get your GEOS from as to which GEOS header file you should be linking against. If you get it from Christoph Gohlke's excellent binaries, or conda-forge, enthought, or Anaconda, I believe all rename geos_c.h to geos.h. If you get it from other sources, it may be that that renaming doesn't take place.

You can see how conda-forge build cartopy on Windows at https://github.com/conda-forge/cartopy-feedstock/blob/master/recipe/. The two important files:

Notice how that latter patch file renames the header dependency to geos.h, rather than geos_c.h because it is using the GEOS packaged by conda-forge. You may need to do a similar thing in your situation.

A history on this subject can also be found at https://github.com/SciTools/conda-recipes-scitools/issues/29#issuecomment-66497972.

Upvotes: 2

Related Questions