ubuntu Rstudio-server安装devtools失败

在Ubuntu系统中使用RStudio Server时,遇到了安装devtools包失败的问题。详细记录了安装过程中遇到的错误及解决方法,帮助R语言开发者解决依赖问题。

R语言安装devtools失败

1.问题提示
------------------------- ANTICONF ERROR ---------------------------
Configuration failed because libxml-2.0 was not found. Try installing:
 * deb: libxml2-dev (Debian, Ubuntu, etc)
 * rpm: libxml2-devel (Fedora, CentOS, RHEL)
 * csw: libxml2_dev (Solaris)
If libxml-2.0 is already installed, check that 'pkg-config' is in your
PATH and PKG_CONFIG_PATH contains a libxml-2.0.pc file. If pkg-config
is unavailable you can set INCLUDE_DIR and LIB_DIR manually via:
R CMD INSTALL --configure-vars='INCLUDE_DIR=... LIB_DIR=...'
ERROR: dependencies ‘httr’, ‘curl’, ‘rversions’ are not available for package ‘devtools’
* removing ‘/usr/local/lib/R/site-library/devtools’
##解决
sudo apt-get install libcurl4-openssl-dev

2.问题提示
ERROR: dependency ‘xml2’ is not available for package ‘rversions’
ERROR: dependency ‘rversions’ is not available for package ‘devtools’
* removing ‘/usr/local/lib/R/site-library/devtools’
##解决
install.packages("xmls2")

3.错误提示
Configuration failed because libxml-2.0 was not found. Try installing:
 * deb: libxml2-dev (Debian, Ubuntu, etc)
 * rpm: libxml2-devel (Fedora, CentOS, RHEL)
 * csw: libxml2_dev (Solaris)
If libxml-2.0 is already installed, check that 'pkg-config' is in your
PATH and PKG_CONFIG_PATH contains a libxml-2.0.pc file. If pkg-config
is unavailable you can set INCLUDE_DIR and LIB_DIR manually via:
R CMD INSTALL --configure-vars='INCLUDE_DIR=... LIB_DIR=...'
##解决
sudo apt-get install libxml2-dev
install.packages("xmls2")
install.packages("rversions")
install.packages("devtools")
##成功
inelx@ubuntu:~/Desktop$ sudo apt update sudo apt upgrade -y Hit:1 http://security.ubuntu.com/ubuntu focal-security InRelease Hit:2 http://security.ubuntu.com/ubuntu jammy-security InRelease Hit:3 http://us.archive.ubuntu.com/ubuntu focal InRelease Hit:4 http://us.archive.ubuntu.com/ubuntu focal-updates InRelease Hit:5 https://cloud.r-project.org/bin/linux/ubuntu focal-cran40/ InRelease Hit:6 http://us.archive.ubuntu.com/ubuntu focal-backports InRelease Reading package lists... Done Building dependency tree Reading state information... Done 169 packages can be upgraded. Run 'apt list --upgradable' to see them. Reading package lists... Done Building dependency tree Reading state information... Done Calculating upgrade... Done The following packages were automatically installed and are no longer required: icu-devtools lib32gcc-s1 lib32stdc++6 libblas-dev libc-dev-bin libc6-i386 libclang-common-10-dev libclang1-10 libcrypt-dev libdeflate-dev libfakeroot libgc1c2 libgfortran-9-dev liblapack-dev libllvm10 liblzma-dev libobjc-9-dev libobjc4 libpcre16-3 libpcre2-16-0 libpcre2-posix2 libpcre32-3 libpcrecpp0v5 libpng-tools libtirpc-dev libzstd-dev linux-hwe-5.15-headers-5.15.0-139 linux-libc-dev Use 'sudo apt autoremove' to remove them. The following security updates require Ubuntu Pro with 'esm-infra' enabled: linux-headers-generic-hwe-20.04 xserver-xorg-core libpython3.8-minimal libsystemd0 libgs9 sudo libpython3.8 python3.8 libblockdev-crypto2 udev linux-image-generic-hwe-20.04 libudev1 systemd-timesyncd linux-generic-hwe-20.04 xserver-xephyr udisks2 python3.8-minimal systemd-sysv libpam-systemd xwayland ghostscript systemd libblockdev-utils2 ghostscript-x libnss-systemd libgs9-common libpython3.8-stdlib libxslt1.1 Learn more about Ubuntu Pro at https://ubuntu.com/pro The following packages have been kept back: bsdutils cups cups-bsd cups-client cups-core-drivers cups-daemon cups-ipp-utils dbus-user-session dbus-x11 distro-info distro-info-data ghostscript-x gir1.2-gdkpixbuf-2.0 gir1.2-gstreamer-1.0 gir1.2-gtk-3.0 gnome-control-center-data gnome-shell-common gnupg gnupg-l10n gstreamer1.0-alsa gstreamer1.0-plugins-base gstreamer1.0-plugins-base-apps gstreamer1.0-plugins-good gstreamer1.0-pulseaudio gstreamer1.0-x gtk-update-icon-cache gtk2-engines-pixbuf hplip-data libblockdev-utils2 libcups2 libcupsimage2 libcurl4 libdbus-1-3 libdpkg-perl libebackend-1.2-10 libebook-1.2-20 libecal-2.0-1 libedata-cal-2.0-1 libgail-common libgail18 libgdk-pixbuf2.0-0 libgdk-pixbuf2.0-bin libgdk-pixbuf2.0-common libglib2.0-bin libgstreamer-plugins-base1.0-0 libgstreamer-plugins-good1.0-0 libgstreamer1.0-0 libgtk2.0-0 libgtk2.0-bin libhpmud0 libldb2 libnautilus-extension1a libnetplan0 libnss-systemd libpam-systemd libperl5.30 libpoppler-glib8 libpoppler97 libpython3-stdlib librsvg2-common libsane-hpaio libudev1 libvte-2.91-common libyelp0 linux-firmware linux-generic-hwe-20.04 linux-headers-generic-hwe-20.04 linux-image-generic-hwe-20.04 nautilus-data netplan.io perl perl-base printer-driver-hpcups python3 python3-gdbm python3-ldb python3-minimal python3-pil python3-protobuf python3-renderpm python3-reportlab python3-reportlab-accel systemd-sysv systemd-timesyncd udisks2 vim-common 0 upgraded, 0 newly installed, 0 to remove and 86 not upgraded.
最新发布
07-13
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值