1

我一直在尝试通过 ipython notebook 为 R 安装 RWeka,但出现错误。我有 ubuntu 16.10

我尝试了以下命令

sudo R CMD javareconf

sudo R

install.packages("rJava",type="source")

"Installing package into ‘/home/shahan/R/x86_64-pc-linux-gnu-
library/3.3’
(as ‘lib’ is unspecified)

Content type 'application/x-gzip' length 656615 bytes (641 KB)

downloaded 641 KB

* installing *source* package ‘rJava’ ...
* package ‘rJava’ successfully unpacked and MD5 sums checked

warning: [options] bootstrap class path not set in conjunction with -
source 1.4

1 warning

/usr/lib/jvm/java-7-openjdk-amd64/jre/../bin/jar fc JRI.jar org 
libjri.so
make[2]: Leaving directory 

'/tmp/RtmpDMwK9H/R.INSTALL4a885e7a4476/rJava/jri/src'

rm -f libjri.so
cp src/libjri.so libjri.so

/usr/lib/jvm/java-7-openjdk-amd64/jre/../bin/javac -target 1.4 -source 
1.4 -classpath src/JRI.jar -d examples examples/rtest.java

warning: [options] bootstrap class path not set in conjunction with -
source 1.4

Note: examples/rtest.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.

1 warning

/usr/lib/jvm/java-7-openjdk-amd64/jre/../bin/javac -target 1.4 -source 
1.4 -classpath src/JRI.jar -d examples examples/rtest2.java

warning: [options] bootstrap class path not set in conjunction with -
source 1.4

Note: examples/rtest2.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.

1 warning
make[1]: Leaving directory 
'/tmp/RtmpDMwK9H/R.INSTALL4a885e7a4476/rJava/jri'

installing via 'install.libs.R' to /home/shahan/R/x86_64-pc-linux-gnu-
library/3.3/rJava

** R
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
* DONE (rJava)

The downloaded source packages are in
    ‘/tmp/RtmpPksP2c/downloaded_packages’ "
install.packages("RWeka")
Error in download.file(url, destfile, method, mode = "wb", ...) : 
  cannot download all files
In addition: Warning message:
In download.file(url, destfile, method, mode = "wb", ...) :
downloaded length 0 != reported length 415763
Warning in download.packages(pkgs, destdir = tmpd, available = 
available,  :
download of package ‘RWeka’ failed
* installing *source* package ‘RWekajars’ ...
** package ‘RWekajars’ successfully unpacked and MD5 sums checked
** R
** inst
** preparing package for lazy loading
** help
No man pages found in package  ‘RWekajars’ 
*** installing help indices
** building package indices
** testing if installed package can be loaded
* DONE (RWekajars)

The downloaded source packages are in
    ‘/tmp/RtmpPksP2c/downloaded_packages’ "

最后当我跑步时

library("RWeka")

我收到以下错误。任何帮助,将不胜感激。

"Error: package or namespace load failed for ‘RWeka’
Traceback:

1. library("RWeka")
2. stop(gettextf("package or namespace load failed for %s", 
sQuote(package)), 
 .     call. = FALSE, domain = NA)"
4

1 回答 1

0

您可以按照以下说明进行操作:

$ cd ~/

$ sudo -i

$ apt-get install r-cran-rjava

$ apt-get update

$ apt-get install openjdk-8-jdk

(版本 8 似乎没有错误!)

$ rm -rf /usr/lib/jvm/default-java

(我个人没有 default-java 文件,但你可以检查它是否存在于你的机器上)

$ ln -s /usr/lib/jvm/java-8-openjdk-amd64/ /usr/lib/jvm/default-java

$ R CMD javareconf

$ R

$ install.packages(“RWeka”)
于 2018-12-04T12:16:51.640 回答