install.packages('sf') fails because it can't find proj_api.h or proj.h

Hi;

I'm a fair newbie to installing libraries in R and Rstudio, so I may need more help that normal.

This is on a iMac20,1 running Big Sur, RStudio 1.4.1717, R version 4.1.2.

I'm trying to install the 'sf' library. It's failing because it can't find proj_api.h and proj.h.

I'm using MacPorts for various other bits needed by sf. In the current version of proj (proj8), the proj_api.h file has been removed. The previous version (proj7) has it. I've installed that version and verified that the two header files live in /opt/local/lib/proj7.

But the R installer can't find them. Is there a way I can tell it to look in /opt/local/lib/proj7.

This is what the installer prints out before it fails.

Blockquote
checking proj.h usability... no
checking proj.h presence... no
checking for proj.h... no
checking proj_api.h usability... no
checking proj_api.h presence... no
checking for proj_api.h... no
configure: error: proj_api.h not found in standard or given locations.
ERROR: configuration failed for package ‘sf’

See this thread.

How does one tell install.packages() to install a binary package other than the most current?

When you see a message that a binary version is available but the source version is later, respond no.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.