GLIBCXX_3.4.26 not found from RStudio

Hello,

I’m trying to build an environment with R 4.0.3 and tidyverse via conda-forge.
Here is my repository: GitHub - ikfj/ds-polimetrics at r-4.0.3
My environment.yml looks like:

channels:
  - conda-forge
dependencies:
  - r-base=4.0.3
  - r-tidyverse

Using mybinder.org I succeeded to build my environment.
Within RStudio, however, it fails loading tidyverse:

> library(tidyverse)
Error: package or namespace load failed for ‘tidyverse’ in dyn.load(file, DLLpath = DLLpath, ...):
 unable to load shared object '/srv/conda/envs/notebook/lib/R/library/Rcpp/libs/Rcpp.so':
  /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.26' not found (required by /srv/conda/envs/notebook/lib/R/library/Rcpp/libs/Rcpp.so)

whereas within Jupyter Notebook it succeeds:

In [1]: library(tidyverse)
<output snipped>

So I’m confused; it seems like RStudio and Jupyter Notebook refer to different library path. Why?
How can I set RStudio to refer to /srv/conda/envs/notebook/lib/libstdc++.so.6 instead of /usr/lib/x86_64-linux-gnu/libstdc++.so.6?

Any solution/suggestion/comment would be appreciated. Thank you!

Hey there,

I am having the same problem. Did you figure it out?

Thank you

To your apt.txt file, did you try adding libstdc++6 according to here?

Thank you for your comments.

@filipematias23 Not yet, unfortunately.

@fomightez Yes, but it didn’t help. It needs something like
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
but how can I add an apt repository from within apt.txt?

I think the easiest way should be setting LD_LIBRARY_PATH when Jupyter Server Proxy launches RStudio.
Could someone tell me how to set an environment variable in Jupyter Server Proxy?

Hmm… adding

echo "rsession-ld-library-path={0}/lib" >> /etc/rstudio/rserver.conf && \

in repo2docker/buildpacks/conda/__init__.py might be the solution.
I’ll try it out later.

I don’t know if you’d set an environment variable in Jupyter Server Proxy. Normally with binder you set an environmental variable in the start configuration file, see the comment here. Sadly, I cannot come up with an example of this right now. I do have an example that includes setting a symbolic link that may help you (disregard that it is in postBuild; environmental variables are best set in the session via start as stated here) .

Hi @ikfj,
This solution worked for me: https://github.com/rocker-org/binder

I did some editions on the Dockerfile to install the packages that I need (e.g., sp, raster, etc.):

RUN R --quiet -e “devtools::install_github(‘IRkernel/IRkernel’)” &&
R --quiet -e “IRkernel::installspec(prefix=’${VENV_DIR}’)” &&
R --quiet -e “install.packages(‘sp’)” &&
R --quiet -e “install.packages(‘raster’)” && \

Let me know if it workes for you too…!
All the best,
Filipe

1 Like

Thank you @fomightez for your kind suggestion.
I tried to add the start file that sets LD_LIBRARY_PATH…

…and it worked! :smiley:

IMHO, though, the proper solution should be fixing repo2docker. I’ll add an issue later.
Issues · jupyterhub/repo2docker · GitHub .

2 Likes

Thank you @filipematias23 for your suggestion.
I tried rocker/binder:4.0.3 and it failed to launch RStudio with an internal server error.

https://hub.docker.com/layers/rocker/binder/4.0.3/images/sha256-bc53e4e7a2021e5363ae693b7c5cb17013fcf35fc77813468e302ca5433125b0

I’m sorry but I didn’t further investigate the problem.
Anyway, I appreciate your idea!

Sorry. I didn’t mention it sooner. As you surmise though it is sort of a fallback and so I was hoping we’d avoid needing it.

Thanks for posting that detailed solution. I actually ended up needing it now as I was using the R via conda Binder example and a package (datelife) needed libstdc++ in RStudio.
It was finding it fine by default in the R kernel-based notebooks, but not RStudio. Worked like a charm to fix the issue.