question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

tidyverse loading difference between JupyterLab and RStudio

See original GitHub issue

Bug description

The R package tidyverse loads successfully in JupyterLab but fails in RStudio.

We use as an example this repository that contains the description of a R environment with the tidyverse package installed with conda.

Expected behaviour

The R instruction

library(tidyverse)

should work without any error.

Actual behaviour

In JupyterLab, we can load tidyverse both in a R notebook:

image

and in a terminal:

image

In RStudio, this fails:

image

For debugging purpose, here is the output of the sessionInfo() instruction:

R version 4.1.3 (2022-03-10)
Platform: x86_64-conda-linux-gnu (64-bit)
Running under: Ubuntu 18.04.6 LTS

Matrix products: default
BLAS/LAPACK: /srv/conda/envs/notebook/lib/libopenblasp-r0.3.20.so

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
 [1] fansi_1.0.3     utf8_1.2.2      digest_0.6.29   crayon_1.5.1   
 [5] IRdisplay_1.1   repr_1.1.4      lifecycle_1.0.1 jsonlite_1.8.0 
 [9] evaluate_0.15   pillar_1.7.0    rlang_1.0.2     cli_3.2.0      
[13] uuid_1.1-0      vctrs_0.4.1     ellipsis_0.3.2  IRkernel_1.2   
[17] tools_4.1.3     glue_1.6.2      fastmap_1.1.0   compiler_4.1.3 
[21] base64enc_0.1-3 pbdZMQ_0.3-7    htmltools_0.5.2

How to reproduce

Create an environment with repo2docker and this repository.

Try to run the R command:

library(tidyverse)

You are sure tidyverse is loaded correctly when you can run this second command also without error:

as_tibble(mtcars)

Your personal set up

  • OS: Linux Ubuntu 20.04
  • Docker version: 20.10.14, build a224086
  • repo2docker version: 2022.02.0+19.g1d218af

A possible lead (or not)

I suspect an issue with the availability of C++ libraries.

In a terminal, in RStudio, I have:

$ strings /usr/lib/x86_64-linux-gnu/libstdc++.so.6 | grep GLIBCXX_3.4.26
$ strings /srv/conda/envs/notebook/lib/libstdc++.so.6 | grep GLIBCXX.3.4.26
GLIBCXX_3.4.26
GLIBCXX_3.4.26

So, I guess R within RStudio should have access to /srv/conda/envs/notebook/lib/libstdc++.so.6 rather to /usr/lib/x86_64-linux-gnu/libstdc++.so.6 only.

What puzzles me is that in RStudio we have:

> Sys.getenv("LD_LIBRARY_PATH")
[1] "/srv/conda/envs/notebook/lib/R/lib"

but in JupyterLab we have:

> Sys.getenv("LD_LIBRARY_PATH")
[1] ""

So this lead could be wrong…

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:2
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

0reactions
fkohrtcommented, Dec 16, 2022

I am having a related issue when running Shiny apps:

Starting a Shiny app from within RStudio…

install.packages(c("leaflet", "shinydashboard", "dplyr", "curl"))
options(warn = 1)
shiny::runApp("r/bus-dashboard")

…leads to the following error:

Error 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)

I tried installing libstdc++6 and gcc-8 via apt.txt, but that didn’t help. The Shiny interface at /shiny/r/bus-dashboard/ does work, however, as does running the code above from JupyterLab.

Here’s a repository for you to check: gitlab.com/fkohrt/binder-test

environment.yml
channels:
  - conda-forge
dependencies:
  - python
  - nbgitpuller
  - r-base

Binder

Most important, this is only an issue when using environment.yml to install R:

channels:
  - conda-forge
dependencies:
  - python
  - nbgitpuller
  - r-base

If I use requirements.txt instead, none of the issues are present – I can do library(tidyverse) and shiny::runApp("r/bus-dashboard") without any problems, but now the Shiny interface at /shiny/r/bus-dashboard/ does not work (An error has occurred!). This can be verified with the following repository: gitlab.com/fkohrt/RMarkdown-sandbox

Binder

Read more comments on GitHub >

github_iconTop Results From Across the Web

Jupyter vs RStudio | What are the differences? - StackShare
Jupyter can be classified as a tool in the "Data Science Notebooks" category, while RStudio is grouped under "Integrated Development Environment".
Read more >
RStudio Server Open Source vs. Pro Comparison - RStudio
The premier R IDE for data professionals. ... Author and edit Python code with Jupyter Notebooks and JupyterLab. Easily publish and share Jupyter...
Read more >
How to use Jupyter to conduct preliminary data analysis for ...
I will write about using R (tidyverse and ggplot) to do data analysis. In a future post, I will show you how you...
Read more >
RStudio Release Notes
RStudio now provides autocompletion results for packages used but not loaded within a project. Improved handling of missing arguments for some functions in...
Read more >
Tutorial: Scientific reporting from Jupyterlab with R Markdown
I'm one of those people who dislike R. I work in Python 99.9% of the time, ... Open RStudio; Load up our Diamond...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found