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:
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!
@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?
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) .
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
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.