我最近在整理Bioconductor一系列包,但是每次都会遇到一些bug,这次是在安装R包时遇到问题,卡了5天,一直以为是自己设置的问题,今天终于解决了。
Bioconductor安装的麻烦就在于,每个包依赖的包太多了,而且这次主要是很多包都依赖IRanges,这是基础,不安装很多包都用不了。 这个系列如果不设置镜像(下载慢),不经常更新(每次都提醒你更新),不尝试多方检索解决问题(有前人的经验),可能要郁闷死了。
报错的几个包
TCGAbiolinks包
Iranges包
Biostrings包
这个报错检索了很久,各种尝试设置也不行,我又要崩溃了。
不知是不是巧合,也是我自己能get到,每次我从检索生信技能树的教程得到启发,崩溃几天,然后解决,这次是这两个推送:
【紧急通知】下载R包却联网失败?初学者的痛
BiocManager无法安装R包
解决办法
我采取的办法就是卸载重装,先在Rstudio中右下角工作环境中package处移除这个包,然后关闭Rstudio,再把下载目录(就是你的包下载后存放的地方)下有关包的文件全部删掉。
然后重启Rstudio,输入安装代码。如下:
options()$repos
options()$BioC_mirror
options(BioC_mirror="https://mirrors.ustc.edu.cn/bioc/")
options("repos" = c(CRAN="https://mirrors.tuna.tsinghua.edu.cn/CRAN/"))
options()$repos
options()$BioC_mirror
if (!requireNamespace("BiocManager", quietly = TRUE))
install.packages("BiocManager")
BiocManager::install("IRanges")
library(IRanges)
BiocManager::install("Biostrings")
library(Biostrings)
然后包就下载成功,再次加载就没有问题了。
附:报错的一长串,一开始看到真的还挺慌的…………
反思:不知道是哪儿设置出了问题,或者就是下载目录被动过。总之,R真的是应了那句,遇事不决,重启解决。
鸡汤一句: 遇到问题不要沮丧,万物皆有裂痕,那是光照进来的地方。
Error: package or namespace load failed for ‘IRanges’ in namespaceExport(ns, exports):
出口不存在:diff.AtomicList, window<-.Vector, window<-.vector, window<-.factor, splitAsList, multisplit, solveUserSEW0, IRanges, solveUserSEW, successiveIRanges, slidingIRanges, breakInChunks, whichAsIRanges, asNormalIRanges, rangeComparisonCodeToLetter, IPos, NCList, NCLists, H2LGrouping, Dups, PartitioningByEnd, PartitioningByWidth, PartitioningMap, RangedData, RangedSelection, RangesList, IRangesList, RleViewsList, %over%, %within%, %outside%, %pover%, %pwithin%, %poutside%, mergeByOverlaps, findOverlapPairs, MaskCollection.show_frame, Mask, read.gapMask, read.agpMask, read.liftMask, read.rmMask, read.trfMask, successiveViews, slidingViews, LogicalList, IntegerList, NumericList, ComplexList, CharacterList, RawList, RleList, FactorList, DataFrameList, SplitDataFrameList, ManyToOneGrouping, ManyToManyGrouping, regroup, heads, tails, selectNearest, INCOMPATIBLE_ARANGES_MSG, extractListFragments, equisplit, ranges, rglist, mstack, mid, isNormal, whichFirstNotNormal, subject, ranges<-, Views, trim, subviews, viewApply, viewMins, viewMaxs, viewSums, viewMeans, viewWhichMins, viewWhichMaxs, viewRangeMins, viewRangeMaxs, nobj, grouplengths, members, vmembers, togroup, togrouplength, high2low, low2high, grouprank, togrouprank, mapOrder, findRange, splitRanges, extractList, columnMetadata, columnMetadata<-, universe, universe<-, nir_list, desc, desc<-, maskedwidth, maskedratio, findOverlaps, countOverlaps, overlapsAny, subsetByOverlaps, overlapsRanges, poverlaps, narrow, update_ranges, shift, resize, flank, reflect, promoters, restrict, threebands, reduce, gaps, disjoin, isDisjoint, disjointBins, reverse, coverage, cvg, slice, punion, pintersect, psetdiff, pgap, precede, follow, nearest, distance, distanceToNearest, tile, slidingWindows, ifelse2
Failed with error: ‘无法载入程辑包‘IRanges’’