简体   繁体   English

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

[英]Unable to install nloptr / nlopt on a cluster without root rights

I am trying to install (on a linux based cluster) the R package FactoMineR, which requires nloptr, which in turn requires nlopt. 我正在尝试安装(在基于Linux的集群上)R包FactoMineR,它需要nloptr,而后者又需要nlopt。 Just using install.packages("nloptr") does not work and yields the following error: 只使用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

At this point R freezes and has to be restarted. 此时R冻结并且必须重新启动。 Therefore, I tried to manually install nlopt and followed the guide on the official website . 因此,我尝试手动安装nlopt并遵循官方网站上的指南。 I installed everything in my home folder because I have no root rights on the cluster. 我在家庭文件夹中安装了所有内容,因为我对群集没有root权限。 The nloptr installation still fails with the same error of not finding nlopt. nloptr安装仍然失败,同样的错误是找不到nlopt。 This issue seemed to be the same, but using 这个问题似乎是一样的,但使用

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

still yields the same error. 仍然会产生相同的错误。
The folder $HOME/include contains these files: nlopt.f nlopt.h nlopt.hpp and $HOME/lib64 contains the following: cmake/ libnlopt.so@ libnlopt.so.0@ libnlopt.so.0.9.0* pkgconfig/ python2.7/ . $HOME/include文件夹包含以下文件: nlopt.f nlopt.h nlopt.hpp$HOME/lib64包含以下内容: cmake/ libnlopt.so@ libnlopt.so.0@ libnlopt.so.0.9.0* pkgconfig/ python2.7/

I already retried several times, using several other tips on related issues, but so far nothing worked and any hints would be greatly appreciated. 我已经多次重试,在相关问题上使用了其他一些技巧,但到目前为止没有任何工作,任何提示都会受到高度赞赏。 Thanks! 谢谢!

Edit: Does anyone have ideas? 编辑:有没有人有想法?

The question may be a little old, but I would like to clarify for future references. 这个问题可能有点旧,但我想澄清一下以后的参考资料。

I had the same problem when transferring a project created with packrat , at the time of doing the unbundle() in the cluster of the company I saw that I needed to install the package nloptr , as you mention it is just an interface for the nlopt library. 转移使用packrat创建的项目时遇到同样的问题,在公司集群中执行nloptr unbundle()时我看到我需要安装包nloptr ,正如你所提到的那样它只是nlopt一个接口图书馆。

"NLopt is a library for nonlinear local and global optimization, for functions with and without gradient information." “NLopt是一个用于非线性局部和全局优化的库,用于包含和不包含梯度信息的函数。”

This library is necessary to install it in the system and for this it is necessary to have root permissions. 该库是在系统中安装它所必需的,为此必须具有root权限。 Otherwise, you will have an error message when installing nloptr or you will not be able to complete the installation and stay in that stage blocking the R / Rstudio session. 否则,在安装nloptr时会出现错误消息,或者您将无法完成安装并停留在阻止R / Rstudio会话的那个阶段。

I do not know of any possibility of doing an installation of that library in "local" for a user and use it to install nloptr or any other package that depends on it. 我不知道是否有可能在“本地”为用户安装该库,并使用它来安装nloptr或任何其他依赖它的包。

The only solution I see is that you should contact the IT manager and ask him to install it. 我看到的唯一解决方案是您应该联系IT经理并要求他安装它。

I hope I have been clear and able to help a little. 我希望我已经清楚并能够帮助一点。

If you can not use install.packages("nloptr") to install R package in Cluster, I suggest 2 ways worth trying. 如果你不能使用install.packages(“nloptr”)在Cluster中安装R包,我建议2种值得尝试的方法。

  1. Locally install that package 在本地安装该软件包

    • you first load the module for the R version you want to install the package; 首先加载要安装包的R版本的模块;
    • download package "nloptr_1.0.4.tar.gz" and save it to the directory in VSC; 下载软件包“nloptr_1.0.4.tar.gz”并将其保存到VSC目录中;
    • next, make sure you are in the directory that contains the package; 接下来,确保您位于包含该包的目录中;
    • last, run command R CMD install nloptr_1.0.4.tar.gz (run outside R) 最后,运行命令R CMD install nloptr_1.0.4.tar.gz(在R外运行)
  2. Try to directly load NLopt module by running a command: module load Nlopt/2.4.2-foss-2015a normally it will work, otherwise you have to contact a technical staff to help you build that with C++. 尝试通过运行命令直接加载NLopt模块:模块加载Nlopt / 2.4.2-foss-2015a通常它会工作,否则你必须联系技术人员来帮助你用C ++构建它。

I was seeing a similar error, but installing the github version worked for me. 我看到了类似的错误,但安装github版本对我有用。

The README at https://cran.r-project.org/web/packages/nloptr/README.html says: https://cran.r-project.org/web/packages/nloptr/README.html上的自述文件说:

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

This worked for me. 这对我有用。 I did install nlopt locally as a module, but I don't know if that made a difference or not; 我确实在本地安装了nlopt作为模块,但我不知道这是否有所作为; the version of nlopt I installed is 2.5.0. 我安装的nlopt版本是2.5.0。

Hope this is useful! 希望这很有用!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM