Closed abalter closed 6 months ago
@abalter Thank you for raising this issue!
@timtmok Is this limitation expected?
Also #9893, #11069
I think it is an issue with the path verification for libR.so
. R.home()
is called to build the path to libR.so
. R home seems to return the path to the executable so something like /usr/bin/R
is joined to the lib name to produce /usr/bin/R/libR.so
, which is invalid.
Could it simply check the user's native environment?
I think this is just an incorrect file path that is created. It likely slipped past testing because the customized install location scenario wasn't tested.
Using R.home()
is likely correct but Linux returns the executable. MacOS returns the directory, which would build the correct path. It might have been an incorrect assumption that R.home()
on Linux would return a directory.
Do we need to find the place in the code where that is happening, or do you think RStudio will do it? @cm421 @MariaSemple
Using R.home() is likely correct but Linux returns the executable.
I don't think that's true? A regular R installation on my Ubuntu VM has:
> R.home()
[1] "/usr/lib/R"
And indeed that's a directory where R's components have been installed:
root@96722b73f316:/usr/lib/R# ll
total 40
drwxr-xr-x 8 root root 4096 Dec 4 2022 ./
drwxr-xr-x 1 root root 4096 Dec 4 2022 ../
lrwxrwxrwx 1 root root 33 Feb 8 2022 COPYING -> ../../share/common-licenses/GPL-2
-rw-r--r-- 1 root root 46 Feb 8 2022 SVN-REVISION
drwxr-xr-x 3 root root 4096 Dec 4 2022 bin/
drwxr-xr-x 2 root root 4096 Dec 4 2022 etc/
drwxr-xr-x 2 root root 4096 Dec 4 2022 lib/
drwxr-xr-x 32 root root 4096 Dec 4 2022 library/
drwxr-xr-x 2 root root 4096 Dec 4 2022 modules/
drwxr-xr-x 2 root root 4096 Feb 8 2022 site-library/
and so libR.so
is found here:
root@96722b73f316:/usr/lib/R/lib# ll
total 3300
drwxr-xr-x 2 root root 4096 Dec 4 2022 ./
drwxr-xr-x 8 root root 4096 Dec 4 2022 ../
-rw-r--r-- 1 root root 3368224 Feb 8 2022 libR.so
but there is also a symlink at /usr/lib/libR.so
.
@abalter's error logs have:
2023-05-31T15:26:09.700096Z [rsession-balter] ERROR R SUICIDE: 2023-05-31T15:26:09.699990Z [rsession-balter] ERROR r error 4 (Error in dyn.load(file, DLLpath = DLLpath, ...) : ||| unable to load shared object '/home/balter/micromamba/lib/R/library/utils/libs/utils.so':||| /home/balter/micromamba/lib/R/library/utils/libs/utils.so: undefined symbol: R_maphash|||) [errormsg: Error in dyn.load(file, DLLpath = DLLpath, ...) : ||| unable to load shared object '/home/balter/micromamba/lib/R/library/utils/libs/utils.so':||| /home/balter/micromamba/lib/R/library/utils/libs/utils.so: undefined symbol: R_maphash|||]; OCCURRED AT rstudio::core::Error rstudio::r::exec::evaluateString(const string&, SEXPREC*, rstudio::r::sexp::Protect, rstudio::r::exec::EvalFlags) src/cpp/r/RExec.cpp:375; LOGGED FROM: void {anonymous}::rSuicide(const string&) src/cpp/session/SessionMain.cpp:1242
which makes me think this is an issue with the R (micromamba?) installation.
@abalter, what does R.home()
report in your R installation?
(base) balter@expiyes:~$ Rscript -e "print(R.home())" [1] "/home/balter/micromamba/lib/R"
That looks correct to me; we'll probably have to investigate further to understand what's going wrong.
Ah yes, R.home()
seems to give me a correct path to R as well /usr/lib/R
.
Hi all, so we are having similar issues with rsutdio > 2022.04 - any R version that is installed in a conda environment and that is called fine in the terminal does not get started up by rstudio. So I looked at the 2023.06 logs and what I got was the following:
2023-06-12T12:31:46.721Z DEBUG instance lock: true, project: , file: false
2023-06-12T12:31:46.722Z DEBUG net-ipc: creating new message server; socket=/data/user/pantczak/.local/share/rstudio/rstudio.socket
2023-06-12T12:31:46.724Z DEBUG No rPath found, scanning for R
2023-06-12T12:31:46.724Z DEBUG Using /data/user/pantczak/my-envs/R4.2.2/bin/R (found by RSTUDIO_WHICH_R environment variable)
2023-06-12T12:31:46.724Z DEBUG Done choosing R
2023-06-12T12:31:46.724Z DEBUG Preparing environment using R: /data/user/pantczak/my-envs/R4.2.2/bin/R
2023-06-12T12:31:46.724Z DEBUG Querying information about R executable at path: /data/user/pantczak/my-envs/R4.2.2/bin/R
2023-06-12T12:31:46.892Z DEBUG stdout:
4.2.2;/data/user/pantczak/my-envs/R4.2.2/lib/R;/data/user/pantczak/my-envs/R4.2.2/lib/R/doc;/data/user/pantczak/my-envs/R4.2.2/lib/R/include;/data/user/pan>
2023-06-12T12:31:46.893Z DEBUG stderr: [no stderr produced]
2023-06-12T12:31:46.893Z DEBUG status: 0 [success]
2023-06-12T12:31:46.895Z DEBUG Launching rsession: /usr/lib/rstudio/resources/app/bin/rsession --config-file none --program-mode desktop --www-port 46691 ->
2023-06-12T12:31:46.895Z DEBUG R_HOME: /data/user/pantczak/my-envs/R4.2.2/lib/R
2023-06-12T12:31:46.895Z DEBUG RS_INITIAL_PROJECT:
2023-06-12T12:31:46.895Z DEBUG RS_LOG_LEVEL:
2023-06-12T12:31:46.964Z DEBUG Setting base URL: http://127.0.0.1:46691
2023-06-12T12:31:46.966Z DEBUG 'frame-created': [<event>, <object>]
2023-06-12T12:31:46.966Z DEBUG 'did-start-loading': [<event>]
2023-06-12T12:31:46.966Z DEBUG 'did-start-navigation': [<event>, "http://127.0.0.1:46691/", false, true, 4, 1]
2023-06-12T12:31:46.967Z DEBUG net-ipc: 11103 taking over as primary instance
It seems everything is being selected correctly but the rsession that is launched does not have a config file (?) and that seems to cause it to start the standard R version installed instead. Any ideas?
I would like to note that
To manage expectations for the many RStudio users suffering from the libR.so problem, could one of the RStudio developers please comment on where fixing this sits in the development priority list?
I don't know how many of the developers I tagged in this post actually work for Posit, as in actually get paid for their work. But this is a pretty significant bug IMO, and I'm eager to see it fixed.
Just for completeness I just checked the daily rstudio build and that cannot deal with multiple Rs properly either.
I had the same problem with rstudio 2023.06.0 build 421 and conda installed R 4.2.3.
my temporary hack is to create soft links for all .so libraries under /usr/lib/ . with
for i in ~/miniconda3/envs/renv43/lib/*.so*;do ln -rs $i /usr/lib/ ;done
Could this please be moved to a proper release milestone? Linux users of Conda R have not had a compatible release of RStudio in over a year now.
We're planning to tackle this in the first RStudio release of 2024. Thanks all for the patience!
Thanks for the update!
Perhaps rstudio-server cannot access some files in the virtual environment.
An alternative:
Look at the user group for libR.so
and add rstudio-server
to it
$ ls -l /tools/miniconda3/envs/r-base/lib/R/lib/libR.so
-rwxrwxr-x. 2 test001 test001
$ sudo usermod -a -G test001 rstudio-server
$ sudo rstudio-server verify-installation
$ sudo rstudio-server start
And edit file /tools/miniconda3/envs/r-base/lib/R/etc/Rprofile.site
:
Sys.setenv("PATH"="/tools/miniconda3/envs/r-base/bin:/home/test001/.local/bin:/home/test001/bin:/tools/miniconda3/condabin:/home/test001/.local/bin:/home/test001/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin")
Note: Conda includes a patch to their R installation that ensures LD_LIBRARY_PATH
is never appropriately set. Its contents are:
$ cat ldpaths
# https://github.com/conda/conda/issues/1679:
# Internally R_system() calls system() which
# uses /bin/sh to launch various programs. If
# /bin/sh is called with LD_LIBRARY_PATH that
# loads condas shared libraries things break.
# It may be that not setting LD_LIBRARY_PATH
# causes other things to break, in which case
# R_system() will need to be modified so that
# it calls execve() with an environment which
# has these modifications to LD_LIBRARY_PATH
# removed which may be tricky to orchestrate
if [ "$(uname -s)" = "Linux" ]; then
return 0
fi
: ${JAVA_HOME=/usr/lib/jvm/java-17-openjdk-arm64}
: ${R_JAVA_LD_LIBRARY_PATH=/home/conda/feedstock_root/build_artifacts/r-base-split_1709218192803/_build_env/lib/jvm/lib/server}
if test -n "/home/kevin/micromamba/lib"; then
: ${R_LD_LIBRARY_PATH=${R_HOME}/lib:/home/kevin/micromamba/lib}
else
: ${R_LD_LIBRARY_PATH=${R_HOME}/lib}
fi
if test -n "${R_JAVA_LD_LIBRARY_PATH}"; then
R_LD_LIBRARY_PATH="${R_LD_LIBRARY_PATH}:${R_JAVA_LD_LIBRARY_PATH}"
fi
## This is DYLD_FALLBACK_LIBRARY_PATH on Darwin (macOS) and
## LD_LIBRARY_PATH elsewhere.
## However, on macOS >=10.11 (if SIP is enabled, the default), the
## environment value will not be passed to a script such as R.sh, so
## would not seen here.
if test -z "${LD_LIBRARY_PATH}"; then
LD_LIBRARY_PATH="${R_LD_LIBRARY_PATH}"
else
LD_LIBRARY_PATH="${R_LD_LIBRARY_PATH}:${LD_LIBRARY_PATH}"
fi
export LD_LIBRARY_PATH
See:
https://github.com/conda/conda/issues/1679
This causes problems for RStudio, since normally we'd be able to find the requested libraries using that script. RStudio starts fine if I remove that preamble, so to make this work we'll have to work around Anaconda's patch.
RStudio Server: Verified in 2024.04.0-daily+593 on Ubuntu 22.04.
2024-03-15T20:20:14.626362Z [rserver] ERROR Path to R not specified, and no module binary specified; Invalid R module (); LOGGED FROM: int main(int, char const) src/cpp/server/ServerMain.cpp:866
/usr/local/games/
, an unlikely place for anyone or any software to go looking for R. With the fix, this is a legitimate location for R.RStudio Desktop: I'm not able to reproduce the problem in both Ubuntu 22.04 and Red Hat 9, so I can't claim that it's working because it's fixed. Would any of y'all be willing to try out one of the latest RStudio 2024.04.0 Chocolate Cosmos dailies and check if the problem is fixed? Please note that these are meant for testing and development only, not production.
I was able to repro the problem on Ubuntu 22 as follows:
micromamba create -n r -c conda-forge
micromamba activate r
micromamba install r-base
which R
gives /home/parallels/micromamba/envs/r/bin/R
rstudio
from the terminal where I ran the above micromamba commands:Then, verified the fix:
rstudio
from the terminal and it loads successfullyOn Ubuntu 22.04.1:
$ uname -a
Linux HOSTNAME 6.5.0-26-generic #26~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue Mar 12 10:22:43 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
R installed globally via asdf:
$ R
R version 4.3.1 (2023-06-16) -- "Beagle Scouts"
Copyright (C) 2023 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
Natural language support but running in an English locale
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> R.home()
[1] "/home/USER/.asdf/installs/r/4.3.1/lib/R"
>
latest official version:
/usr/lib/rstudio/resources/app/bin/rsession: error while loading shared libraries: libR.so: cannot open shared object file: No such file or directory
latest daily version:
sudo apt remove rstudio
/usr/lib/rstudio/resources/app/bin/rsession: error while loading shared libraries: libR.so: cannot open shared object file: No such file or directory
daily version reported to be working in this thread:
sudo apt remove rstudio
/usr/lib/rstudio/resources/app/bin/rsession: error while loading shared libraries: libR.so: cannot open shared object file: No such file or directory
Updated to latest R via asdf and still have the same problem:
$ R
R version 4.3.3 (2024-02-29) -- "Angel Food Cake"
Copyright (C) 2024 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
Natural language support but running in an English locale
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> R.home()
[1] "/home/USER/.asdf/installs/r/4.3.3/lib/R"
>
Save workspace image? [y/n/c]: n
Did you configure R with --enable-R-shlib
? What is the output of:
head $(R RHOME)/etc/Makeconf
?
@kevinushey I re-installed RStudio with --enable-R-shlib
as explained here [1] and it works now. Thanks!
Awesome, glad to hear that resolved the issue -- thanks for reporting back!
Hi, I am facing an issue like the previous shown here.
I installed a tar.gz verison of R (4.3.0 released on April 2023. The latest version is 4.4.0 ) then I installed R studio but "Error starting R" appears. Here is a screenshot:
Here is a copy of the problem report:
RStudio 2024.04.0-daily+603 "Chocolate Cosmos " (e0e7d4fd, 2024-03-18) for Ubuntu Focal
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) rstudio/2024.04.0-daily+603 Chrome/120.0.6099.291 Electron/28.2.6 Safari/537.36
[No error available]
The R session exited with code 127.
Error output:
/usr/lib/rstudio/resources/app/bin/rsession: error while loading shared libraries: libR.so: cannot open shared object file: No such file or directory
Standard output:
[No output emitted]
/home/sherwood/.local/share/rstudio/log/rsession-sherwood.log
2024-05-06T01:08:53.228638Z [rsession-sherwood] WARNING ASSERTION FAILED: !posix::pthread_mutex_lock(&m); LOGGED FROM: void rstudio_boost::recursive_mutex::lock() /opt/rstudio-tools/x86_64/boost/boost_1_83_0/include/boost/thread/pthread/recursive_mutex.hpp:108
2024-05-06T01:08:53.229280Z [rsession-sherwood] WARNING ASSERTION FAILED: !posix::pthread_mutex_unlock(&m); LOGGED FROM: void rstudio_boost::recursive_mutex::unlock() /opt/rstudio-tools/x86_64/boost/boost_1_83_0/include/boost/thread/pthread/recursive_mutex.hpp:113
2024-05-06T01:08:53.229280Z [rsession-sherwood] WARNING ASSERTION FAILED: !posix::pthread_mutex_unlock(&m); LOGGED FROM: void rstudio_boost::recursive_mutex::unlock() /opt/rstudio-tools/x86_64/boost/boost_1_83_0/include/boost/thread/pthread/recursive_mutex.hpp:113
Here some info about R:
R.home() [1] "/usr/local/lib/R"
Session info:
sessionInfo() R version 4.3.0 (2023-04-21) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Ubuntu 20.04.6 LTS
Matrix products: default BLAS: /usr/local/lib/R/lib/libRblas.so LAPACK: /usr/local/lib/R/lib/libRlapack.so; LAPACK version 3.11.0
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=Ctime zone: America/Lima tzcode source: system (glibc)
attached base packages: [1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached): [1] compiler_4.3.0
@maby200 When you built R, did you use --enable-R-shlib
? See the comments above from @kevinushey and @nivertech .
@ronblum if he installed R with conda (micromamba) as I do, then that option would not exist.
@ronblum sorry for late responding, got sick.
I did not use that command --enable-R-shlib
Is it necessary to uninstall it? I manually installed this package and I don't know how to do it.
Please, if you have links that can help on uninstalling, share them with me :pray:
"I installed a tar.gz verison of R (4.3.0 released on April 2023. The latest version is 4.4.0 )"
@maby200 it's unclear what this means when combined with saying that you followed the comment of gtritchie, which used micromamba
not a tar.gz. If using a Conda-based installer for R, a tar.gz alone is usually insufficient because it doesn't trigger installing dependencies. However, it sounds more like the installation was from official R source and not using Conda/Micromamba. Please clarify if you can.
Maybe you could detail more exactly what your installation procedure was (i.e., show commands).
Note that Conda Forge does build R with the flag that was mentioned. The advantage of Conda Forge is that all packages are precompiled and includes all dependencies.
Sure, I installed the 4.3.0 tar.gz I don't currently remember where did i downloaded, sorry. But I placed the tar.gz in home directory and then did
./configure
make
sudo make install
Few hours ago I went to /home/sherwood/R-4.3.0/src/
and executed
╭─sherwood at maby in ~/R-4.3.0/src 24-06-08 - 10:36:04
╰─○ sudo make uninstall
make[1]: Entering directory '/home/sherwood/R-4.3.0/src/library'
uninstalling packages ...
make[1]: Leaving directory '/home/sherwood/R-4.3.0/src/library'
make[1]: Entering directory '/home/sherwood/R-4.3.0/src/modules'
make[1]: Leaving directory '/home/sherwood/R-4.3.0/src/modules'
make[1]: Entering directory '/home/sherwood/R-4.3.0/src/main'
make[1]: Leaving directory '/home/sherwood/R-4.3.0/src/main'
make[1]: Entering directory '/home/sherwood/R-4.3.0/src/unix'
make[1]: Leaving directory '/home/sherwood/R-4.3.0/src/unix'
make[1]: Entering directory '/home/sherwood/R-4.3.0/src/nmath'
make[1]: Nothing to be done for 'uninstall'.
make[1]: Leaving directory '/home/sherwood/R-4.3.0/src/nmath'
make[1]: Entering directory '/home/sherwood/R-4.3.0/src/appl'
make[1]: Nothing to be done for 'uninstall'.
make[1]: Leaving directory '/home/sherwood/R-4.3.0/src/appl'
make[1]: Entering directory '/home/sherwood/R-4.3.0/src/extra'
make[1]: Nothing to be done for 'uninstall'.
make[1]: Leaving directory '/home/sherwood/R-4.3.0/src/extra'
make[1]: Entering directory '/home/sherwood/R-4.3.0/src/include'
make[2]: Entering directory '/home/sherwood/R-4.3.0/src/include/R_ext'
make[2]: Leaving directory '/home/sherwood/R-4.3.0/src/include/R_ext'
make[1]: Leaving directory '/home/sherwood/R-4.3.0/src/include'
make[1]: Entering directory '/home/sherwood/R-4.3.0/src/scripts'
make[1]: Leaving directory '/home/sherwood/R-4.3.0/src/scripts'
Then I tried to open R on my terminal:
╭─sherwood at maby in ~/R-4.3.0/src 24-06-08 - 10:36:22
╰─○ R
zsh: command not found: R
@ronblum or someone else from Posit. I wonder if you would either confirm or deny the following statement:
Posit does not want to actively or easily support running Posit Workbench with the R environment of your choice in the free edition because that is a valuable feature of the professional edition.
@maby200 thanks for adding that info. That clarifies that it's not a Conda issue. Rather, it could be an issue with the flags used in compilation as suggested by @ronblum.
@maby200 -- you need to configure R with
./configure --enable-R-shlib
as RStudio requires R to be built with a shared library.
@abalter -- no, there is no difference in the set of R installations supported between the open source and Workbench installations of RStudio.
The primary requirement is that R is built with a shared library; the extra challenge with Conda installations is that they include custom patches to R that can break some assumptions used by RStudio when introspecting R installations, and also link to a separate set of libraries which might be incompatible with those used by the RStudio installation. There are potential workarounds (e.g. setting LD_LIBRARY_PATH
) but unfortunately no guarantees.
As you might have seen in https://github.com/rstudio/rstudio/issues/13184#issuecomment-1992709588, the issue you described was due to a patch that Conda makes to their builds of R. This should have been fixed via https://github.com/rstudio/rstudio/pull/14414, so you should see the latest release of RStudio work with Conda installations. If you're not, please let us know and provide more details on what you're seeing.
Thanks for the suggestion @kevinushey , so if after running sudo make uninstall
inside /home/sherwood/R.4.3.0/src
is it possible to delete this folder (R:4.3.0) and install from scratch this version?
I don't find posts explicitly telling what to do after.
System details
Steps to reproduce the problem
Describe the problem in detail
I have tried downloading and installing multiple versions of rstudio desktop including the current stable (as shown above) and others from the dailies. None of them will open. I get an error about not being able to find
libR.so
.This is the same behavior as in #12508. Furthermore, if I google this problem of rstudio not being able to find
libR.so
it seems to be very common.I have included my session startup failure report at the bottom.
I have tried setting R library paths with a .Renviron file and with not using one.
Describe the behavior you expected
RStudio would start.
R Session Startup Failure Report
RStudio Version
RStudio 2023.03.1+446 "Cherry Blossom " (6e31ffc3, 2023-05-09) for Ubuntu Jammy
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) rstudio/2023.03.1+446 Chrome/108.0.5359.179 Electron/22.0.3 Safari/537.36
Error message
[No error available]
Process Output
The R session exited with code 127.
Error output:
Standard output:
Logs
/home/balter/.local/share/rstudio/log/rsession-balter.log