gpt4 book ai didi

r - 无法在没有 root 权限的集群上安装 nloptr/nlopt

转载 作者:太空狗 更新时间:2023-10-29 11:17:16 54 4
gpt4 key购买 nike

我正在尝试安装(在基于 linux 的集群上)R 包 FactoMineR,它需要 nloptr,而 nlopt 又需要 nlopt。仅使用 install.packages("nloptr") 不起作用并产生以下错误:

> install.packages("nloptr")
Installing package into ‘/beegfs/group/home/username/.R/3.3.2/R_LIBS_USER’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/src/contrib/nloptr_1.0.4.tar.gz'
Content type 'application/x-gzip' length 353957 bytes (345 KB)
==================================================
downloaded 345 KB

* installing *source* package ‘nloptr’ ...
** package ‘nloptr’ successfully unpacked and MD5 sums checked
checking for g++... g++
checking whether the C++ compiler works... yes
checking for C++ compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking how to run the C++ preprocessor... g++ -E
checking whether we are using the GNU C++ compiler... (cached) yes
checking whether g++ accepts -g... (cached) yes
checking for pkg-config... yes
configure: Now testing for NLopt header file.
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking nlopt.h usability... no
checking nlopt.h presence... no
checking for nlopt.h... no
configure: Need to download and build NLopt
trying URL 'http://ab-initio.mit.edu/nlopt/nlopt-2.4.2.tar.gz'
Error in download.file(url = "http://ab-initio.mit.edu/nlopt/nlopt-2.4.2.tar.gz", :
cannot open URL 'http://ab-initio.mit.edu/nlopt/nlopt-2.4.2.tar.gz'
Execution halted
/usr/bin/gtar: This does not look like a tar archive

gzip: stdin: unexpected end of file
/usr/bin/gtar: Child returned status 1
/usr/bin/gtar: Error is not recoverable: exiting now
Warning message:
In untar(tarfile = "nlopt-2.4.2.tar.gz") :
'/usr/bin/gtar -xf 'nlopt-2.4.2.tar.gz'' returned error code 2
configure: Starting to install library to /tmp/RtmpazbyAy/R.INSTALL2d6f734a93606/nloptr/nlopt-2.4.2
./configure: line 3325: cd: nlopt-2.4.2: No such file or directory

此时 R 卡住,必须重新启动。因此,我尝试手动安装 nlopt 并按照官方上的指南 website .我将所有内容都安装在我的主文件夹中,因为我在集群上没有 root 权限。 nloptr 安装仍然失败,同样的错误是找不到 nlopt。 This issue似乎是一样的,但使用

install.packages('nloptr', dependencies = TRUE, 
configure.args = "--with-nlopt-cflags='-I/$HOME/include' --with-nlopt-libs='-L/$HOME/lib64 -lnlopt'")

仍然会产生同样的错误。
文件夹 $HOME/include 包含这些文件:nlopt.f nlopt.h nlopt.hpp$HOME/lib64 包含以下内容:cmake/libnlopt.so@libnlopt.so.0@libnlopt.so.0.9.0*pkgconfig/python2.7/.

我已经重试了几次,在相关问题上使用了其他几个提示,但到目前为止没有任何效果,任何提示都将不胜感激。谢谢!

编辑:有人有想法吗?

最佳答案

我看到了类似的错误,但安装 github 版本对我有用。

自述文件位于 https://cran.r-project.org/web/packages/nloptr/README.html说:

library(devtools)
devtools::install_github("jyypma/nloptr")

这对我有用。我确实在本地将 nlopt 作为模块安装,但我不知道这是否有所作为;我安装的nlopt版本是2.5.0。

希望这有用!

关于r - 无法在没有 root 权限的集群上安装 nloptr/nlopt,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47515112/

54 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com