thierrygosselin / grur

grur: an R package tailored for RADseq data imputations
https://thierrygosselin.github.io/grur/
7 stars 0 forks source link

Package dependencies #3

Closed IdoBar closed 6 years ago

IdoBar commented 7 years ago

Hi Thierry,

As I've mentioned in my other Issue, grur requires quite a lot of dependencies, which in my case raised an maximal number of DLLs reached error when loaded with a few other packages. It seems that the issue is with the Rdynload.c of the base R code: #define MAX_NUM_DLLS 100. In R versions >3.4, you can set a different max number of DLLs using and environmental variable R_MAX_NUM_DLLS. (taken from this SO thread) From the release notes:

The maximum number of DLLs that can be loaded into R e.g. via dyn.load() can now be increased by setting the environment variable R_MAX_NUM_DLLS before starting R.

I'm pretty sure some of the packages are not entirely needed, such as maps, mapdata, and non-standard tidyverse packages, such as glue, tidyselect, purrrlyr, reshape2 (isn't it a part of tidyr now?), plyr (mostly replaced by dplyr), etc.

Thanks, Ido

thierrygosselin commented 7 years ago

Hi Ido,

As stated in here I have tried with fresh Linux and Mac and I can't reproduce your problem. I'll give it a try again, but for now you're the only one reporting this issue. And I had never heard of this before, so it's all new to me. Have you read somewhere that it could be computer/Os specific ?

Inside grur I'm always using :: for package functions. During grur install, it will need to install all the packages in the Imports field of the DESCRIPTION file as well as packages required by those packages, this is where it hurts.

However it doesn't load these packages dependencies unless needed Here is the list for grur dependencies:

    dplyr (>= 0.7.0),
    purrr,
    readr,
    tibble,
    tidyr,
    ggplot2,
    vcfR (>= 1.3.0),
    data.table,
    stringi,
    ape,
    parallel,
    amap,
    magrittr,
    stats,
    utils,
    ranger,
    pbmcapply,
    xgboost,
    randomForestSRC,
    pegas,
    radiator,
    fst (>= 0.7.2),
    purrrlyr,
    strataG,
    rmetasim,
    rlang

I don't see packages I could remove. I've seen packages with a lot more dependencies. Sadly, tidyverse cannot be used in the DESCRIPTION file during package development. As of maps, mapdata, glue, tidyselect, reshape2 and plyr they are not used by grur so I cannot do anything about it, except suggesting authors of packages using those to remove it from their dependencies...

So first step for me is trying to reproduce the issue with DLLs in order to fix it... I'll reopen the issue if I have a solution. Thanks! Thierry

thierrygosselin commented 6 years ago

Did a couple of tests...

With a clean R session, devtools::session_info() gives me 14 packages

After library(adegenet), devtools::session_info() gives me 69 packages

restart R library(strataG), devtools::session_info() gives me 115 packages

restart R library(radiator), devtools::session_info() gives me 51 packages

restart R library(grur), devtools::session_info() gives me 156 packages !!! Wo...

thierrygosselin commented 6 years ago

I can reduce from 156 to 114 if I put strataG in the Suggests field of the DESCRIPTION file.

EricArcher commented 6 years ago

Good to know. This will get better once I do some housecleaning in strataG later this year.

On Wed, Apr 11, 2018 at 8:01 PM Thierry Gosselin notifications@github.com wrote:

I can reduce from 156 to 114 if I put strataG in the Suggests field of the DESCRIPTION file.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/thierrygosselin/grur/issues/3#issuecomment-380660651, or mute the thread https://github.com/notifications/unsubscribe-auth/AEoTSy_sq-UvGKDXbEaJ-Y54981dw637ks5tnsNxgaJpZM4PdKyG .

--

Eric Archer, Ph.D.

Southwest Fisheries Science Center (NMFS/NOAA) 8901 La Jolla Shores Drive La Jolla, CA 92037 USA 858-546-7121 (work) 858-546-7003 (FAX)

Marine Mammal Genetics Group: swfsc.noaa.gov/mmtd-mmgenetics GitHub: github.com/ericarcher

Adjunct Professor, Marine Biology Scripps Institution of Oceanography University of California, San Diego http://profiles.ucsd.edu/frederick.archer

"

The universe doesn't care what you believe. The wonderful thing about science is that it doesn't ask for your faith, it just asks for your eyes." - Randall Munroe

"Lighthouses are more helpful than churches."

thierrygosselin commented 6 years ago

Recently, I've also put: lightgbm, missRanger, randomForestSRC, ranger, rmetasim, xgboost in the Suggests field to reduce dependencies during installation.

The sad part is that strataG is not installed automatically with grur, If user try to run grur::simulate_rad without strataG on their system it stops and ask to install it:

if (!requireNamespace("strataG", quietly = TRUE)) {
    stop("strataG needed for this function to work
         Install with install.packages('strataG')", call. = FALSE)
  }

I'm updating doc to give an example of simulation

@EricArcher and @IdoBar Other suggestions to remove potential DLL problem on linux machines ?