软件包安装路径不可写

问题描述 投票:0回答:1

我在 Ubuntu v22.04 上新安装了 R 和 Rstudio(最新版本)。我使用以下命令安装了最新版本的 BiocManager:

if (!require("BiocManager", quietly = TRUE))
install.packages("BiocManager")
BiocManager::install(version = "3.17")

但是,当我尝试使用

安装 DESeq2(或其他软件包,如 AnnotationDbi)时
BiocManager::install("DESeq2")

我一直有同样的错误:

The downloaded source packages are in
‘/tmp/Rtmp6OyxTE/downloaded_packages’
Installation paths not writeable, unable to update packages
  path: /usr/lib/R/library
  packages:
boot, foreign
  path: /usr/lib/R/site-library
  packages:
bit, broom, bslib, curl, digest, gargle, googledrive, googlesheets4, highr, isoband, jsonlite, ragg

我查了一下,这两条路径都属于根目录。不过我也在网上查了一下,完全正常,因为这两个库是和R一起安装的。

我用命令检查了

.libPaths() [1]“/home/my_name/R/my_computer_name/4.3”“/usr/local/lib/R/site-library”
[3]“/usr/lib/R/site-library”“/usr/lib/R/library”

因此,我有一个单独的库(其中安装了 BiocManager)并且可以在其中安装其他软件包。

如何解决这个问题?我无法以这种方式安装任何软件包...

r permissions bioconductor
1个回答
0
投票

我同意@Deb 的观点。这很烦人。还有回应。即使在非共享系统(私人计算机)中,以标准非特权用户身份运行所有命令并使用 sudo 安装软件包也是常见做法。

在新系统(Ubuntu)中,要安装基本 R,您必须使用 sudo。就我而言,对于我需要的特定 R 包,我还必须安装一些开发包,如下所示:

sudo apt install r-base
sudo apt install build-essential libcurl4-gnutls-dev libxml2-dev libssl-dev
sudo apt install libfontconfig1-dev libharfbuzz-dev libfribidi-dev
sudo apt install libfreetype6-dev libpng-dev libtiff5-dev libjpeg-dev

然后,即使遵循有关使用私有 R 库的所有教程,例如就我而言:

export R_LIBS_USER="/home/fernan/R/x86_64-pc-linux-gnu-library/4.4"

在没有 sudo 的情况下以我自己的方式运行 R,并尝试安装软件包在大多数情况下都可以工作(例如

install.packages("devtools")
install.packages("BiocManager")
),但令人沮丧的是,在同一个 R 会话中会发生类似的事情:

> BiocManager::install(c("Biostrings", "rtracklayer"))
'getOption("repos")' replaces Bioconductor standard repositories, see
'help("repositories", package = "BiocManager")' for details.
Replacement repositories:
    CRAN: https://cloud.r-project.org
Bioconductor version 3.20 (BiocManager 1.30.25), R 4.4.2 (2024-10-31)
Installing package(s) 'Biostrings', 'rtracklayer'
trying URL 'https://bioconductor.org/packages/3.20/bioc/src/contrib/Biostrings_2.74.1.tar.gz'
Content type 'application/x-gzip' length 12823307 bytes (12.2 MB)
==================================================
downloaded 12.2 MB

trying URL 'https://bioconductor.org/packages/3.20/bioc/src/contrib/rtracklayer_1.66.0.tar.gz'
Content type 'application/x-gzip' length 4112666 bytes (3.9 MB)
==================================================
downloaded 3.9 MB

* installing *source* package ‘Biostrings’ ...
** package ‘Biostrings’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
using C compiler: ‘gcc (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0’
gcc -I"/usr/share/R/include" -DNDEBUG  -I'/home/fernan/R/x86_64-pc-linux-gnu-library/4.4/S4Vectors/include' -I'/home/fernan/R/x86_64-pc-linux-gnu-library/4.4/IRanges/include' -I'/home/fernan/R/x86_64-pc-linux-gnu-library/4.4/XVector/include'     -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-LHi8Yy/r-base-4.4.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2  -c BAB_class.c -o BAB_class.o
[...]
[... chunks ommitted for clarity ...]
[...]
installing to /home/fernan/R/x86_64-pc-linux-gnu-library/4.4/00LOCK-Biostrings/00new/Biostrings/libs
** R
** data
** inst
** byte-compile and prepare package for lazy loading
in method for ‘twoWayAlphabetFrequencyByQuality’ with signature ‘"QualityScaledXStringSet"’: no definition for class “QualityScaledXStringSet”
Creating a new generic function for ‘strsplit’ in package ‘Biostrings’
Creating a generic function for ‘ls’ from package ‘base’ in package ‘Biostrings’
Creating a new generic function forpatternin package ‘Biostrings’
Creating a new generic function foroffsetin package ‘Biostrings’
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
** checking absolute paths in shared objects and dynamic libraries
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (Biostrings)
* installing *source* package ‘rtracklayer’ ...
** package ‘rtracklayer’ successfully unpacked and MD5 sums checked
** using staged installation
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for OPENSSL... yes
configure: creating ./config.status
config.status: creating src/Makevars
** libs
using C compiler: ‘gcc (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0’
gcc -I"/usr/share/R/include" -DNDEBUG -DUSE_SSL -D_FILE_OFFSET_BITS=64 -I'/home/fernan/R/x86_64-pc-linux-gnu-library/4.4/S4Vectors/include' -I'/home/fernan/R/x86_64-pc-linux-gnu-library/4.4/IRanges/include' -I'/home/fernan/R/x86_64-pc-linux-gnu-library/4.4/XVector/include'     -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-LHi8Yy/r-base-4.4.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2  -c S4Vectors_stubs.c -o S4Vectors_stubs.o
gcc -I"/usr/share/R/include" -DNDEBUG -DUSE_SSL -D_FILE_OFFSET_BITS=64 -I'/home/fernan/R/x86_64-pc-linux-gnu-library/4.4/S4Vectors/include' -I'/home/fernan/R/x86_64-pc-linux-gnu-library/4.4/IRanges/include' -I'/home/fernan/R/x86_64-pc-linux-gnu-library/4.4/XVector/include'     -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-LHi8Yy/r-base-4.4.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2  -c IRanges_stubs.c -o IRanges_stubs.o
[...]
[... chunks ommitted for clarity ...]
[...]
** R
** data
** demo
** inst
** byte-compile and prepare package for lazy loading
Creating a generic function foroffsetfrom package ‘stats’ in package ‘rtracklayer’
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
** checking absolute paths in shared objects and dynamic libraries
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (rtracklayer)

The downloaded source packages are in/tmp/RtmpXhTi2g/downloaded_packages’
Installation paths not writeable, unable to update packages
  path: /usr/lib/R/library
  packages:
    codetools, lattice, spatial

为什么 R 不使用 R_LIBS_USER???

有人可以帮忙吗?非常感谢。

最新问题
© www.soinside.com 2019 - 2025. All rights reserved.