David Inman
David Inman

Reputation: 125

'ACCEPT_USE_OF_DEPRECATED_PROJ_API_H' error when installing cartopy

When I do a pip install of cartopy, I get a (very long) error which includes this key component:

'To use the proj_api.h you must define the macro ACCEPT_USE_OF_DEPRECATED_PROJ_API_H'

There are a variety of solutions proposed to this online, but most of them assume you are running inside of a Mac, and suggest to downgrade one's proj install using brew - but this is occurring for me on a Linux server. It is also marked as "resolved" on the cartopy github. There is no obvious solution for how to get around this macro issue, and I have tried different version installs.

Upvotes: 2

Views: 2233

Answers (2)

Hanson Zhao
Hanson Zhao

Reputation: 11

I tried the solution above but it did not work. So I solved this by doing:

sudo cp /usr/include/proj_api.h /usr/include/proj_api.h.backup
sudo vim /usr/include/proj_api.h

And modified the file as:

36 #ifndef ACCEPT_USE_OF_DEPRECATED_PROJ_API_H
37 #define ACCEPT_USR_OF_DEPRECATED_PROJ_API_H 1
38 #endif

And it worked so far.

Upvotes: 1

David Inman
David Inman

Reputation: 125

I am adding this solution because it is, so far as I know, new on the web. After some work with a colleague, we came up with the following solution to this error:

export CFLAGS="-I/usr/include -DACCEPT_USE_OF_DEPRECATED_PROJ_API_H=1"

The use of "I" and "D" without spaces is intentional. Hopefully this helps someone else.

Upvotes: 3

Related Questions