randy3k / radian

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

radian do not respect R wrapper script #319

Closed TTTPOB closed 2 years ago

TTTPOB commented 2 years ago

recently I am exploring using nix to manage my environment.

edit start:

I've realized that radian find R not by path but by rchitect.Rhome(), but what is the advantage to do this over just use R executable in the first PATH containing R?

If just reading PATH is not acceptable (why?!), maybe we can add an option to override this behavior? like radian --wrapper /path/to/wrapper to let users make some modification of R session before the start the R?

Or I think I should make R in nix return the R_HOME in wrapper location?

edit end

basically it create a R wrapper that include all packages I wanted and wrote into environment configuration file into R_LIBS_SITE, and all packages are well managed as well as their system dependencies/R dependencies.

But it seems that radian will not recognize the R_LIBS_SITE set in that wrapper.

I've search this repo and have not found evidence that radian reset R_LIBS_SITE or bypass R wrapper script (as far as I know, plain R install also has a bin/R which is a wrapper)

other info

> echo $PATH|tr ":" "\n"| grep R
/nix/store/g47m0xkgawjz6gbmhxgn80n1d1axs1mz-R-4.1.1-wrapper/bin

> which radian
/nix/store/pzzgvlkd41gh9hbfzj0dljc524w4lxh1-python3.9-radian-0.5.12/bin/radian

> radian --version
radian version: 0.5.12
r executable: /nix/store/h89y1fr8dkr1m9f95nyy0i5lybbn3dwl-R-4.1.1/lib/R/bin/R
r version: 4.1.1
python executable: /nix/store/97w52ckcjnfiz89h3lh7zf1kysgfm2s8-python3-3.9.6/bin/python3.9
python version: 3.9.6
### you see, the R executable path differs from the right R path, how could this happen

> radian --version --r-binary /nix/store/g47m0xkgawjz6gbmhxgn80n1d1axs1mz-R-4.1.1-wrapper/bin/R
radian version: 0.5.12
r executable: /nix/store/h89y1fr8dkr1m9f95nyy0i5lybbn3dwl-R-4.1.1/lib/R/bin/R
r version: 4.1.1
python executable: /nix/store/97w52ckcjnfiz89h3lh7zf1kysgfm2s8-python3-3.9.6/bin/python3.9
python version: 3.9.6
### this happens even if I specified which R to use

> radian
>> .libPaths()
### just packages path inside R_HOME

> R
>> .libPaths()
### all library paths set in the wrapper as pasted below

# wrapper script content, it sets R_LIBS_SITE to let R recognize installed packages
> cat /nix/store/g47m0xkgawjz6gbmhxgn80n1d1axs1mz-R-4.1.1-wrapper/bin
#! /nix/store/wadmyilr414n7bimxysbny876i2vlm5r-bash-5.1-p8/bin/bash -e
export R_LIBS_SITE='/nix/store/ij0lkvw25dcw6iwd1lcw9y2l594lxin1-r-boot-1.3-28/library:/nix/store/fr02w04q73v6wfc0p1qxprk4avg4h1sd-r-class-7.3-19/library:/nix/store/k77kjm5hf7s7yjvaa7y5zdfcxs7k04qp-r-MASS-7.3-54/library:/nix/store/vfvfdzy2ch2122v8y70g2yczk9dac1hf-r-cluster-2.1.2/library:/nix/store/7x79khqjijma0ig2wfz07y1m6ahpdydd-r-codetools-0.2-18/library:/nix/store/pqkqvsgqd6w6j61jqbls5jmgxjjnacd1-r-foreign-0.8-81/library:/nix/store/ymn4j1hg6fcpcdqw8k3c7xp09cq4rwqq-r-KernSmooth-2.23-20/library:/nix/store/mbm0jzw7bjf292xljp5fcj3ggh8f5vzg-r-lattice-0.20-45/library:/nix/store/b3f21dmxvh5m99iamfym79sqrffnbd40-r-Matrix-1.3-4/library:/nix/store/plyvxmbwzgj2a634b3k6x97fplc20d55-r-mgcv-1.8-37/library:/nix/store/mniky2fz6nxlz6pjdm813x4qmvrc12iw-r-nlme-3.1-153/library:/nix/store/b9p222y7scmjmzndhxij3aygb59dd1wx-r-nnet-7.3-16/library:/nix/store/49m9zcf7ws9i0fxaflpvjm6k0sbyys2v-r-rpart-4.1-15/library:/nix/store/79aidwa1bqf0n6zlfv13fd97q0gaqwx1-r-spatial-7.3-14/library:/nix/store/f0wa0xg7h4v9fyc3a7pdnv4q9y0q2wdy-r-survival-3.2-13/library:/nix/store/zdjlvhn4ls0j6b3xwig3qvj602miql6f-r-tidyverse-1.3.1/library:/nix/store/c41j6ws4xb8yrvbswrqqf57chxvx9lfk-r-broom-0.7.9/library:/nix/store/ssrs7244zlqq708d5x1d7vzgb0pwas7d-r-backports-1.2.1/library:/nix/store/0xzz9y4l4zf1q17qp287drrvjdlkw3wd-r-dplyr-1.0.7/library:/nix/store/nrr4353nxciby0l2wd2cq0372mjx0xx3-r-ellipsis-0.3.2/library:/nix/store/hfq01mxq6rx94w34j4n8dimjn6nrpd5k-r-rlang-0.4.11/library:/nix/store/8fqq8qxvkbjff5i7ap45v62ks38a5jws-r-generics-0.1.0/library:/nix/store/wmvs51x3qb5lm5hz4xnxadfa1cxd6l76-r-glue-1.4.2/library:/nix/store/3c5ifx6n7mbrlb9bnk3z7ankxwd7gas5-r-lifecycle-1.0.1/library:/nix/store/h4hrzpjzmani86yfi9j4fl1km86x57k6-r-magrittr-2.0.1/library:/nix/store/94gis7893wbk3ndr2cdpghwvyix4ak7y-r-pillar-1.6.2/library:/nix/store/bzmqir3hfblpzcgra82cd43lxr3shwxm-r-cli-3.0.1/library:/nix/store/j1zbsljysnldkll6fbb839n8jjf6xknp-r-crayon-1.4.1/library:/nix/store/6zqpkiip7ngvcwgn7w8y4qgvlmqw26a9-r-fansi-0.5.0/library:/nix/store/gpyqx1ab20ny5xbzg5nmyq693mr1ci34-r-utf8-1.2.2/library:/nix/store/94c642f5va3454idvgj84nzgj8ln6djh-r-vctrs-0.3.8/library:/nix/store/4w09ci92slvziq3063k9ll3hdkq5nckb-r-R6-2.5.1/library:/nix/store/qilmhzf62qsi9kijr219kvgr443kxv8r-r-tibble-3.1.4/library:/nix/store/zb2c7fhx6dy6nmi88xyq3bixv1z8gkr3-r-pkgconfig-2.0.3/library:/nix/store/v7ya5j8xsnk4anxhx6niv1nv2lvghh9r-r-tidyselect-1.1.1/library:/nix/store/glggxc29q2iyz8aa29gq0vhgapad60df-r-purrr-0.3.4/library:/nix/store/ibd90ywz4nvyyv1sz2jw28f3kcjmjg6y-r-stringr-1.4.0/library:/nix/store/jaqniy2jgi5vkzvsy4csspsx87fms0sv-r-stringi-1.7.4/library:/nix/store/n8q3ccf5szhs6vi3p2ycjf9l87mnmlk5-r-tidyr-1.1.3/library:/nix/store/vlnhybic98hys7wnl2kjxkf29rl1jr44-r-cpp11-0.4.0/library:/nix/store/s4qc01jf5ar7l1f878j9s63xfdd6sfh8-r-dbplyr-2.1.1/library:/nix/store/y521jplxl5jg7p720l0v3qdrq0z4imqp-r-assertthat-0.2.1/library:/nix/store/5avr442sh1wmym91wl6iv34i8rp0i7m6-r-blob-1.2.2/library:/nix/store/1nrlhk6dmdkba9nq2qgf0izbikaysxk6-r-DBI-1.1.1/library:/nix/store/813dir6rwjin6f59q8wjj9r7wk1qqk3z-r-withr-2.4.2/library:/nix/store/p6rv4kvdcw9r9c8r730bwpinbmy7r6g0-r-dtplyr-1.1.0/library:/nix/store/x9xyjwklzjabhdw2psb08hi6as1pi368-r-data.table-1.14.0/library:/nix/store/nal9wk862s01c0l67mnl8mrfv7jnwxps-r-forcats-0.5.1/library:/nix/store/h367n2b427jav2q7lsqb3shjk9ni688d-r-ggplot2-3.3.5/library:/nix/store/n55x9bl1sx4v7cqmbqpzpbi2xypl7l7w-r-digest-0.6.28/library:/nix/store/s8i57gp8wskp6zpifqzc0a0prszsvwkm-r-gtable-0.3.0/library:/nix/store/1abv57wqflr0cj7c140glbfrg6pnkpgs-r-isoband-0.2.5/library:/nix/store/y3q1gzhs1jq87ib38s1mk0j705nr3al5-r-scales-1.1.1/library:/nix/store/77xzmsn4b71w42x4jjyqj1dz7qwy76mw-r-farver-2.1.0/library:/nix/store/hf0sv8k5la618qpkizx4aygqmdjv56db-r-labeling-0.4.2/library:/nix/store/c8i4w5qz7p86qlkj55h89z1msdgaj733-r-munsell-0.5.0/library:/nix/store/ahikk5alnkg5bpw9s3nwdifizv678hnf-r-colorspace-2.0-2/library:/nix/store/znymsiyyxs3m2yzp33zc4wfprqdpvrsv-r-RColorBrewer-1.1-2/library:/nix/store/ipvkrvh74p13pb4daajp3cqc1ld71npg-r-viridisLite-0.4.0/library:/nix/store/9mlig6pfwfr4v7bnhlyzkqbkakph7187-r-googledrive-2.0.0/library:/nix/store/a6x0fwq99lpww48kff6jdb6nw1frcpc7-r-gargle-1.2.0/library:/nix/store/z9gbsad8hmcpc5bbl4bvsjla7ifl28c6-r-fs-1.5.0/library:/nix/store/l1s1hxkggs1ng2pai678xq52zjdmkz1n-r-httr-1.4.2/library:/nix/store/x4l97ikh7nk6y8iyn9qq7sax5y4j35mx-r-curl-4.3.2/library:/nix/store/r1aqbsf3kmqwsf0qg0rdilmpm4gb88r3-r-jsonlite-1.7.2/library:/nix/store/653n08mafz004nkgqz65cfi8wcw24qk4-r-mime-0.11/library:/nix/store/azv0f6d777six6p72m20f9sz4x4g0qpz-r-openssl-1.4.5/library:/nix/store/15jlpi9y1xvhzx7a1b5s4xh3sa7akrx4-r-askpass-1.1/library:/nix/store/ijv88k4g563j7lagzqi18g5zcn5ajv7p-r-sys-3.4/library:/nix/store/34j24w2bzkli5jh4fnrb50y4ah7a3830-r-rappdirs-0.3.3/library:/nix/store/2s6dyb1zgf475my55ly5a4636kw12va8-r-rstudioapi-0.13/library:/nix/store/jv9fbzn5z3lmznbz03gv91r96qhn9bs5-r-uuid-0.1-4/library:/nix/store/b84f2schkmy5n2b0yvi430wxxszhzwvc-r-googlesheets4-1.0.0/library:/nix/store/865ldskcaqrx37m2qkvx3awafrf1krls-r-cellranger-1.1.0/library:/nix/store/x0glp65ffbwjn0921rf43j06yvkkr92d-r-rematch-1.0.1/library:/nix/store/j6ijz2sdm8gj5b3z5xixiawl6zrdx1cz-r-ids-1.0.1/library:/nix/store/pjw70knpmczkj7gxc8gkn0bl9h7748yw-r-rematch2-2.1.2/library:/nix/store/lq7l4w4sjdfs8x03h8ckqn661xf6fwds-r-haven-2.4.3/library:/nix/store/3zzfm8b0bnjpccizw52h853ig6c4vwbb-r-hms-1.1.0/library:/nix/store/1362vk53fbq2k0l4bmy5dy7j2ad1mdrb-r-readr-2.0.1/library:/nix/store/l53rh0y6py40zf7x77bpy4hkjf6m720y-r-clipr-0.7.1/library:/nix/store/drvahbp6rgamjxpvrrif9jqbs426by31-r-tzdb-0.1.2/library:/nix/store/p6zlr1bqd1d7mdbjxn85jg05fkjgaccd-r-vroom-1.5.5/library:/nix/store/3im52kmddlg94kghy49pzxsqz2c2payk-r-bit64-4.0.5/library:/nix/store/4h2543inkdlxnppr69s1nyiva1f1gk67-r-bit-4.0.4/library:/nix/store/s6qpmbvzcxwpk2raf19j5rn4p9h9cix5-r-progress-1.2.2/library:/nix/store/7ay5324iad3697mr24vjzlx122yafcbs-r-prettyunits-1.1.1/library:/nix/store/n3agi0wiyri7699vxd9qnc86jbd7ljf6-r-lubridate-1.7.10/library:/nix/store/hgxlh8j8mj7323ya9wmj6732b68zs4a6-r-Rcpp-1.0.7/library:/nix/store/r16mrlg4yf9p10gw60x5xscfs69alhgg-r-modelr-0.1.8/library:/nix/store/5567p9i9hdlgqn1ghfh53ias2kcn2d3h-r-readxl-1.3.1/library:/nix/store/6nclwpziqrhfd2y9h8qnz24cw3vhiiwq-r-reprex-2.0.1/library:/nix/store/imh0gn7788m88a2n07a7wmivp1kw52fi-r-callr-3.7.0/library:/nix/store/y5k1wr37h56nnp06ywgw4a9shch5h8c0-r-processx-3.5.2/library:/nix/store/9q9s0298a7c985lhsr2ig2a86wy673n3-r-ps-1.6.0/library:/nix/store/h5isq16yaahpd1mkdrlaayp8k7kdh6sw-r-knitr-1.34/library:/nix/store/g74lq56xixz5s39zylp0skpk3h1696j2-r-evaluate-0.14/library:/nix/store/hgd0bbcqyq667ar1d5c8f7glbx2nzllf-r-highr-0.9/library:/nix/store/ygv6rc1l7xgwwjmz4n7psh0c2pf362wh-r-xfun-0.26/library:/nix/store/ckgy67qz0qvb1qs08ax8ljr6pdyimjha-r-yaml-2.2.1/library:/nix/store/xjk3nvmg77q46rdf1c6vz2jjiplcwfyx-r-rmarkdown-2.11/library:/nix/store/jv47x6jlmzjpis5g23lz6yzfpfc0dy2a-r-htmltools-0.5.2/library:/nix/store/hjmw0qli90gbqwrwm02yx79cgwl9ngvi-r-base64enc-0.1-3/library:/nix/store/h9a7fqci1xaq0nz19x72pb4y811y5rjh-r-fastmap-1.1.0/library:/nix/store/cycw3lcqw3sgxra5lv63ca492wqnbjym-r-jquerylib-0.1.4/library:/nix/store/b3l842rb8mqx2inwc4p113ksljv7wdkl-r-tinytex-0.33/library:/nix/store/4jxprisv05qp4wyclnqrysdy0nw4i7nc-r-rvest-1.0.1/library:/nix/store/y55mjnyxriizil6mnfnb1xik232dgi0c-r-selectr-0.4-2/library:/nix/store/c31z2viwhqpyzjip4mqm4xjbgy89cpg9-r-xml2-1.3.2/library:/nix/store/h08zxqr8j8skgp8g667fm07ym21y0rkl-r-DESeq2-1.32.0/library:/nix/store/mkiyc3kf9igsak86cys2kjjhnrhgnabk-r-Biobase-2.52.0/library:/nix/store/ivnwf9d2ip71rvf9ripjkqfik3qcjkr6-r-BiocGenerics-0.38.0/library:/nix/store/n6j2xgqd4d9v7jy90wrnwrs4v38d0az7-r-BiocParallel-1.26.2/library:/nix/store/82pvmkrlwr6i7wyhxgaq2bmsjw6v2g4j-r-BH-1.75.0-0/library:/nix/store/c1j1z9j3hr3laknrwbds5xa3qpdh884m-r-futile.logger-1.4.3/library:/nix/store/6nn98b4a2pk015k5bm5hmxgh4vvayy5v-r-futile.options-1.0.1/library:/nix/store/784srmk0d70q8sq6qppw4p6i4if94l1s-r-lambda.r-1.2.4/library:/nix/store/sh1b2rb6pkqkg3i6cfhciqyg92b8qxlk-r-formatR-1.11/library:/nix/store/c0by10kadlqkc387r5dd8wary9zrjqqm-r-snow-0.4-3/library:/nix/store/sbji7fhlji79yzywbyl0iyxjg5lc7k4n-r-genefilter-1.74.0/library:/nix/store/br8q5797b2p06zflrzz68nhhxqgb7ixd-r-annotate-1.70.0/library:/nix/store/y5gd6x3aapymd2pr8f6gc51qpjb14jba-r-AnnotationDbi-1.54.1/library:/nix/store/lcrf4mrkbl4i8za8wqa0vdix8l3j1p0h-r-IRanges-2.26.0/library:/nix/store/r7v1zrbaab8l6x8bifqw704xyr3616bb-r-S4Vectors-0.30.0/library:/nix/store/lzqfvj3smv3b4zdazdd011cr1xd3r0yf-r-KEGGREST-1.32.0/library:/nix/store/acd8628yk93yklhxjlql98l7wfffsam7-r-Biostrings-2.60.2/library:/nix/store/4yy0zd7x9zgykxnqk6qiyjrlsxkg4310-r-GenomeInfoDb-1.28.4/library:/nix/store/nj3hlhmwzdh1dajbdxzrl721djsq3g7q-r-GenomeInfoDbData-1.2.6/library:/nix/store/2zp3cdji4z80h2lmdd68sk4aa7ah3ln8-r-RCurl-1.98-1.5/library:/nix/store/c4g4bl0hzw9wfxr5wa2c5xyii117q828-r-bitops-1.0-7/library:/nix/store/glqvv501m97wi2grssfdkh3y1a2n6f03-r-XVector-0.32.0/library:/nix/store/94r79lglwgpb1lkbhvs24m558c8szih2-r-zlibbioc-1.38.0/library:/nix/store/j4g05wrskwpz6m09v4pibzmnh09acy1a-r-png-0.1-7/library:/nix/store/09khpb5nw41sqd56284v0yij396ckk9s-r-RSQLite-2.2.8/library:/nix/store/sdq31xrky99170wvnax6z8nhk30xr251-r-memoise-2.0.0/library:/nix/store/igwg6n7s38s0nx6s3gdm4wkw7ml19zkk-r-cachem-1.0.6/library:/nix/store/5877xlp4gnhl7qwinhdni3gzph3mdapj-r-plogr-0.2.0/library:/nix/store/xrb1sshh4z8499andaj5w9a0a5rhfsqi-r-XML-3.99-0.8/library:/nix/store/wavgkxw8gyx15fa7qm14axgias5w385c-r-xtable-1.8-4/library:/nix/store/vr4xfkh0myfxpbdcw57x4pfq434ppzw3-r-geneplotter-1.70.0/library:/nix/store/z9zpjci2rvnfw5klry284j3v42j61m1f-r-GenomicRanges-1.44.0/library:/nix/store/n2j7k565vadcy2xx0k91zpq12kmxms5y-r-locfit-1.5-9.4/library:/nix/store/qhjqbnysszyfcdid7hyz3dg5dfyhfyx6-r-RcppArmadillo-0.10.6.0.0/library:/nix/store/8b8vgs7wfd68wywngjh0n8q14h6cz5s6-r-SummarizedExperiment-1.22.0/library:/nix/store/v9vwnyldfjasv5s18r7ji22y6cjy6fjd-r-DelayedArray-0.18.0/library:/nix/store/d05b5zm3rnazllsqb7d8yvnk3g6yzsc4-r-MatrixGenerics-1.4.3/library:/nix/store/mq89cjnnw4aw78sikl4fdnm3fsv5ljbs-r-matrixStats-0.61.0/library:/nix/store/9gkm5zyxqzyzas3ymshx407jpgljp09v-r-languageserver-0.3.11/library:/nix/store/sgy9i60rlmic9d8vcc2m6ww5s6w7yjsa-r-collections-0.3.5/library:/nix/store/ipxwz3spf9f6y5fvry3x9xch2dlbhhfj-r-desc-1.3.0/library:/nix/store/7vh9ymh79giq4b2xfw4l6ilaj3b6s6i0-r-rprojroot-2.0.2/library:/nix/store/232wymw5ak2f5fbylgkyhn5m4cnnd4q4-r-lintr-2.0.1/library:/nix/store/60i2wwlasv64bgwh87gx310bgwnmny1r-r-cyclocomp-1.1.0/library:/nix/store/p1lyw9axa82idsqhms24gmg70bb7kwxl-r-remotes-2.4.0/library:/nix/store/d04lz322a41jd0rwi4cyvjgz6mwwlsb5-r-rex-1.2.0/library:/nix/store/68afhh9cglv9rz11pyh4bqlk85yzvqni-r-lazyeval-0.2.2/library:/nix/store/vwzg8sw54hs6ndaipc6qj9bc0vp4bpsa-r-testthat-3.0.4/library:/nix/store/x0sl6cpg5zkxnkvb49lqsb4agj6lpph0-r-brio-1.1.2/library:/nix/store/6b2mh78kxbilz12bl60s82gkmjanh18j-r-pkgload-1.2.2/library:/nix/store/w1lgv6nmp6j594m8ygadmkaw2c5gzhln-r-praise-1.0.0/library:/nix/store/rcgzfl55c6hqcr5fm8gyywk228l9w9gj-r-waldo-0.3.1/library:/nix/store/bn7w8bv17sjdd701p3xlwlr7dbsj4sx1-r-diffobj-0.3.4/library:/nix/store/7bypmm8j13sza9nj8yvqwvvdvvnzx85s-r-xmlparsedata-1.0.5/library:/nix/store/4ka0xmjcf6snyy2z7wnkag8h5pgdkj3l-r-repr-1.1.3/library:/nix/store/xjp68gjmpax91lvi1ijiv7089k5pxclm-r-roxygen2-7.1.2/library:/nix/store/ldm7i2r50lna31lhsmhy8aiznckpq7wf-r-brew-1.0-6/library:/nix/store/q2h8q7brn5xldi0fnps7g7nc5ix0ja6w-r-commonmark-1.7/library:/nix/store/8as75wmmqqmk796w8y7nvarw7ixww00f-r-styler-1.6.2/library:/nix/store/2kfs53dl7ns7lng0xx6lhw8baqh9sr7i-r-R.cache-0.15.0/library:/nix/store/5xhnm1fvwb095pdb985wcga00s36m7n0-r-R.methodsS3-1.8.1/library:/nix/store/97mr1pvm3gppcv7cnvbzlrg4bdx3sn8n-r-R.oo-1.24.0/library:/nix/store/c9niaxm101v2fwqrbvcl811pkmxc9wfc-r-R.utils-2.10.1/library:/nix/store/64s8pmxn7j9845g2bdazm6ds3zhi2wzb-r-httpgd-1.2.1/library:/nix/store/rzrwv9kh4ly3a3lcjxhs89p2s7f30132-r-later-1.3.0/library:/nix/store/vnc94w5g85f51cbp9di4qxhyhiijmmv6-r-systemfonts-1.0.2/library'${R_LIBS_SITE:+':'}$R_LIBS_SITE
exec "/nix/store/h89y1fr8dkr1m9f95nyy0i5lybbn3dwl-R-4.1.1/bin/R"  "$@"
randy3k commented 2 years ago

The best solution is to make another wrapper script for radian.

Sorry, didn't have time to reply your other questions. Will come back to you.

TTTPOB commented 2 years ago

The best solution is to make another wrapper script for radian.

Sorry, didn't have time to reply your other questions. Will come back to you.

Thank your for your reply, I saw pull requests of radian wrapper in nixpkgs repo and I am using it, I am happy with it now

and after having a closer look of radian code, I think I was wrong about how it works, it seems it working via libR.so and ffi instead of opening a R console and interact with it?

randy3k commented 2 years ago

and after having a closer look of radian code, I think I was wrong about how it works, it seems it working via libR.so and ffi instead of opening a R console and interact with it?

Exactly.

TTTPOB commented 2 years ago

thank you and I think I have known what I have to do