在Ubuntu系统上的R中安装Sodium软件包时出现问题

时间:2020-04-27 08:18:09

标签: r ubuntu ubuntu-18.04 libsodium sodium

我正在尝试在Ubuntu系统上的R中安装名为sodium的软件包,但收到如下错误消息:

install.packages("sodium", dependencies = T)

...

* installing *source* package ‘sodium’ ...
** package ‘sodium’ successfully unpacked and MD5 sums checked
Package libsodium was not found in the pkg-config search path.
Perhaps you should add the directory containing `libsodium.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libsodium' found
Using PKG_CFLAGS=
Using PKG_LIBS=-lsodium
------------------------- ANTICONF ERROR ---------------------------
Configuration failed because libsodium was not found. Try installing:
 * deb: libsodium-dev (Debian, Ubuntu, etc)
 * rpm: libsodium-devel (Fedora, EPEL)
 * csw: libsodium_dev (Solaris)
 * brew: libsodium (OSX)
If libsodium is already installed, check that 'pkg-config' is in your
PATH and PKG_CONFIG_PATH contains a libsodium.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: configuration failed for package ‘sodium’
* removing ‘/R/x86_64-pc-linux-gnu-library/3.4/sodium’
Warning in install.packages :
  installation of package ‘sodium’ had non-zero exit status

The downloaded source packages are in
    ‘/tmp/Rtmph70q7Q/downloaded_packages’

以下代码也未安装。

install.packages("libsodium-dev", dependencies = T)

Warning in install.packages :
  package ‘libsodium-dev’ is not available (for R version 3.4.4)

我也尝试过install_github,但仍然收到错误消息:

devtools::install_github("jedisct1/libsodium")

Error: Failed to install 'unknown package' from GitHub:
  Timeout was reached: [api.github.com] Resolving timed out after 10000 milliseconds

关于如何安装此软件包的任何想法?

我希望在Ubuntu R上安装软件包与在Windows R上一样无错误。 如果有人可以教我如何避免Ubuntu R中的软件包安装错误,那就太好了。

1 个答案:

答案 0 :(得分:5)

您需要安装libsodium-dev,这是您计算机上的某些软件,不一定是R特定的。

您可以通过Linux中的终端执行此操作。转到终端并执行

sudo apt install libsodium-dev

然后返回R并使用常用命令安装软件包

devtools::install_github("jedisct1/libsodium")