randy3k / radian

A 21 century R console
MIT License
2k stars 76 forks source link

Error: package or namespace load failed for ‘dplyr’ in dyn.load(file, DLLpath = DLLpath, ...) #358

Open michaelGRU opened 2 years ago

michaelGRU commented 2 years ago

Hi, my OS is Pop!_OS 22.04 LTS and I downloaded radian via conda. I faced this error while importing R libraries. The problem is not just limited to dplyr.

Error: package or namespace load failed for ‘dplyr’ in dyn.load(file, DLLpath = DLLpath, ...): unable to load shared object '/home/xxx/R/x86_64-pc-linux-gnu-library/4.1/dplyr/libs/dplyr.so': /home/xxx/anaconda3/envs/sds/bin/../lib/libstdc++.so.6: version `GLIBCXX_3.4.29' not found (required by /home/xxx/R/x86_64-pc-linux-gnu-library/4.1/dplyr/libs/dplyr.so)

I tried several solutions online, but none worked so far. I tried to reinstall R and reinstall the packages as well. Radian works as long as I am not using R libraries. R and RStudio also works fine.

Any idea what might be the issue?

randy3k commented 2 years ago

I believe you will need to activate your conda environment when using radian.

michaelGRU commented 2 years ago

Hi Randy, thanks for the reply. I appreciate it! It's odd because I did activate my conda environment. radian is being installed using the sds environment.

Screenshot from 2022-05-05 09-39-28

randy3k commented 2 years ago

It seems that the standard C runtime in Python is different from what the R packages were compiled against to. If might be easier if you also install R from conda.

atanasj commented 2 years ago

I think I may be having a similar issue on an MBP 13" late-2013. I get a similar error when using radian, but works with normal R:

image

I have my packages (e.g.,tidyverse) stored in a separate directory to that provided by R so that I don't have to reinstall when upgrading R versions. I don't see how this would impact it, since my understanding is that radian just wraps around R anyway. Any suggestions on how I would fix this?

ProductName:    macOS
ProductVersion: 11.6.5
BuildVersion:   20G527
radian version: 0.5.13
r executable: /Library/Frameworks/R.framework/Resources/bin/R
r version: 4.2.0
python executable: /usr/local/opt/python@3.9/bin/python3.9
python version: 3.9.13
R version 4.2.0 (2022-04-22) -- "Vigorous Calisthenics"
michaelGRU commented 2 years ago

I believe what you showed is the same error that I encountered. I have not yet able to resolve this issue on my Linux machine. I have a second computer with Windows installed, and radian works fine. You could try to install R using conda as Randy suggested. https://docs.hdc.ntnu.no/working-in-your-lab/analytical-tools/r-studio/#install-r

atanasj commented 2 years ago

Thanks @michaelGRU, but I am wondering what happened for this to break, as it was working without issues until recently. @randy3k, would my installation of packages in another directory have anything to do with this error? I don't think so, as this is the setup I've had for years, but thought I'd ask... Ideally, I would not want to introduce another decency such as conda.

Also, I just read on the Readme.md about something to do with installing R with the shared library option... Could this be contributing to this issue at all?

randy3k commented 2 years ago

You need to make sure that both R and python are compiled against compatible versions of c libraries.

atanasj commented 2 years ago

I download the R package from CRAN and I think I have the system python 3 install:

/usr/local/bin/R
/usr/bin/python3
/usr/bin/pip3
/usr/local/bin/radian

So I assume they are all building from the same C library? How can I know @randy3k?

atanasj commented 2 years ago

I've just uninstalled R and reinstalled via brew and it seems to work now... However, my site library is not picked up on Emacs and I get a similar error to that posted earlier. Also, when installing R from CRAN again, R Studio doesn't find my user site library, nor does the R.app or radian. R from CRAN works fine on the terminal and in Emacs.