Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue installing sf on Ubuntu with GDAL 3.2? #1550

Closed
dblodgett-usgs opened this issue Dec 7, 2020 · 8 comments
Closed

Issue installing sf on Ubuntu with GDAL 3.2? #1550

dblodgett-usgs opened this issue Dec 7, 2020 · 8 comments

Comments

@dblodgett-usgs
Copy link
Contributor

I'm working on testing COG endpoints and would like to try stars against a COG with GDAL... at v3.1, GDAL keeps trying to access a COG as an OPeNDAP endpoint so I figured I'd try getting updated to 3.2 as they introduced the ability to specify the format. (not sure sf actually passes the parmeter, but figured it was worth a shot!)

In the process, I found that I can't get sf to install cleanly on this setup. See the Dockerfile below. It makes it all the way to the end then fails with an error I don't see any reference to.

Any ideas? Error is: undefined symbol: proj_get_units_from_database

#10 116.3 ** testing if installed package can be loaded from temporary location
#10 116.7 Error: package or namespace load failed for 'sf' in dyn.load(file, DLLpath = DLLpath, ...):
#10 116.7  unable to load shared object '/usr/local/lib/R/site-library/00LOCK-sf/00new/sf/libs/sf.so':
#10 116.7   /usr/local/lib/R/site-library/00LOCK-sf/00new/sf/libs/sf.so: undefined symbol: proj_get_units_from_database
#10 116.7 Error: loading failed
#10 116.7 Execution halted
#10 116.7 ERROR: loading failed
#10 116.7 * removing '/usr/local/lib/R/site-library/sf'
#10 117.0 Error: Failed to install 'sf' from GitHub:
#10 117.0   (converted from warning) installation of package '/tmp/RtmpdTmy6P/file827502b72/sf_0.9-7.tar.gz' had non-zero exit status
#10 117.0 Execution halted
ARG BASE_CONTAINER=osgeo/gdal:ubuntu-full-3.2.0

FROM ${BASE_CONTAINER}

USER root

RUN apt-get update \
    && apt-get install -y \
    software-properties-common

RUN add-apt-repository --enable-source --yes "ppa:marutter/rrutter4.0"

RUN apt-get update \
    && apt-get install -y --no-install-recommends \
        littler \
        r-base \
        r-base-dev \
        r-recommended

RUN apt-get install -y libcurl4-openssl-dev libssl-dev libxml2-dev \
    libudunits2-dev libproj-dev libgeos-dev

RUN Rscript -e 'install.packages("devtools")'

RUN Rscript -e 'devtools::install_github("r-spatial/sf")'
edzer added a commit that referenced this issue Dec 7, 2020
@edzer
Copy link
Member

edzer commented Dec 7, 2020

We saw this problem in rocker-org/geospatial#31 . sf is being tricked into believing PROJ 7.2.0 is available, which kind of it is, in /usr/local/, but this is an instrumented version (I believe) to only serve GDAL and not stand in the way of applications linking to the other PROJ (in /usr/, 6.3.x). So the configure step makes sf believe 7.2.0 is there, but the link step doesn't resolve the symbols (as the /usr/local/lib/libproj*so renamed them to cater GDAL).

My suggestions are either to not build on osgeo:gdal images, or maybe install PROJ 7.2.0 properly on it in /usr/ (you'll probably break GDAL if you overwrite PROJ in /usr/local without renamed symbols). Why *#$ does this image have PROJ 6.3.0 in /usr?

@edzer
Copy link
Member

edzer commented Dec 7, 2020

This: #1518 (comment)

@dblodgett-usgs
Copy link
Contributor Author

oh wow. OK thanks for the thorough explanation! I'll look for another way to get GDAL 3.2 for experimentation. Looks like https://github.com/perrygeo/docker-gdal-base has it.

@dblodgett-usgs
Copy link
Contributor Author

Nope, same deal over there. sigh. One day, this proj transition will settle down.

@edzer
Copy link
Member

edzer commented Dec 8, 2020

@Robinlovelace what do you suggest?

@Robinlovelace
Copy link
Contributor

Hi @dblodgett-usgs, definitely a good question and one that has confused many people. I suggest using the rocker/geospatial:dev-osgeo container, e.g. as follows:

docker run --rm -ti rocker/geospatial:dev-osgeo R -e "library(sf)"

Running that gives:

R version 4.0.3 (2020-10-10) -- "Bunny-Wunnies Freak Out"
Copyright (C) 2020 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(sf)
Linking to GEOS 3.8.1, GDAL 3.2.0, PROJ 7.2.0
> 
> 

See rocker-org/geospatial#31 and the rocker documentation for further info. Does that help? Hope so!

@dblodgett-usgs
Copy link
Contributor Author

Nice! I'll give it a go. Thank you.

edzer added a commit that referenced this issue Dec 8, 2020
@dblodgett-usgs
Copy link
Contributor Author

I did get this working and have been able to test a COG file from stars. Very cool that we will have access to this out of the box on GDAL 3.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants