I tried to loading DESeq2 on R:
library(DESeq2)
The Error showed is:
Loading required package: GenomicRanges
Error: package or namespace load failed for ‘GenomicRanges’ in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]):
object 'vI' not found
Error: package ‘GenomicRanges’ could not be loaded
> sessionInfo()
R version 3.6.3 (2020-02-29)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Sierra 10.12.6
Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.6/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] parallel stats4 stats graphics grDevices utils datasets
[8] methods base
other attached packages:
[1] GenomeInfoDb_1.22.1 IRanges_2.21.8 S4Vectors_0.25.15
[4] BiocGenerics_0.32.0
loaded via a namespace (and not attached):
[1] rstudioapi_0.11 zlibbioc_1.32.0 R6_2.4.1
[4] fansi_0.4.1 tools_3.6.3 pkgbuild_1.0.6
[7] cli_2.0.2 withr_2.1.2 remotes_2.1.1
[10] assertthat_0.2.1 rprojroot_1.3-2 crayon_1.3.4
[13] processx_3.4.2 GenomeInfoDbData_1.2.2 BiocManager_1.30.10
[16] callr_3.4.3 bitops_1.0-6 ps_1.3.2
[19] RCurl_1.98-1.1 curl_4.3 glue_1.4.0
[22] compiler_3.6.3 backports_1.1.6 prettyunits_1.1.1
I blocked since 2 days. All the problem start for "S4Vectors" package. I solved it. I update the R. I donwloaded and manually put in the library r folder the "XVector" version ‘0.27.2’ as required from GenomicRanges.
I need to use DESeq2 to normalize my cont data. I open to use also something different from r
At the end, I fixed the problem uninstalled and re-installed all the R library from my PC keeping the same OS and R version. I continue to ignore the real identity of the problem.
I resolved this problem simply by removing the "GenomicRanges" and "IRange" packages and installing "GenomicRanges" again.
To remove these packages I used .libPaths() to find the library path and removed GenomicRanges" and "IRange" folders.
Related
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.
I've successfully installed Lime (and glmnet) in R but when I try loading it i receive an error:
> require(lime)
Loading required package: lime
Error: package or namespace load failed for ‘lime’:
object ‘coef.cv.glmnet’ is not exported by 'namespace:glmnet'
Searched online and can't seem to find a solution for this.
This is my sessioninfo()
> sessionInfo()
R version 3.6.1 (2019-07-05)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 17763)
Matrix products: default
locale:
[1] LC_COLLATE=English_Australia.1252 LC_CTYPE=English_Australia.1252 LC_MONETARY=English_Australia.1252 LC_NUMERIC=C
[5] LC_TIME=English_Australia.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] glmnet_3.0 Matrix_1.2-17
loaded via a namespace (and not attached):
[1] Rcpp_1.0.3 rstudioapi_0.10 magrittr_1.5 tidyselect_0.2.5 munsell_0.5.0 colorspace_1.4-1 lattice_0.20-38 R6_2.4.0 rlang_0.4.1
[10] foreach_1.4.7 dplyr_0.8.3 tools_3.6.1 grid_3.6.1 gtable_0.3.0 iterators_1.0.12 lazyeval_0.2.2 assertthat_0.2.1 tibble_2.1.3
[19] crayon_1.3.4 purrr_0.3.3 ggplot2_3.2.1 codetools_0.2-16 shape_1.4.4 glue_1.3.1 compiler_3.6.1 pillar_1.4.2 scales_1.0.0
[28] pkgconfig_2.0.3
I've updated all my packages.
glmnet loads successfully
> library(glmnet)
Loaded glmnet 3.0
The recent major update of glmnet (which now does not export coef.cv.glmnet anymore) appears to have broken lime. You can see errors with the same cause in the CRAN tests. You can expect a fix by the package maintainer soon (or the package will be archived by CRAN). See also this bug report and the answer by the maintainer:
This is due to a recent breaking change in glmnet—lime will be updated soon to fix this
I have been running a bash script (under Ubuntu) that calls and runs some R scripts to plot some maps with ggplot2. As it is a production system I don't update any new R or package releases. But recently I tried to install plotly with an error message output.
Now, when trying to run the script (calling a php webpage trhough a browser; that was running fine for a lot of time) an error with crayon package halts and exits the script without plotting the maps.
'/usr/lib/R/bin/R --slave --no-restore --no-save --no-restore --file=./RAMS-mapa-onades-zones-manual.R'
Loading required package: sp
Loading required package: methods
Checking rgeos availability: TRUE
Error : .onLoad failed in loadNamespace() for 'pillar', details:
call: loadNamespace(name)
error: there is no package called 'crayon'
Error: package or namespace load failed for 'ggplot2'
Execution halted
But if I run from a terminal or with RStudio server crayon package is loaded, ggplot2 is also properly loaded, and the maps are produced.
crayon package (located at /home/meteo/R/i686-pc-linux-gnu-library/3.1) called as
library("crayon", lib.loc= c("/home/meteo/R/i686-pc-linux-gnu-library/3.1", "/usr/local/lib/R/site-library", "/usr/lib/R/library"))
R session info on Rstudio Server:
> sessionInfo()
R version 3.2.2 (2015-08-14)
Platform: i686-pc-linux-gnu (32-bit)
Running under: Ubuntu precise (12.04.5 LTS)
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=C LC_COLLATE=C LC_MONETARY=C LC_MESSAGES=C
[7] LC_PAPER=C LC_NAME=C LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=C LC_IDENTIFICATION=C
attached base packages:
[1] grid stats graphics grDevices utils datasets methods base
other attached packages:
[1] crayon_1.3.4 rgdal_0.9-1 rgeos_0.3-8 raster_2.3-24 gpclib_1.5-5 mapproj_1.2-2 maps_2.3-9
[8] stringr_0.6.2 plyr_1.8.1 ggplot2_3.2.0 maptools_0.8-34 sp_1.2-3
loaded via a namespace (and not attached):
[1] Rcpp_1.0.1 magrittr_1.5 tidyselect_0.2.5 munsell_0.5.0 colorspace_1.2-4 lattice_0.20-33 R6_2.4.0
[8] rlang_0.3.4 dplyr_0.8.1 tools_3.2.2 gtable_0.1.2 withr_2.1.2 digest_0.6.8 lazyeval_0.2.2
[15] assertthat_0.2.1 tibble_2.1.3 purrr_0.3.2 glue_1.3.1 labeling_0.3 pillar_1.4.1 scales_1.0.0
[22] foreign_0.8-66 pkgconfig_2.0.2
Maybe there is a version conflict? How do I check?
what version of R is in /usr/lib/R/bin/R? Basically it appears you are in a slight "dependency hell" I would run /usr/lib/R/bin/R and check to see if crayon is installed there. #Alexis is correct though, it is not wise to mix versions like that. Let R handle library location unless you are trying to separate packages. Check the libraries for 3.2.2 and see if crayon is installed. you may have switched your R version since plotly depends on R >=3.2.0 https://cran.r-project.org/web/packages/plotly/
I think the easy fix would be to correct your .libpaths() i.e not call the 3.1 library and install the correct version of the packages you need.
OR
switch from R 3.2 back to R 3.1
I am using R studio on Mac OS and I want to use caret package for some data analysis. However, caret depends on rlang package and when I try to load caret package I get this error -
> library(caret)
Error: package or namespace load failed for ‘caret’ in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]):
namespace ‘rlang’ 0.2.2 is already loaded, but >= 0.3.0.1 is required
In addition: Warning message:
package ‘caret’ was built under R version 3.4.4
I removed the rlang package from the UI and tried installing it again but I am facing below issue -
> install.packages("rlang")
trying URL 'https://cran.rstudio.com/bin/macosx/el-capitan/contrib/3.4/rlang_0.3.0.1.tgz'
Content type 'application/x-gzip' length 1074663 bytes (1.0 MB)
==================================================
downloaded 1.0 MB
The downloaded binary packages are in
/var/folders/kh/9lkdq11x3sv56717v0700p_r_16f9p/T//RtmplrCvGX/downloaded_packages
> library(rlang)
Error in value[[3L]](cond) :
Package ‘rlang’ version 0.2.2 cannot be unloaded:
Error in unloadNamespace(package) : namespace ‘rlang’ is imported by ‘tidyr’, ‘purrr’, ‘ggplot2’, ‘plotly’, ‘dplyr’, ‘tibble’, ‘pillar’ so cannot be unloaded
In addition: Warning message:
package ‘rlang’ was built under R version 3.4.4
Here is my sessionInfo()
R version 3.4.3 (2017-11-30)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS 10.14
Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.4/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
other attached packages:
[1] dummies_1.5.6 ISLR_1.2 mltools_0.3.5 data.table_1.10.4-3 ggplot2_3.0.0.9000 lattice_0.20-35
loaded via a namespace (and not attached):
[1] reshape2_1.4.3 purrr_0.2.4 colorspace_1.3-2 htmltools_0.3.6 viridisLite_0.3.0 yaml_2.1.16 plotly_4.8.0
[8] rlang_0.3.0.1 ModelMetrics_1.2.2 pillar_1.1.0 glue_1.2.0 withr_2.1.2 bindrcpp_0.2 foreach_1.4.4
[15] bindr_0.1 plyr_1.8.4 stringr_1.2.0 munsell_0.5.0 gtable_0.2.0 htmlwidgets_1.2 devtools_1.13.4
[22] codetools_0.2-15 memoise_1.1.0 curl_3.1 Rcpp_0.12.18 scales_1.0.0 jsonlite_1.5 digest_0.6.16
[29] stringi_1.1.6 dplyr_0.7.4 grid_3.4.3 tools_3.4.3 magrittr_1.5 lazyeval_0.2.1 tibble_1.4.2
[36] tidyr_0.7.2 pkgconfig_2.0.1 Matrix_1.2-12 assertthat_0.2.0 httr_1.3.1 iterators_1.0.10 R6_2.2.2
[43] nlme_3.1-131 compiler_3.4.3 git2r_0.21.0
Maybe try this -- Remove rlang, shutdown and restart R, and then reinstall `rlang'.
If you still want to install a specific version of rlang,
1) Go to https://cran.r-project.org/src/contrib/Archive/rlang/
2) Get URL to the specific version you need. (On Chrome, Right click- Copy URL, etc)
3) Start R, install.packages("[URL]", repo=NULL, type="source")
e.g install.packages("https://cran.r-project.org/src/contrib/Archive/rlang/rlang_0.2.2.tar.gz", repo=NULL, type="source")
When opening RStudio I have a few packages that are loading. I have not set up my .rprofile to load packages on start up.
Here's the content of my current profile:
# startup options for R
# turn off scientific notation by default
# hard code the US repo for CRAN
.First <- function() {
options(scipen = 999)
}
local({
r = getOption("repos")
r["CRAN"] = "https://cran.rstudio.com/"
options(repos = r)
})
For regular start up and most projects, these packages are loading:
Loading required package: RMySQL
Loading required package: DBI
Although, for another project I see this:
Loading required package: RMySQL
Loading required package: DBI
Loading required package: clValid
Loading required package: cluster
At startup, here is what my session looks like:
R version 3.4.1 (2017-06-30)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS High Sierra 10.13.4
Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.4/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
other attached packages:
[1] RMySQL_0.10.13 DBI_0.7
loaded via a namespace (and not attached):
[1] Rcpp_0.12.16 magrittr_1.5 maps_3.2.0 munsell_0.4.3
[5] colorspace_1.3-2 geosphere_1.5-5 lattice_0.20-35 rjson_0.2.15
[9] jpeg_0.1-8 rlang_0.2.0 stringr_1.3.0 plyr_1.8.4
[13] tools_3.4.1 grid_3.4.1 gtable_0.2.0 png_0.1-7
[17] lazyeval_0.2.0 tibble_1.4.2 ggmap_2.6.1 mapproj_1.2-5
[21] reshape2_1.4.2 ggplot2_2.2.1 ggrepel_0.6.5 sp_1.2-5
[25] stringi_1.1.6 compiler_3.4.1 pillar_1.1.0.9000 RgoogleMaps_1.4.1
[29] scales_0.5.0 proto_1.0.0
Apparently I had prior established database connection objects that were saved in my .Rdata file and upon loading of a project these connections were requiring the packages to be loaded. After removing the connections the packages no longer load on start up.