Unable to load "sf" package


I am rather new to the Renku platform, and I am having trouble using the R package “sf”, which I need to plot some maps.

I created my project using the R template, and I am using the RStudio environment. Installing the package with


works fine, but when I load the package I get the following error:

Error: package or namespace load failed for ‘sf’ in dyn.load(file, DLLpath = DLLpath, ...):
 unable to load shared object '/usr/local/lib/R/site-library/units/libs/units.so':
  libudunits2.so.0: cannot open shared object file: No such file or directory

What should I do to fix this? Thanks in advance.

Found out how to solve the problem: install the required dependencies, as described in https://github.com/r-spatial/sf. I added

apt-get install -y  libudunits2-dev libgdal-dev libgeos-dev libproj-dev

at the appropriate location in the Dockerfile.

1 Like

Thank you so much @ian-bonhote for sharing your issue and the solution you found! I am sure it will be useful for other users!

1 Like