mponce0 / covid19.analytics

R package to obtain and analyze live data from the nCOVID19 coronavirus
https://mponce0.github.io/covid19.analytics/
GNU General Public License v2.0
34 stars 11 forks source link

install error on oracle rstudio server xml load #12

Open genghiskhanofnz opened 1 year ago

genghiskhanofnz commented 1 year ago

Hi, I have setup an Oracle RStudio Server yesterday to have this covid19.analytics package accessible anywhere anytime on web. Sadly, other such as EpiEstim and other packages installed smoothly but failed multiple times in your package with the following error.

Please advise how to solve. Thank you very much.

mponce0 commented 1 year ago

Thanks for reporting this. From the error message it appears to be an issue wth one of covid19.analytics dependencies: the XML package. In particular not being able to find the libmxl2.so.2 library.

My first suggestion would be to try to install the XML package but I imagine you would find a similar problem there.

So it may be a dependency related to your particular configuration, see for instance,

https://community.rstudio.com/t/can-not-install-xml-package/48854

genghiskhanofnz commented 1 year ago

I was blown away by your very quick response. I did install XML 3.99 and xml2 1.3.2 = today both installed twice Then I tried devtools version as follows: = but still the same My issue = I report covid data update to the Grand Round on every Wednesday and need to access your package since I am travelling many places and not at work. Any follow-up advice will be really appreciated.

devtools::install_github("mponce0/covid19.analytics") Downloading GitHub repo mponce0/covid19.analytics@HEAD ✓ checking for file ‘/tmp/Rtmp1ZsEQI/remotes95375035ae4/mponce0-covid19.analytics-ef3236c/DESCRIPTION’ ... ─ preparing ‘covid19.analytics’: ✓ checking DESCRIPTION meta-information ... ─ checking for LF line-endings in source and make files and shell scripts ─ checking for empty or unneeded directories ─ building ‘covid19.analytics_2.1.3.tar.gz’

Installing package into ‘/usr/local/lib/R/site-library’ (as ‘lib’ is unspecified)

genghiskhanofnz commented 1 year ago

Can I have a patch to make it work? Thanks.

mponce0 commented 1 year ago

OK, I see. I'm still unsure whether this is an issue with covid19.analytics or xml. One more thing that I may ask you to try, could you try loading the XML package from one interactive R session and run one of their demos. I tell you why: the XML package would install assuming or looking for system related libraries, such as, libxml2. And sometimes depending on the actual system this can fail. Hence why trying to load the package would be the way to test this. So you need to install the libxml2 library at system level and then the XML package in R.

Other than that, at the moment I can't really think of anything else as I haven't seen this error myself even when working in different systems.

Actually, now I'm a little bit puzzle... as far as I can recall covid19.analytics does not require XML.

Would you mind telling me which OS and R version are you using?

genghiskhanofnz commented 1 year ago

sessionInfo() R version 4.1.1 (2021-08-10) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Ubuntu 20.04.5 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/liblapack.so.3

locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C 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 LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

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

other attached packages: [1] EpiEstim_2.2-4 ggpubr_0.4.0 ggplot2_3.3.5 dplyr_1.0.7 ggsci_2.9 scales_1.1.1

loaded via a namespace (and not attached): [1] pkgload_1.2.3 tidyr_1.1.4 splines_4.1.1 carData_3.0-4 cellranger_1.1.0
[6] remotes_2.4.1 sessioninfo_1.1.1 pillar_1.6.4 backports_1.3.0 lattice_0.20-44
[11] quantreg_5.86 glue_1.4.2 ggsignif_0.6.3 colorspace_2.0-2 Matrix_1.3-4
[16] plyr_1.8.6 conquer_1.0.2 pkgconfig_2.0.3 devtools_2.4.2 broom_0.7.9
[21] SparseM_1.81 haven_2.4.3 purrr_0.3.4 coarseDataTools_0.6-5 processx_3.5.2
[26] incidence_1.7.3 openxlsx_4.2.4 rio_0.5.27 MatrixModels_0.5-0 tibble_3.1.5
[31] generics_0.1.1 car_3.0-11 usethis_2.1.3 ellipsis_0.3.2 cachem_1.0.6
[36] withr_2.4.2 cli_3.1.0 survival_3.2-11 magrittr_2.0.1 crayon_1.4.1
[41] readxl_1.3.1 memoise_2.0.0 mcmc_0.9-7 ps_1.6.0 fs_1.5.0
[46] fansi_0.5.0 MASS_7.3-54 rstatix_0.7.0 forcats_0.5.1 foreign_0.8-81
[51] pkgbuild_1.2.0 tools_4.1.1 fitdistrplus_1.1-6 data.table_1.14.2 prettyunits_1.1.1
[56] hms_1.1.1 lifecycle_1.0.1 matrixStats_0.61.0 stringr_1.4.0 MCMCpack_1.6-0
[61] munsell_0.5.0 zip_2.2.0 callr_3.7.0 compiler_4.1.1 rlang_0.4.12
[66] grid_4.1.1 rstudioapi_0.13 testthat_3.1.0 gtable_0.3.0 abind_1.4-5
[71] curl_4.3.2 reshape2_1.4.4 R6_2.5.1 gridExtra_2.3 fastmap_1.1.0
[76] utf8_1.2.2 rprojroot_2.0.2 desc_1.4.0 stringi_1.7.5 Rcpp_1.0.7
[81] vctrs_0.3.8 tidyselect_1.1.1 coda_0.19-4

genghiskhanofnz commented 1 year ago

Hi, you are very intelligent. As you advise, I load XML = failed = see here

library(XML) Error: package or namespace load failed for ‘XML’: .onLoad failed in loadNamespace() for 'XML', details: call: dyn.load(file, DLLpath = DLLpath, ...) error: unable to load shared object '/usr/local/lib/R/site-library/XML/libs/XML.so': libxml2.so.2: cannot open shared object file: No such file or directory

genghiskhanofnz commented 1 year ago

Hi = the same to xml2 = failed

library(xml2) Error: package or namespace load failed for ‘xml2’ in dyn.load(file, DLLpath = DLLpath, ...): unable to load shared object '/usr/local/lib/R/site-library/xml2/libs/xml2.so': libxml2.so.2: cannot open shared object file: No such file or directory

mponce0 commented 1 year ago

OK, so I think the issue is the xml system libraries Can you try the following? sudo apt install libxml2-dev (this will install the development version which brings along headers, etc.) Then you will need to reinstall XML from within R.

XML packages and sometime the system libraries have some reputation of being "tricky", see https://stackoverflow.com/questions/63084235/xml-installation-seems-to-be-failing-and-not-load-on-r https://support.bioconductor.org/p/131866/ https://community.rstudio.com/t/xml-install-complete-novice/74728/5 https://github.com/r-lib/actions/issues/559

Alternatively you could try to install covid19.analytics from source, e.g. install.packages("covid19.analytics", type="source")

genghiskhanofnz commented 1 year ago

@mponce0 = tried source = failed

see here.

install.packages("covid19.analytics", type="source") Installing package into ‘/usr/local/lib/R/site-library’ (as ‘lib’ is unspecified) trying URL 'https://packagemanager.rstudio.com/cran/__linux__/focal/2021-10-29/src/contrib/covid19.analytics_2.1.1.tar.gz' Content type 'binary/octet-stream' length 3766534 bytes (3.6 MB)

downloaded 3.6 MB

The downloaded source packages are in ‘/tmp/Rtmp1ZsEQI/downloaded_packages’

genghiskhanofnz commented 1 year ago

@mponce0 = your package is my lifeline to report to the Grand Round I have been using your package for covid reporting for the last 3 years = acknowledged your package in every presentation and thank you very much for developing such a brilliant one. Another one = EpiEstim to calculate Re = I have regular email contacts with its developers Thanks to both packages.

mponce0 commented 1 year ago

Nop, it is not doing the compilation... you can see that when it states

** byte-compile and prepare package for lazy loading

BTW which repo are you using? Can you try "0-Cloud [https]"

Alternatively, you can do the following: install.packages("https://cran.r-project.org/src/contrib/covid19.analytics_2.1.3.tar.gz", repo=NULL, type="source")

genghiskhanofnz commented 1 year ago

Tried from your advice via http.

install.packages("https://cran.r-project.org/src/contrib/covid19.analytics_2.1.3.tar.gz", repo=NULL, type="source") Installing package into ‘/usr/local/lib/R/site-library’ (as ‘lib’ is unspecified) trying URL 'https://cran.r-project.org/src/contrib/covid19.analytics_2.1.3.tar.gz' Content type 'application/x-gzip' length 3758229 bytes (3.6 MB)

downloaded 3.6 MB

It failed.

It also said = illegal URL 0-Cloud [https] = why?

Thanks.

genghiskhanofnz commented 1 year ago

@mponce0 = my home pc windows system rtools42 has libxml2 Wondering what your thoughts on whether linux system needs rtools or not. Thanks.

mponce0 commented 1 year ago

rtools is needed on Windows systems as they usually don't bring along compilers but I don't think they will help much in your case. Although you may want to try...

Focusing on the ubuntu system, did you install libxml2-dev using

sudo apt install libxml2-dev

After this you want to launch R, and do the following:

# remove XML
remove.packages("XML")
# reinstall XML
remove.packages("XML")

try to load XML and see what the error says.

The "0-Cloud" repository is one of the options, the first one, offered when you interactively run "install.packages(...)"

BTW I just noticed that the installation is referring to the "/usr/local/lib/R/site-library/..." this is usually a system path, ie. unless you are dong the installation as root it may not have permissions to write to it. I'd instead recommend doing it a your own user in a "personal" library.

genghiskhanofnz commented 1 year ago

Yes, I will try all you advise above. Need to create a personal library first. Then all will follow. Thanks. Have a nice evening.

genghiskhanofnz commented 1 year ago

Hi Sir, I still can't solve this package install. I pasted the RStudio console output and errors = finding XML.SO I had no problems of installing your package on Windows machine at work and home. Please confirm that your package uised XML resources from the operating system. Thanks. Merry Christmas.

one thing = our state has around 30K new cases and 100 deaths every week. your package is critical for analysing this.

install.packages('XML') Installing package into ‘/usr/local/lib/R/site-library’ (as ‘lib’ is unspecified) trying URL 'https://packagemanager.rstudio.com/cran/__linux__/focal/2021-10-29/src/contrib/XML_3.99-0.8.tar.gz' Content type 'binary/octet-stream' length 1928791 bytes (1.8 MB)

downloaded 1.8 MB

The downloaded source packages are in ‘/tmp/RtmpphvzUx/downloaded_packages’ Warning message: In grSoftVersion() : unable to load shared object '/usr/local/lib/R/modules//R_X11.so': libXt.so.6: cannot open shared object file: No such file or directory

install.packages("xml2") Installing package into ‘/usr/local/lib/R/site-library’ (as ‘lib’ is unspecified) trying URL 'https://packagemanager.rstudio.com/cran/__linux__/focal/2021-10-29/src/contrib/xml2_1.3.2.tar.gz' Content type 'binary/octet-stream' length 617914 bytes (603 KB)

downloaded 603 KB

The downloaded source packages are in ‘/tmp/RtmpphvzUx/downloaded_packages’

install.packages("covid19.analytics", type="source") Installing package into ‘/usr/local/lib/R/site-library’ (as ‘lib’ is unspecified) trying URL 'https://packagemanager.rstudio.com/cran/__linux__/focal/2021-10-29/src/contrib/covid19.analytics_2.1.1.tar.gz' Content type 'binary/octet-stream' length 3766534 bytes (3.6 MB)

downloaded 3.6 MB

The downloaded source packages are in ‘/tmp/RtmpphvzUx/downloaded_packages’

library(EpiEstim) library(covid19.analytics) Error in library(covid19.analytics) : there is no package called ‘covid19.analytics’ In addition: Warning message: In grSoftVersion() : unable to load shared object '/usr/local/lib/R/modules//R_X11.so': libXt.so.6: cannot open shared object file: No such file or directory library(XML) Error: package or namespace load failed for ‘XML’: .onLoad failed in loadNamespace() for 'XML', details: call: dyn.load(file, DLLpath = DLLpath, ...) error: unable to load shared object '/usr/local/lib/R/site-library/XML/libs/XML.so': libxml2.so.2: cannot open shared object file: No such file or directory install.packages('XML') Installing package into ‘/usr/local/lib/R/site-library’ (as ‘lib’ is unspecified) trying URL 'https://packagemanager.rstudio.com/cran/__linux__/focal/2021-10-29/src/contrib/XML_3.99-0.8.tar.gz' Content type 'binary/octet-stream' length 1928791 bytes (1.8 MB)

downloaded 1.8 MB

The downloaded source packages are in ‘/tmp/Rtmpxib1yP/downloaded_packages’

library(XML) Error: package or namespace load failed for ‘XML’: .onLoad failed in loadNamespace() for 'XML', details: call: dyn.load(file, DLLpath = DLLpath, ...) error: unable to load shared object '/usr/local/lib/R/site-library/XML/libs/XML.so': libxml2.so.2: cannot open shared object file: No such file or directory

mponce0 commented 1 year ago

OK, I'm seeing a new type of problem here pointing to the lack of X11. I imagine you are using MacOS in this case, correct?

Then you also need to install XQuartz -- https://www.xquartz.org -- this is a program that provides support for graphics in linux-type of OSes.

Please install XQuartz, you may need to reboot your system, then reinstall both the XML and covid19.analytics packages.

genghiskhanofnz commented 1 year ago

Thanks for your kind advice. I am not using MacOS though. I will try. Merry Christmas.