我尝试了几种不同的方法,所有方法都列在下面,并附有其错误输出。
1.
install.packages('rafalib')
建议在此处工作:conda - How to install R packages that are not available in "R-essentials"?。我的.libPaths()
指向'/home/user/anaconda2/lib/R/library'
。输出:
--- Please select a CRAN mirror for use in this session ---
Error in download.file(url, destfile = f, quiet = TRUE) :
unsupported URL scheme
Error: .onLoad failed in loadNamespace() for 'tcltk', details:
call: fun(libname, pkgname)
error: Can't find a usable init.tcl in the following directories:
/opt/anaconda1anaconda2anaconda3/lib/tcl8.5 ./lib/tcl8.5 ./lib/tcl8.5 ./library ./library ./tcl8.5.18/library ./tcl8.5.18/library
This probably means that Tcl wasn't installed properly.
我从conda渠道r-old安装了tcl,但是install.packages()仍然抛出相同的错误信息。
2. options(menu.graphics=FALSE) 然后 install.packages('rafalib')
我得到了一个镜像列表并选择了一个。
输出:
Selection: 15
trying URL 'http://cran.utstat.utoronto.ca/src/contrib/rafalib_1.0.0.tar.gz'
Content type 'application/x-gzip' length 11798 bytes (11 KB)
==================================================
downloaded 11 KB
sh: symbol lookup error: sh: undefined symbol: rl_signal_event_hook
The downloaded source packages are in
‘/tmp/Rtmphwpta0/downloaded_packages’
Warning message:
In install.packages("rafalib") :
installation of package ‘rafalib’ had non-zero exit status
2和3都来自于在R中禁用/抑制CRAN镜像选择的tcltk弹出窗口
3. 在~/.Rprofile
中设置镜像
在尝试install.packages()
之前,我将以下内容添加到了~/.Rprofile
中。
## Default repo
local({r <- getOption("repos");
r["CRAN"] <- "http://cran.us.r-project.org";
options(repos=r)})
输出:
trying URL 'http://cran.us.r-project.org/src/contrib/rafalib_1.0.0.tar.gz'
Content type 'application/x-gzip' length 11798 bytes (11 KB)
==================================================
downloaded 11 KB
sh: symbol lookup error: sh: undefined symbol: rl_signal_event_hook
The downloaded source packages are in
‘/tmp/RtmppIz9rT/downloaded_packages’
Warning message:
In install.packages("rafalib") :
installation of package ‘rafalib’ had non-zero exit status
4. 将下载方法设置为“curl”或“wget”。
保持新的~/.Rprofile配置
。我猜这不是必要的,因为包现在似乎可以正常下载,但我为了确保进行了测试。
输出:
sh: symbol lookup error: sh: undefined symbol: rl_signal_event_hook
Warning in download.packages(pkgs, destdir = tmpd, available = available, :
download of package ‘rafalib’ failed
Warning message:
In download.file(url, destfile, method, mode = "wb", ...) :
download had nonzero exit status
5. 手动下载 rafalib
install.packages('../Downloads/rafalib_1.0.0.tar.gz', repos=NULL, type='source')
输出:
sh: symbol lookup error: sh: undefined symbol: rl_signal_event_hook
Warning message:
In install.packages("../Downloads/rafalib_1.0.0.tar.gz", repos = NULL, :
installation of package ‘../Downloads/rafalib_1.0.0.tar.gz’ had non-zero exit status
6. 从 rafalib
构建 conda 包
我为此问题开了一个单独的问题Errors building R-packages for conda。简而言之,它抱怨我已经安装了缺失的依赖项。更新 我解决了依赖性问题,但是现在卡在了与我的其他方法相同的rl_signal_event_hook
错误上。
7. sudo ln /usr/lib/libncursesw.so.6 /usr/lib/libncursesw.so.5
根据https://github.com/conda/conda/issues/1679,但对我没有解决问题。
所以看起来我现在可以成功下载该包,但是安装失败了。当使用R的irkernel
在Jupyter Notebook
中时,我曾经看到过错误消息sh: symbol lookup error: sh: undefined symbol: rl_signal_event_hook
,但它从未阻碍我的工作。我从未在通过anaconda运行python时见到过任何与该错误消息相关的东西。
我无计可施。是否有人知道我如何安装由anaconda提供的R包,例如rafalib
或swirl
?
我正在使用Linux(Antergos,一个Arch衍生版)和内核4.4.5-1-ARCH。
更新 2016/04/15
在此线程中有一些相关的讨论。我尝试通过安装不同版本的ncurses来解决此错误,包括此修补程序版本,以及尝试链接readline库,如建议的那样,但我仍然遇到相同的错误。目前我有些失落,如果有任何帮助解决这个问题都将不胜感激。
install.packages("rafalib", repos = "http://cran.us.r-project.org")
吗? - Scott Warchalrl_signal_event_hook
错误。 - joelostblominstall.packages
有一个verbose = TRUE
选项,可以帮助您诊断发生了什么。 - alistaire