RBioFormats library needs internet connection to load - r

I'm using RBioFormats for image processing purposes with R. I'm not able to load RBioFormats library when my computer has not internet connection.
R's console throught the error message:
Error: package or namespace load failed for 'RbioFormats':
.onLoad failed in loadNamespace() for 'RBioFormats', details:
call: NULL
error: failed to download Bio-Formats Java library
Check your internet connection
I'm using GNU/Linux OS. Firstly, I thought it was due to the version 11 of java environment installed. I've noticed the v11 is a develper version. After installing java environment v8, result in the same error output. The result is that I cannot use RBioFormats library when I have not internet connection.
> sessionInfo()
R version 3.6.0 (2019-04-26)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Anarchy Linux
Matrix products: default
BLAS: /usr/lib/libblas.so.3.8.0
LAPACK: /usr/lib/liblapack.so.3.8.0
locale:
[1] LC_CTYPE=es_ES.UTF-8 LC_NUMERIC=C LC_TIME=es_ES.UTF-8 LC_COLLATE=es_ES.UTF-8 LC_MONETARY=es_ES.UTF-8
[6] LC_MESSAGES=es_ES.UTF-8 LC_PAPER=es_ES.UTF-8 LC_NAME=es_ES.UTF-8 LC_ADDRESS=es_ES.UTF-8 LC_TELEPHONE=es_ES.UTF-8
[11] LC_MEASUREMENT=es_ES.UTF-8 LC_IDENTIFICATION=es_ES.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] RBioFormats_0.0.54 rJava_0.9-11
loaded via a namespace (and not attached):
[1] Rcpp_1.0.1 locfit_1.5-9.1 lattice_0.20-38 png_0.1-7 fftwtools_0.9-8 digest_0.6.19 bitops_1.0-6 tiff_0.1-5
[9] grid_3.6.0 EBImage_4.26.0 tools_3.6.0 htmlwidgets_1.3 RCurl_1.95-4.12 jpeg_0.1-8 abind_1.4-5 parallel_3.6.0
[17] compiler_3.6.0 BiocGenerics_0.30.0 htmltools_0.3.6

Since RBioFormats version 0.057, is not required Internet connection on startup anymore. Link to commit

Related

Use older version of ggplot in R script file

I have ggplot2 3.4.0 installed on Ubuntu 22.04, but for some reasons I would like to use older version ggplot2 3.3.6.
library(ggplot2, lib.loc="~/R/ggplot336/")
I worked fine when I started with a clean script file. However, when I use an existing script file like:
library(ggplot2, lib.loc="~/R/ggplot336/")
ggimage::geom_image()
I got the following error massage:
Error in value[3L] :
Package ‘ggplot2’ version 3.4.0 cannot be unloaded:
Error in unloadNamespace(package) : namespace ‘ggplot2’ is imported by ‘ggfun’, ‘ggplotify’, ‘ggimage’ so cannot be unloaded
Edit
Fresh start Rstudio
Open my R script file with following 3 lines:
sessionInfo()
library(ggplot2, lib.loc="~/R/ggplot336/")
ggimage::geom_image()
When I run the first line, sessionInfo() before doing anything else. We can see ggplot2_3.4.0 there. Could this be a Rstudio feature or an issue?
R version 4.2.2 Patched (2022-11-10 r83330)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 22.04.1 LTS
Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.10.0
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.10.0
locale:
[1] LC_CTYPE=en_AU.UTF-8 LC_NUMERIC=C LC_TIME=en_AU.UTF-8
[4] LC_COLLATE=en_AU.UTF-8 LC_MONETARY=en_AU.UTF-8 LC_MESSAGES=en_AU.UTF-8
[7] LC_PAPER=en_AU.UTF-8 LC_NAME=C LC_ADDRESS=C
[10] LC_TELEPHONE=C LC_MEASUREMENT=en_AU.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] Rcpp_1.0.9 highr_0.9 pillar_1.8.1 compiler_4.2.2
[5] R.utils_2.12.2 R.methodsS3_1.8.2 yulab.utils_0.0.5 tools_4.2.2
[9] digest_0.6.30 evaluate_0.18 jsonlite_1.8.3 lifecycle_1.0.3
[13] tibble_3.1.8 gtable_0.3.1 ggimage_0.3.1 R.cache_0.16.0
[17] pkgconfig_2.0.3 rlang_1.0.6 reprex_2.0.2 DBI_1.1.3
[21] cli_3.4.1 ggplotify_0.1.0 rstudioapi_0.14 magick_2.7.3
[25] yaml_2.3.6 xfun_0.35 fastmap_1.1.0 knitr_1.41
[29] withr_2.5.0 dplyr_1.0.10 styler_1.8.1 generics_0.1.3
[33] vctrs_0.5.1 fs_1.5.2 gridGraphics_0.5-1 grid_4.2.2
[37] tidyselect_1.2.0 glue_1.6.2 R6_2.5.1 processx_3.8.0
[41] fansi_1.0.3 rmarkdown_2.18 clipr_0.8.0 callr_3.7.3
[45] ggplot2_3.4.0 purrr_0.3.5 magrittr_2.0.3 ps_1.7.2
[49] htmltools_0.5.3 scales_1.2.1 assertthat_0.2.1 colorspace_2.0-3
[53] utf8_1.2.2 munsell_0.5.0 ggfun_0.0.9 R.oo_1.25.0
It looks like R studio is loading in all of the previous libraries from a previous session. Maybe something leftover in .RData or .Rhistory. A fresh start of R should have far few loaded libraries.
Here is my fresh start:
sessionInfo()
R version 4.2.2 (2022-10-31)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Monterey 12.6.1
Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.2/Resources/lib/libRlapack.dylib
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/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.2.2 tools_4.2.2
In Rstudio's preference you should see this screen:
I would try unchecking all of the boxes and then quit and restart Rstudio to see if that clears up the problem.
After some experiments, I kind of worked out the problem. Since this has consumed so much time of my time, I thought this could be helpful to others.
The problem is :: (double colon) with packages using ggplot2, such as ggimage in my example. It appears that RStudio automatically load some dependent packages when a script file is open. One way to fix this problem for my work now is to remove ::, but use library() then function (geom_image) instead.
This fixed my problem but I still don't understand why RStudio behaves this way.
If :: (double colon) is necessary, comment lines containing ::, then after loading older version of ggplot2, uncomment those lines. A little awkward, but it works for me.

Warning message after installing R

I have installed R many time in the last two decades. Today for the first time something went wrong.
After installing on a brand new laptop with windows 10 pro, I get this warning every time I open the program:
During startup - Warning message:
Setting LC_CTYPE= failed
I tried reading about this, but all I could find was MAC related, I have a lenovo thinkpad with windows 10.
Edit: Session Info
R version 3.5.1 (2018-07-02)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)
Matrix products: default
locale:
[1] C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] sessioninfo_1.1.1
loaded via a namespace (and not attached):
[1] compiler_3.5.1 assertthat_0.2.0 cli_1.0.1 tools_3.5.1 withr_2.1.2
[6] rstudioapi_0.8 yaml_2.2.0 crayon_1.3.4

Error while trying to use 'ez' library

I've error while trying to call ez library for rAnova, the issue that I cannot found pbkrtest package while I executed with success install.packages("ez"). library(ez) return to me the following error :
Error in loadNamespace (j <- i [[1L]], c (lib.loc, .libPaths ()) = vI VERSIONCHECK [[j]]): no package named 'pbkrtest' is found
In addition: Warning message: package 'ez' was compiled with version 3.2.5 R Error: loading the package or namespace failed for 'ez'
How can I properly use this library ? Thanks
EDIT : Sessioninfo()
R version 3.2.2 (2015-08-14)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 8 x64 (build 9200)
locale:
[1] LC_COLLATE=French_France.1252 LC_CTYPE=French_France.1252
[3] LC_MONETARY=French_France.1252 LC_NUMERIC=C
[5] LC_TIME=French_France.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] devtools_1.12.0
loaded via a namespace (and not attached):
Error in x[["Version"]] : index out of limits
De plus : Warning messages:
1: In FUN(X[[i]], ...) :
The file DESCRIPTION of the package 'digest' is missing or incorrect
2: In FUN(X[[i]], ...) :
The file DESCRIPTION of the package 'nlme' is missing or incorrect
EDIT 2: Sessioninfo() after restarting machine and R
R version 3.2.2 (2015-08-14)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 8 x64 (build 9200)
locale:
[1] LC_COLLATE=French_France.1252 LC_CTYPE=French_France.1252
[3] LC_MONETARY=French_France.1252 LC_NUMERIC=C
[5] LC_TIME=French_France.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] MASS_7.3-45 Matrix_1.2-7.1 tools_3.2.2 mgcv_1.8-15
[5] nnet_7.3-12 nlme_3.1-121 grid_3.2.2 lattice_0.20-34
but still the same error (above) when tape library(ez).
So it seems that was a question of R version. As noticed in the error and as I understood 'ez' was compiled with version 3.2.5 R. So now i'm under 3.3.1 and I intalled EZ with success and can load the library and use the function. The more complicated is to reinstall R and all packages that seems painful, but thanks to this great post that allow me to store all my packages in a temp folder and to reinstall them in the newest version
For information if it could help someone else, my Sessioninfo() returns :
R version 3.3.1 (2016-06-21)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 8.1 x64 (build 9600)
locale:
[1] LC_COLLATE=French_France.1252 LC_CTYPE=French_France.1252 LC_MONETARY=French_France.1252
[4] LC_NUMERIC=C LC_TIME=French_France.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] ez_4.3
loaded via a namespace (and not attached):
[1] Rcpp_0.12.7 magrittr_1.5 splines_3.3.1 MASS_7.3-45 munsell_0.4.3
[6] colorspace_1.2-6 lattice_0.20-33 minqa_1.2.4 stringr_1.1.0 car_2.1-3
[11] plyr_1.8.4 tools_3.3.1 nnet_7.3-12 parallel_3.3.1 pbkrtest_0.4-6
[16] grid_3.3.1 nlme_3.1-128 gtable_0.2.0 mgcv_1.8-12 quantreg_5.29
[21] MatrixModels_0.4-1 lme4_1.1-12 Matrix_1.2-6 nloptr_1.0.4 reshape2_1.4.1
[26] ggplot2_2.1.0 stringi_1.1.2 scales_0.4.0 SparseM_1.72
>

rJava gives a NullPointerException in .jcall

I am trying to run a standard corpus loading method in the mallet R package and more specifically
instance <- mallet.import(names(txt$CELEX), txt$TEXT, stoplist.file = "stopwords.en.txt", token.regexp = "\\p{L}[\\p{L}\\p{P}]+\\p{L}")
Then I get the following error
Error in .jcall("RJavaTools", "Ljava/lang/Object;", "invokeMethod", cl, :
java.lang.NullPointerException
which seems to me more like an rJava error more than anything else. My sysinfo follows:
R version 3.3.0 (2016-05-03)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1
locale:
[1] LC_COLLATE=Danish_Denmark.1252 LC_CTYPE=Danish_Denmark.1252 LC_MONETARY=Danish_Denmark.1252
[4] LC_NUMERIC=C LC_TIME=Danish_Denmark.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] mallet_1.0 XLConnect_0.2-12 XLConnectJars_0.2-12 quanteda_0.9.6-9 rJava_0.9-8
[6] topicmodels_0.2-4
loaded via a namespace (and not attached):
[1] Rcpp_0.12.5 lattice_0.20-33 slam_0.1-35 chron_2.3-47 grid_3.3.0 stats4_3.3.0
[7] stringi_1.1.1 data.table_1.9.6 NLP_0.1-9 ca_0.64 Matrix_1.2-6 tools_3.3.0
[13] parallel_3.3.0 tm_0.6-2 modeltools_0.2-21
I use Java 8 in case it matters. I read somewhere that rJava is not playing well with Java 8
That's not the usual error from rJava problems, which seem to have settled down.
One possible problem could be that the stoplist file does not exist or is not in the right place.

How can I start Rselenium in Mac?

I am trying to run this simple code.
library("RSelenium")
checkForServer()
startServer() #Default server
remDr <- remoteDriver$new()
remDr$open(silent = TRUE) #Opens a browser
But I am getting this error:
Error: Summary: UnknownError
Detail: An unknown server-side error occurred while processing the command.
class: org.openqa.selenium.WebDriverException
How can I fix this?
Diagnosis
sessionInfo()
R version 3.2.3 (2015-12-10)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X 10.11.3 (El Capitan)
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] RSelenium_1.3.5 XML_3.98-1.3 RJSONIO_1.3-0 RCurl_1.95-4.7 bitops_1.0-6 dplyr_0.4.3
[7] rvest_0.3.1 xml2_0.1.2
loaded via a namespace (and not attached):
[1] Rcpp_0.12.3 assertthat_0.1 R6_2.1.2 DBI_0.3.1 magrittr_1.5
[6] httr_1.1.0 curl_0.9.6 tools_3.2.3 parallel_3.2.3 rsconnect_0.4.1.11
[11] caTools_1.17.1
system("java -version")
java version "1.7.0_79"
Java(TM) SE Runtime Environment (build 1.7.0_79-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.79-b02, mixed mode)

Resources