Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

R Package Install Fails within Julia REPL - Succeeds in Native R Console #416

Closed
TheCedarPrince opened this issue May 2, 2021 · 5 comments

Comments

@TheCedarPrince
Copy link

I am currently attempting to install some R libraries from within Julia via RCall. It seems to be failing with an error message that looks like this:

R> install.packages(c("SqlRender", "DatabaseConnector", "remotes"))
--- Please select a CRAN mirror for use in this session ---
Selection: 51
Secure CRAN mirrors

 1: 0-Cloud [https]                   2: Australia (Canberra) [https]
 3: Australia (Melbourne 1) [https]   4: Australia (Melbourne 2) [https]
 5: Australia (Perth) [https]         6: Austria [https]
 7: Belgium (Ghent) [https]           8: Brazil (BA) [https]
 9: Brazil (PR) [https]              10: Brazil (RJ) [https]
11: Brazil (SP 1) [https]            12: Brazil (SP 2) [https]
13: Bulgaria [https]                 14: China (Hong Kong) [https]
15: China (Guangzhou) [https]        16: China (Lanzhou) [https]
17: China (Shanghai) [https]         18: Costa Rica [https]
19: Denmark [https]                  20: East Asia [https]
21: Ecuador (Cuenca) [https]         22: Ecuador (Quito) [https]
23: France (Lyon 1) [https]          24: France (Lyon 2) [https]
25: France (Marseille) [https]       26: Germany (Erlangen) [https]
27: Germany (Münster) [https]        28: Germany (Regensburg) [https]
29: Greece [https]                   30: Hungary [https]
31: Iceland [https]                  32: Indonesia (Jakarta) [https]
33: Italy (Padua) [https]            34: Japan (Tokyo) [https]
35: Korea (Gyeongsan-si) [https]     36: Korea (Seoul 1) [https]
37: Korea (Ulsan) [https]            38: Mexico (Mexico City) [https]
39: Morocco [https]                  40: Norway [https]
41: Philippines [https]              42: Russia [https]
43: Spain (A Coruña) [https]         44: Sweden [https]
45: Switzerland [https]              46: Taiwan (Taipei) [https]
47: Turkey (Mersin) [https]          48: UK (Bristol) [https]
49: UK (London 1) [https]            50: USA (IA) [https]
51: USA (KS) [https]                 52: USA (MI 1) [https]
53: USA (MI 2) [https]               54: USA (OH) [https]
55: USA (OR) [https]                 56: USA (TN) [https]
57: USA (TX 1) [https]               58: Uruguay [https]
59: (other mirrors)

┌ Warning: RCall.jl: Installing packages into ‘/home/cedarprince/R/x86_64-pc-linux-gnu-library/4.0’
│ (as ‘lib’ is unspecified)
│ Warning in download.file(url, destfile = f, quiet = TRUE) :
│   URL 'https://cran.r-project.org/CRAN_mirrors.csv': status was 'SSL peer certificate or SSH remote key was not OK'
│ Warning: failed to download mirrors file (cannot open URL 'https://cran.r-project.org/CRAN_mirrors.csv'); using local file '/usr/local/lib64/R/doc/CRAN_mirrors.csv'
│ Warning: unable to access index for repository https://rweb.crmda.ku.edu/cran/src/contrib:
│   cannot open URL 'https://rweb.crmda.ku.edu/cran/src/contrib/PACKAGES'
│ Warning: packages ‘SqlRender’, ‘DatabaseConnector’, ‘remotes’ are not available for this version of R
│
│ Versions of these packages for your version of R might be available elsewhere,
│ see the ideas at
│ https://cran.r-project.org/doc/manuals/r-patched/R-admin.html#Installing-packages
└ @ RCall ~/.julia/packages/RCall/3mHXJ/src/io.jl:160

Testing my sanity, I attempted the install via the native R console and the install succeeded correctly. I am using R version 4.0.5 and Julia version 1.6.0. Here is the full information on the install:

              _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.6.0 (2021-03-24)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |


julia> using RCall

R> sessionInfo()
R version 4.0.5 (2021-03-31)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Fedora 32 (Thirty Two)

Matrix products: default
BLAS:   /usr/local/lib64/R/lib/libRblas.so
LAPACK: /usr/local/lib64/R/lib/libRlapack.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=en_US.UTF-8
 [9] LC_ADDRESS=en_US.UTF-8        LC_TELEPHONE=en_US.UTF-8
[11] LC_MEASUREMENT=en_US.UTF-8    LC_IDENTIFICATION=en_US.UTF-8

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

loaded via a namespace (and not attached):
[1] compiler_4.0.5

(@v1.6) pkg> st
      Status `~/.julia/environments/v1.6/Project.toml`
  [6e4b80f9] BenchmarkTools v0.7.0
  [634d3b9d] DrWatson v2.0.2
  [7073ff75] IJulia v1.23.2
  [5fb14364] OhMyREPL v0.5.10
  [6f49c342] RCall v0.13.11
  [295af30f] Revise v3.1.15
  [0c614874] TerminalPager v0.1.0

This seems related to #341 and a workaround I found is to install the R packages in the native R console, and then import them from within Julia. Any thoughts as to what is happening? Thanks!

@ggebbie
Copy link

ggebbie commented Apr 11, 2022

This is also a problem for me. Perhaps the issue is that Conda.jl installs an older version of R, e.g.,
from the R REPL inside the Julia REPL:

R> sessionInfo() R version 3.6.1 (2019-07-05) Platform: x86_64-conda_cos6-linux-gnu (64-bit) Running under: Ubuntu 21.10

@schlichtanders
Copy link

schlichtanders commented May 7, 2023

I am also running into this with R 4.0.4 on ARM64 installed via

apt-get install -y r-base r-base-dev

on docker julia:1.8.5. (i.e. no Conda, but truely separately installed R)

(this R version is kind of the only option if you want to use a precompiled R for ARM64)

@palday
Copy link
Collaborator

palday commented May 7, 2023

This feels an old issue where the Julia links to a different version of some C/C++ standard libs than R does. In the past, you had to fix this by manually setting LD_LIBRARY_PATH. Julia 1.9 will fix some of this -- are you able to test this with the current release candidates.

@palday
Copy link
Collaborator

palday commented Jul 18, 2024

@TheCedarPrince what happens if you specify method="wget" in your R"install.packages" invocation?

@ggebbie
Copy link

ggebbie commented Jul 22, 2024

method="wget" appears to work for me although I have not been able to reproduce the exact situation from 2 years ago. thank you @palday

julia> R"""
       install.packages('gridExtra',method="wget")
       """
--2024-07-21 20:52:12--  https://cloud.r-project.org/src/contrib/gridExtra_2.3.tar.gz
Resolving cloud.r-project.org (cloud.r-project.org)... 13.249.190.36, 13.249.190.18, 13.249.190.119, ...
Connecting to cloud.r-project.org (cloud.r-project.org)|13.249.190.36|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1062844 (1.0M) [application/x-gzip]
Saving to:/tmp/RtmpvNSHNO/downloaded_packages/gridExtra_2.3.tar.gz’

/tmp/RtmpvNSHNO/downloaded_ 100%[==========================================>]   1.01M  --.-KB/s    in 0.1s    

2024-07-21 20:52:13 (8.69 MB/s) -/tmp/RtmpvNSHNO/downloaded_packages/gridExtra_2.3.tar.gz’ saved [1062844/1062844]

* installing *source* package ‘gridExtra’ ...
** package ‘gridExtra’ successfully unpacked and MD5 sums checked
** using staged installation
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (gridExtra)
┌ Warning: RCall.jl: Installing package into ‘/home/gebbie/R/x86_64-pc-linux-gnu-library/4.2’
│ (as ‘lib’ is unspecified)
│ 
│ The downloaded source packages are in
│       ‘/tmp/RtmpvNSHNO/downloaded_packages’
└ @ RCall ~/.julia/packages/RCall/FEbLj/src/io.jl:172
RObject{NilSxp}
NULL

@palday palday closed this as completed Jul 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants