nlmixr2 / blog

The nlmixr2 blog
0 stars 1 forks source link

blog/2024-03-05-aws/ #29

Open utterances-bot opened 3 weeks ago

utterances-bot commented 3 weeks ago

nlmixr2, tidyverse and RStudio on AWS | nlmixr2

nlmixr: open source nonlinear mixed-effects modeling for R.

https://blog.nlmixr2.org/blog/2024-03-05-aws/

Nakamarusan commented 3 weeks ago

Hi, nlmixr2 team! Thanks for providing very useful information about nlmixr2 on AWS.

Following the installation instructions, R and RStudio Server were installed without any issues, but I encountered a few problems while installing the tidyverse package, which I would like to share.

Information of EC2 instance

OS Images: Ubuntu AMI (Ubuntu Server 24.04 LTS (HVM), SSD Volume Type).  Instance type: t2.large instance

R and RStudio-server version

R:

sessionInfo()
R version 4.4.0 (2024-04-24)
Platform: x86_64-pc-linux-gnu
Running under: Ubuntu 24.04 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3 
LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.26.so;  LAPACK version 3.12.0

locale:
 [1] LC_CTYPE=C.UTF-8       LC_NUMERIC=C          
 [3] LC_TIME=C.UTF-8        LC_COLLATE=C.UTF-8    
 [5] LC_MONETARY=C.UTF-8    LC_MESSAGES=C.UTF-8   
 [7] LC_PAPER=C.UTF-8       LC_NAME=C             
 [9] LC_ADDRESS=C           LC_TELEPHONE=C        
[11] LC_MEASUREMENT=C.UTF-8 LC_IDENTIFICATION=C   

time zone: Etc/UTC
tzcode source: system (glibc)

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

other attached packages:
 [1] babelmixr2_0.1.2  nlmixr2_2.1.2     nlmixr2data_2.0.9
 [4] rxode2_2.1.3      lubridate_1.9.3   forcats_1.0.0    
 [7] stringr_1.5.1     dplyr_1.1.4       purrr_1.0.2      
[10] readr_2.1.5       tidyr_1.3.1       tibble_3.2.1     
[13] ggplot2_3.5.1     tidyverse_2.0.0  

loaded via a namespace (and not attached):
 [1] bitops_1.0-7        gridExtra_2.3       gld_2.6.6          
 [4] nlmixr2plot_2.0.9   readxl_1.4.3        rlang_1.1.4        
 [7] magrittr_2.0.3      e1071_1.7-14        compiler_4.4.0     
[10] png_0.1-8           vctrs_0.6.5         PreciseSums_0.6    
[13] pkgconfig_2.0.3     crayon_1.5.2        fastmap_1.2.0      
[16] backports_1.5.0     labeling_0.4.3      pander_0.6.5       
[19] utf8_1.2.4          rmarkdown_2.27      tzdb_0.4.0         
[22] xfun_0.44           rxode2et_2.0.13     cachem_1.1.0       
[25] rxode2parse_2.0.19  Deriv_4.1.3         cluster_2.1.6      
[28] DescTools_0.99.54   R6_2.5.1            stringi_1.8.4      
[31] qs_0.26.3           boot_1.3-30         rpart_4.1.23       
[34] cellranger_1.1.0    Rcpp_1.0.12         assertthat_0.2.1   
[37] knitr_1.47          base64enc_0.1-3     Matrix_1.7-0       
[40] nnet_7.3-19         timechange_0.3.0    tidyselect_1.2.1   
[43] rstudioapi_0.16.0   dparser_1.3.1-11    stringfish_0.16.0  
[46] minpack.lm_1.2-4    lbfgsb3c_2024-3.4   lattice_0.22-5     
[49] rxode2ll_2.0.11     withr_3.0.0         evaluate_0.23      
[52] foreign_0.8-86      proxy_0.4-27        RcppParallel_5.1.7 
[55] nonmem2rx_0.1.4     pillar_1.9.0        checkmate_2.3.1    
[58] rex_1.2.1           generics_0.1.3      RCurl_1.98-1.14    
[61] hms_1.1.3           munsell_0.5.1       scales_1.3.0       
[64] rootSolve_1.8.2.4   RApiSerialize_0.1.3 n1qn1_6.0.1-11     
[67] class_7.3-22        glue_1.7.0          nlmixr2est_2.2.2   
[70] symengine_0.2.6     lotri_0.4.3         Hmisc_5.1-3        
[73] lmom_3.0            lazyeval_0.2.2      tools_4.4.0        
[76] sys_3.4.2           data.table_1.15.4   Exact_3.2          
[79] mvtnorm_1.2-5       grid_4.4.0          colorspace_2.1-0   
[82] nlme_3.1-164        rxode2random_2.1.1  htmlTable_2.4.2    
[85] Formula_1.2-5       cli_3.6.2           fansi_1.0.6        
[88] expm_0.999-9        binom_1.1-1.1       gtable_0.3.5       
[91] digest_0.6.35       farver_2.1.2        htmlwidgets_1.6.4  
[94] memoise_2.0.1       htmltools_0.5.8.1   lifecycle_1.0.4    
[97] httr_1.4.7          xgxr_1.1.2          MASS_7.3-60.0.1  

RStudio-server: 2022.12.0+353

Installation of some packages

Installation of tidyverse

Running install.packages("tidyverse") resulted in the following error: ERROR: dependency ‘ragg’ is not available for package ‘tidyverse’

Attempting to install ragg using install.packages("ragg") led to another error: ERROR: dependencies ‘systemfonts’, ‘textshaping’ are not available for package ‘ragg’

Trying to install systemfonts using install.packages("systemfonts") produced the following error: ERROR: configuration failed for package ‘systemfonts’"

Finally, by running the following additional commands, I was able to install tidyverse without any issues:

sudo apt-get update
sudo apt-get install libfontconfig1-dev
sudo apt-get install libharfbuzz-dev libfribidi-dev
sudo apt-get install libfreetype6-dev libpng-dev libtiff5-dev libjpeg-dev pkg-config
mattfidler commented 3 weeks ago

Thanks;

As another solution you can now use pak, which will install the ubuntu dependencies

https://pak.r-lib.org/index.html

Nakamarusan commented 3 weeks ago

Thank you for suggesting other solutions. Some functions of the pak package were not compatible with Ubuntu 24.04, so I switched to Ubuntu 22.04. Below are the results of executing pak::pkg_install("tidyverse")

pak::pkg_install("tidyverse")
→ Willinstall 101 packages.
→ Willdownload 101 CRAN packages (68.12 MB).
+ askpass         1.2.0   [bld][cmp][dl] (6.04 kB)
+ backports       1.5.0   [bld][cmp][dl] (26.20 kB)
+ base64enc       0.1-3   [bld][cmp][dl] (7.83 kB)
+ bit             4.0.5   [bld][cmp][dl] (827.75 kB)
+ bit64           4.0.5   [bld][cmp][dl] (135.09 kB)
+ blob            1.2.4   [bld][dl] (10.62 kB)
+ broom           1.0.6   [bld][dl] (641.85 kB)
+ bslib           0.7.0   [bld][dl] (5.13 MB)
+ cachem          1.1.0   [bld][cmp][dl] (26.51 kB)
+ callr           3.7.6   [bld][dl] (104.36 kB)
+ cellranger      1.1.0   [bld][dl] (63.86 kB)
+ cli             3.6.2   [bld][cmp][dl] (569.77 kB)
+ clipr           0.8.0   [bld][dl] (21.90 kB)
+ colorspace      2.1-0   [bld][cmp][dl] (2.12 MB)
+ conflicted      1.2.0   [bld][dl] (17.07 kB)
+ cpp11           0.4.7   [bld][dl] (285.78 kB)
+ crayon          1.5.2   [bld][dl] (40.57 kB)
+ curl            5.2.1   [bld][cmp][dl] (716.70 kB) + ✔ libcurl4-openssl-dev, ✔ libssl-dev
+ data.table      1.15.4  [bld][cmp][dl] (5.39 MB)
+ DBI             1.2.3   [bld][dl] (1.13 MB)
+ dbplyr          2.5.0   [bld][dl] (770.65 kB)
+ digest          0.6.35  [bld][cmp][dl] (230.39 kB)
+ dplyr           1.1.4   [bld][cmp][dl] (1.21 MB)
+ dtplyr          1.3.1   [bld][dl] (150.97 kB)
+ evaluate        0.23    [bld][dl] (28.35 kB)
+ fansi           1.0.6   [bld][cmp][dl] (482.48 kB)
+ farver          2.1.2   [bld][cmp][dl] (1.27 MB)
+ fastmap         1.2.0   [bld][cmp][dl] (46.41 kB)
+ fontawesome     0.5.2   [bld][dl] (1.28 MB)
+ forcats         1.0.0   [bld][dl] (294.18 kB)
+ fs              1.6.4   [bld][cmp][dl] (1.19 MB) + ✔ make
+ gargle          1.5.2   [bld][dl] (627.56 kB)
+ generics        0.1.3   [bld][dl] (172.20 kB)
+ ggplot2         3.5.1   [bld][dl] (3.56 MB)
+ glue            1.7.0   [bld][cmp][dl] (105.42 kB)
+ googledrive     2.1.1   [bld][dl] (1.61 MB)
+ googlesheets4   1.1.1   [bld][dl] (232.58 kB)
+ gtable          0.3.5   [bld][dl] (130.10 kB)
+ haven           2.5.4   [bld][cmp][dl] (313.33 kB) + ✔ make, ✔ zlib1g-dev
+ highr           0.11    [bld][dl] (15.08 kB)
+ hms             1.1.3   [bld][dl] (43.38 kB)
+ htmltools       0.5.8.1 [bld][cmp][dl] (135.13 kB)
+ httr            1.4.7   [bld][dl] (118.50 kB)
+ ids             1.0.1   [bld][dl] (91.21 kB)
+ isoband         0.2.7   [bld][cmp][dl] (1.59 MB)
+ jquerylib       0.1.4   [bld][dl] (520.21 kB)
+ jsonlite        1.8.8   [bld][cmp][dl] (1.05 MB)
+ knitr           1.47    [bld][dl] (471.55 kB) + ✖ pandoc
+ labeling        0.4.3   [bld][dl] (10.17 kB)
+ lifecycle       1.0.4   [bld][dl] (107.66 kB)
+ lubridate       1.9.3   [bld][cmp][dl] (428.04 kB)
+ magrittr        2.0.3   [bld][cmp][dl] (267.07 kB)
+ memoise         2.0.1   [bld][dl] (17.85 kB)
+ mime            0.12    [bld][cmp][dl] (12.56 kB)
+ modelr          0.1.11  [bld][dl] (121.48 kB)
+ munsell         0.5.1   [bld][dl] (182.31 kB)
+ openssl         2.2.0   [bld][cmp][dl] (1.21 MB) + ✔ libssl-dev
+ pillar          1.9.0   [bld][dl] (444.53 kB)
+ pkgconfig       2.0.3   [bld][dl] (6.08 kB)
+ prettyunits     1.2.0   [bld][dl] (97.50 kB)
+ processx        3.8.4   [bld][cmp][dl] (163.98 kB)
+ progress        1.2.3   [bld][dl] (30.50 kB)
+ ps              1.7.6   [bld][cmp][dl] (129.49 kB)
+ purrr           1.0.2   [bld][cmp][dl] (220.87 kB)
+ R6              2.5.1   [bld][dl] (63.42 kB)
+ ragg            1.3.2   [bld][cmp][dl] (430.24 kB) + ✖ libfreetype6-dev, ✔ libjpeg-dev, ✔ libpng-dev, ✖ libtiff-dev
+ rappdirs        0.3.3   [bld][cmp][dl] (12.29 kB)
+ RColorBrewer    1.1-3   [bld][dl] (11.64 kB)
+ readr           2.1.5   [bld][cmp][dl] (298.06 kB)
+ readxl          1.4.3   [bld][cmp][dl] (2.09 MB)
+ rematch         2.0.0   [bld][dl] (4.78 kB)
+ rematch2        2.1.2   [bld][dl] (13.37 kB)
+ reprex          2.1.0   [bld][dl] (1.09 MB) + ✖ pandoc
+ rlang           1.1.4   [bld][cmp][dl] (763.76 kB)
+ rmarkdown       2.27    [bld][dl] (2.19 MB) + ✖ pandoc
+ rstudioapi      0.16.0  [bld][dl] (117.42 kB)
+ rvest           1.0.4   [bld][dl] (115.88 kB)
+ sass            0.4.9   [bld][cmp][dl] (3.03 MB) + ✔ make
+ scales          1.3.0   [bld][cmp][dl] (302.54 kB)
+ selectr         0.4-2   [bld][dl] (41.37 kB)
+ stringi         1.8.4   [bld][cmp][dl] (11.92 MB) + ✔ libicu-dev
+ stringr         1.5.1   [bld][dl] (176.60 kB)
+ sys             3.4.2   [bld][cmp][dl] (20.17 kB)
+ systemfonts     1.1.0   [bld][cmp][dl] (80.84 kB) + ✖ libfontconfig1-dev, ✖ libfreetype6-dev
+ textshaping     0.4.0   [bld][cmp][dl] (35.10 kB) + ✖ libfreetype6-dev, ✖ libfribidi-dev, ✖ libharfbuzz-dev
+ tibble          3.2.1   [bld][cmp][dl] (565.98 kB)
+ tidyr           1.3.1   [bld][cmp][dl] (809.06 kB)
+ tidyselect      1.2.1   [bld][cmp][dl] (103.59 kB)
+ tidyverse       2.0.0   [bld][dl] (704.62 kB)
+ timechange      0.3.0   [bld][cmp][dl] (103.44 kB)
+ tinytex         0.51    [bld][dl] (34.31 kB)
+ tzdb            0.4.0   [bld][cmp][dl] (586.33 kB)
+ utf8            1.2.4   [bld][cmp][dl] (241.08 kB)
+ uuid            1.2-0   [bld][cmp][dl] (79.72 kB)
+ vctrs           0.6.5   [bld][cmp][dl] (969.07 kB)
+ viridisLite     0.4.2   [bld][dl] (1.27 MB)
+ vroom           1.6.5   [bld][cmp][dl] (750.42 kB)
+ withr           3.0.0   [bld][dl] (107.68 kB)
+ xfun            0.44    [bld][cmp][dl] (144.50 kB)
+ xml2            1.3.6   [bld][cmp][dl] (294.71 kB) + ✔ libxml2-dev
+ yaml            2.3.8   [bld][cmp][dl] (94.76 kB)
✖ Missing 6 system packages. You'll probably need to install them manually:
+ libfontconfig1-dev  - systemfonts
+ libfreetype6-dev    - ragg, systemfonts, textshaping
+ libfribidi-dev      - textshaping
+ libharfbuzz-dev     - textshaping
+ libtiff-dev         - ragg
+ pandoc              - knitr, reprex, rmarkdown

Additionally, to not only check the package dependencies required for installing tidyverse but also to investigate the system dependencies, I executed the following code.

pak::pkg_sysreqs("tidyverse")
── Install scripts ────────────────────────────────────────────────────── Ubuntu 22.04 ──
apt-get -y update
apt-get -y install libcurl4-openssl-dev libssl-dev make zlib1g-dev pandoc \
  libfreetype6-dev libjpeg-dev libpng-dev libtiff-dev libicu-dev libfontconfig1-dev \
  libfribidi-dev libharfbuzz-dev libxml2-dev

── Packages and their system dependencies ───────────────────────────────────────────────
curl        – libcurl4-openssl-dev, libssl-dev
fs          – make
haven       – make, zlib1g-dev
knitr       – pandoc
openssl     – libssl-dev
ragg        – libfreetype6-dev, libjpeg-dev, libpng-dev, libtiff-dev
reprex      – pandoc
rmarkdown   – pandoc
sass        – make
stringi     – libicu-dev
systemfonts – libfontconfig1-dev, libfreetype6-dev
textshaping – libfreetype6-dev, libfribidi-dev, libharfbuzz-dev
xml2        – libxml2-dev

As a result of manually executing the install scripts mentioned above, I was able to install tidyverse without any issues.

pak::pkg_install("tidyverse")

→ Willinstall 60 packages.
→ All 60 packages (46.78 MB) are cached.
+ askpass         1.2.0  [bld][cmp]
+ blob            1.2.4  [bld]
+ broom           1.0.6  [bld]
+ bslib           0.7.0  [bld]
+ cellranger      1.1.0  [bld]
+ conflicted      1.2.0  [bld]
+ dbplyr          2.5.0  [bld]
+ dplyr           1.1.4  [bld][cmp]
+ dtplyr          1.3.1  [bld]
+ forcats         1.0.0  [bld]
+ gargle          1.5.2  [bld]
+ ggplot2         3.5.1  [bld]
+ googledrive     2.1.1  [bld]
+ googlesheets4   1.1.1  [bld]
+ gtable          0.3.5  [bld]
+ haven           2.5.4  [bld][cmp] + ✔ make, ✔ zlib1g-dev
+ highr           0.11   [bld]
+ hms             1.1.3  [bld]
+ httr            1.4.7  [bld]
+ ids             1.0.1  [bld]
+ knitr           1.47   [bld] + ✔ pandoc
+ lubridate       1.9.3  [bld][cmp]
+ memoise         2.0.1  [bld]
+ modelr          0.1.11 [bld]
+ openssl         2.2.0  [bld][cmp] + ✔ libssl-dev
+ pillar          1.9.0  [bld]
+ progress        1.2.3  [bld]
+ purrr           1.0.2  [bld][cmp]
+ ragg            1.3.2  [bld][cmp] + ✔ libfreetype6-dev, ✔ libjpeg-dev, ✔ libpng-dev, ✔ libtiff-dev
+ readr           2.1.5  [bld][cmp]
+ readxl          1.4.3  [bld][cmp]
+ rematch2        2.1.2  [bld]
+ reprex          2.1.0  [bld] + ✔ pandoc
+ rmarkdown       2.27   [bld] + ✔ pandoc
+ rstudioapi      0.16.0 [bld]
+ rvest           1.0.4  [bld]
+ sass            0.4.9  [bld][cmp] + ✔ make
+ scales          1.3.0  [bld][cmp]
+ selectr         0.4-2  [bld]
+ stringi         1.8.4  [bld][cmp] + ✔ libicu-dev
+ stringr         1.5.1  [bld]
+ sys             3.4.2  [bld][cmp]
+ systemfonts     1.1.0  [bld][cmp] + ✔ libfontconfig1-dev, ✔ libfreetype6-dev
+ textshaping     0.4.0  [bld][cmp] + ✔ libfreetype6-dev, ✔ libfribidi-dev, ✔ libharfbuzz-dev
+ tibble          3.2.1  [bld][cmp]
+ tidyr           1.3.1  [bld][cmp]
+ tidyselect      1.2.1  [bld][cmp]
+ tidyverse       2.0.0  [bld]
+ timechange      0.3.0  [bld][cmp]
+ tinytex         0.51   [bld]
+ tzdb            0.4.0  [bld][cmp]
+ utf8            1.2.4  [bld][cmp]
+ uuid            1.2-0  [bld][cmp]
+ vctrs           0.6.5  [bld][cmp]
+ viridisLite     0.4.2  [bld]
+ vroom           1.6.5  [bld][cmp]
+ withr           3.0.0  [bld]
+ xfun            0.44   [bld][cmp]
+ xml2            1.3.6  [bld][cmp] + ✔ libxml2-dev
+ yaml            2.3.8  [bld][cmp]
✔ All system requirements are already installed.
mattfidler commented 3 weeks ago

I think it should also be faster since it often installs the Rstudio ubuntu binaries. I don't know if that was true for you.