The error means you do not have the PROJ.4 library installed; it is the backend that handles various projection tasks (as you no doubt have guessed). {sf} requires three such backends - GDAL, PROJ and GEOS - to function correctly.

I am not a Mac user, but according to the documentation it might be handled by

brew install proj

on the command line.

2 Likes

Hi, and welcome!

Please see the FAQ: What's a reproducible example (`reprex`) and how do I do one? Using a reprex, complete with representative data will attract quicker and more answers. Not needed for this type of question, though.

The short answer is that things went south when accepting the offer to install from source. Sometimes things go smoothly, and often you get the dreaded non-zero exit status or, configuration failed.

This is due to Apple's non-standard compiler. St. Simon Urbanek of the R Core Development Team relieves MAC users like us of the brain damage required to edit the source code to allow it to compile on our machines and provides binary versions. Normally, this takes 7-10 days after a new CRAN version appears. devtools versions don't get that love, however.

I'm happily using sf_0.8-1 in binary, and it happily chirps Linking to GEOS 3.7.2, GDAL 2.4.2, PROJ 5.2.0.

Thanks for the suggestion @jlacko! I do have PROJ.4 installed though so I guess it might be a detection issue...

Anyway, I think I'll wait for the binary in the light @technocrat's reply :slight_smile:

Thanks!

I'll give the reprex section a read, thanks for sharing it :slight_smile:

Your reply was super interesting to read! Considering what you said, that sf 0.8-1 works in my computer, and the fact I'm not in dire need of using version 0.9-0, waiting for the binary version seems like the way to go :slight_smile:

Thanks again :smiley:

1 Like

Oki, makes perfect sense.

Should you feel the irrational need to live on the bleeding edge (and from what I am told PROJ.4 version 6.0.0 and higher are not for the faint of heart) you may have to specify the paths to GEOS, GDAL and PROJ manually via --configure-args.

In such case you might find this issue an interesting read: https://github.com/r-spatial/sf/issues/335#issuecomment-484985276

I've never found myself in such desperate need of the latest version that I set a hair-on-fire alarm to check every thirty minutes, myself. :grin:

Same thing here; trying to install sf 0.9-0 on macOS Catalina. If I run this command:

% brew install proj      
Warning: proj 7.0.0 is already installed and up-to-date
To reinstall 7.0.0, run `brew reinstall proj`

Reinstalling doesn't work either. I too shall wait for the binary to be released...

1 Like

Thanks for the link @jlacko! I'll try to resist the temptation of trying it out myself though xD

I'm currently in a weird place when it comes to knowing how to use my computer. I know a little bit, so sometimes I can install software that takes more than a package.install() (or brew install for that matter) but I rarely know what I'm really doing. It seems like the discussion you shared might be one of those cases: I might be able to follow the instructions but I don't understand most of what they are saying there. From my previous experiences, this is the sort of situation that might lead to me breaking something that I can't fix, so I'll avoid the bleeding edge for now xD

I really appreciate the link anyway, thanks again for sharing it :smiley:

1 Like

That's a relief! xD

I'm a newbie in spatial analyses/packages so I was defaulting to trying to get the most recent package versions I could. I'm happy to hear that not being 100% up-to-date won't be such a hassle :slight_smile:

In case you need to use version 0.9-0 it installs properly on rstudio.cloud :slight_smile:

1 Like

Hi, and welcome!

Thanks for the contribution. We who are on macOS pay a price to hang on to all the polished conveniences and consistent conventions. This is a great example.

FYI for any coding questions: Please see the FAQ: What's a reproducible example (`reprex`) and how do I do one? Using a reprex, complete with representative data will attract quicker and more answers.

I must say, I very rarely run into troubles with macOS and it provided me a tremendous boost of productivity compared to the very same work I did for years on Windows and Linux. It's worth every penny :slight_smile:

1 Like

Hi! I am trying to install the sf package and am running into the same problems. Is the only solution to wait for a binary version of proj?

Hi, and welcome!

Please see the FAQ: What's a reproducible example (`reprex`) and how do I do one? Using a reprex, complete with representative data will attract quicker and more answers. Not needed for this type of question.

You have two options:

  1. Decline the "compile from source" option and install the most recent binary version, which works just fine. Or
  2. Wait for the latest and greatest sf version to become available in binary before trying it out.

When I have a need to be on a later version than is currently avail in macOS in binary, I install it on one of my Linux machines. Also, consider that the very latest features for a package that a user hasn't yet become familiar with the basics of are unlikely to be needed. :grin:

This is what happens if you just say no:

  There is a binary version available but the source version is later:
   binary source needs_compilation
sf  0.8-1  0.9-0              TRUE

Do you want to install from sources the package which needs compilation? (Yes/no/cancel) n
trying URL 'http://cran.rstudio.com/bin/macosx/el-capitan/contrib/3.6/sf_0.8-1.tgz'
Content type 'application/x-gzip' length 64283240 bytes (61.3 MB)
==================================================
downloaded 61.3 MB

library(sf)
Linking to GEOS 3.7.2, GDAL 2.4.2, PROJ 5.2.0

Hi :slight_smile:

On top of what @technocrat said, you can use rstudio.cloud if you need version 0.9-0, the installation there goes smoothly :slight_smile:

1 Like

And [insert self dope slap here], the reason is -- wait for it -- that rstudio cloud is running on Linux, not macOS!

Thank you so much. I was looking forward to making visualizations and spent awhile trying to install the package. Thanks again and stay safe!

1 Like

There's some discussion in these two github issues that may be helpful:

3 Likes

It worked! Thanks @mfherman!

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