GLIBCXX_3.4.26 not found from RStudio


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:

  - conda-forge
  - r-base=4.0.3
  - r-tidyverse

Using 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/':
  /usr/lib/x86_64-linux-gnu/ version `GLIBCXX_3.4.26' not found (required by /srv/conda/envs/notebook/lib/R/library/Rcpp/libs/

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/ instead of /usr/lib/x86_64-linux-gnu/

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/ 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:

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,

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 .


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

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.

I have the same issue. I don’t know where to put the start file as I have a two-level binder. One repo for the environment and one for the scripts as recommended.

Do you know if the problem will be addressed in repo2docker?

The start configuration file would go in the the repo where the environment is being defined because you are trying to set the path in the resulting environment. The separate repo for the content doesn’t necessarily even have to have any configuration files, if that helps you think about it.
The content repo only needs to have the content. Of course, you may want to have it also be launchable for development reasons; however, that is optional.