読者です 読者をやめる 読者になる 読者になる

ほんとのこと知りたいだけなのに。

夏休みはもうおわり。

カメレオンに誘われて openSUSE 13.2 のインストール (その肆)

openSUSE Common Lisp R

カメレオンに誘われて openSUSE 13.2 のインストール (その肆)

その肆は Common Lisp で RCL 利用したいので R: The R Project for Statistical Computing をインストールします。

RCL でちょっと躓いたんじゃけど、結果的には成功しとるけぇ。

R のインストール

超簡単。


# sudo zypper install R-base
Loading repository data...
Reading installed packages...
Resolving package dependencies...

The following 2 NEW packages are going to be installed:
  R-base R-base-devel

2 new packages to install.
Overall download size: 44.9 MiB. Already cached: 0 B  After the operation,
additional 64.9 MiB will be used.
Continue? [y/n/? shows all options] (y): y
Retrieving package R-base-devel-3.1.1-2.1.9.x86_64
                                           (1/2), 122.6 KiB (407.1 KiB unpacked)
Retrieving: R-base-devel-3.1.1-2.1.9.x86_64.rpm ..........................[done]
Retrieving package R-base-3.1.1-2.1.9.x86_64
                                           (2/2),  44.8 MiB ( 64.6 MiB unpacked)
Retrieving: R-base-3.1.1-2.1.9.x86_64.rpm ....................[done (2.5 MiB/s)]
Checking for file conflicts: .............................................[done]
(1/2) Installing: R-base-devel-3.1.1-2.1.9 ...............................[done]
(2/2) Installing: R-base-3.1.1-2.1.9 .....................................[done]

動いとるねぇ。


# R

R version 3.1.1 (2014-07-10) -- "Sock it to Me"
Copyright (C) 2014 The R Foundation for Statistical Computing
Platform: x86_64-suse-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> 

RCLのインストール

あっさり終わるとおもっとったんじゃけど、エラーになった。


> (ql:quickload :rcl)

To load "rcl":
  Load 3 ASDF systems:
    bordeaux-threads cffi trivial-garbage
  Install 1 Quicklisp release:
    rcl
; Fetching #
; 33.29KB
==================================================
34,089 bytes in 0.17 seconds (191.32KB/sec)
; Loading "rcl"
[package rcl].....................................
[package rcl-test]


<<デバッガ>>
Can't find library libR.so in /usr/lib/R/lib/, verify settings in config.lisp
   [Condition of type SIMPLE-ERROR]

Restarts:
 0: [RETRY] Retry compiling #.
 1: [ACCEPT] Continue, treating compiling # as having been successful.
 2: [RETRY] Retry ASDF operation.
 3: [CLEAR-CONFIGURATION-AND-RETRY] Retry ASDF operation after resetting the configuration.
 4: [ABORT] Give up on "rcl"
 5: [RETRY] Retry SLIME REPL evaluation request.
 --more--

Backtrace:
  0: (SB-INT:SIMPLE-EVAL-IN-LEXENV (ERROR "Can't find library ~A in ~A, verify settings in config.lisp" RCL::*R-LIB* RCL::*R-LIB-PATH*) #)
  1: (SB-INT:SIMPLE-EVAL-IN-LEXENV (PROGN (ERROR "Can't find library ~A in ~A, verify settings in config.lisp" RCL::*R-LIB* RCL::*R-LIB-PATH*)) #)
  2: (SB-INT:SIMPLE-EVAL-IN-LEXENV (IF (PROBE-FILE (CONCATENATE # RCL::*R-LIB-PATH* RCL::*R-LIB*)) NIL (PROGN (ERROR "Can't find library ~A in ~A, verify settings in config.lisp" RCL::*R-LIB* RCL::*R-LIB-P..
  3: (SB-INT:SIMPLE-EVAL-IN-LEXENV (PROGN (IF (PROBE-FILE #) NIL (PROGN #))) #)
  4: (EVAL-TLF (PROGN (IF (PROBE-FILE #) NIL (PROGN #))) 1 #)
  5: (SB-C::EVAL-COMPILE-TOPLEVEL ((IF (PROBE-FILE #) NIL (PROGN #))) ((IF (PROBE-FILE #) NIL (PROGN #)) SB-C::ORIGINAL-SOURCE-START 11 7 1))
  6: ((FLET SB-C::DEFAULT-PROCESSOR :IN SB-C::PROCESS-TOPLEVEL-FORM) (IF (PROBE-FILE (CONCATENATE # RCL::*R-LIB-PATH* RCL::*R-LIB*)) NIL (PROGN (ERROR "Can't find library ~A in ~A, verify settings in confi..
  7: (SB-C::PROCESS-TOPLEVEL-FORM (IF (PROBE-FILE (CONCATENATE # RCL::*R-LIB-PATH* RCL::*R-LIB*)) NIL (PROGN (ERROR "Can't find library ~A in ~A, verify settings in config.lisp" RCL::*R-LIB* RCL::*R-LIB-PA..
  8: ((FLET SB-C::DEFAULT-PROCESSOR :IN SB-C::PROCESS-TOPLEVEL-FORM) (UNLESS (PROBE-FILE (CONCATENATE # RCL::*R-LIB-PATH* RCL::*R-LIB*)) (ERROR "Can't find library ~A in ~A, verify settings in config.lisp"..
  9: (SB-C::PROCESS-TOPLEVEL-FORM (UNLESS (PROBE-FILE (CONCATENATE # RCL::*R-LIB-PATH* RCL::*R-LIB*)) (ERROR "Can't find library ~A in ~A, verify settings in config.lisp" RCL::*R-LIB* RCL::*R-LIB-PATH*)) (..
 10: (SB-C::PROCESS-TOPLEVEL-PROGN ((DEFVAR RCL::*R-HOME* "/usr/lib/R/") (DEFVAR RCL::*R-LIB-NAME* "libR") (DEFVAR RCL::*R-LIB-EXTENSION* ".so") (DEFVAR RCL::*R-LIB* (CONCATENATE # RCL::*R-LIB-NAME* RCL::*..
 11: (SB-C::PROCESS-TOPLEVEL-FORM (EVAL-WHEN (:COMPILE-TOPLEVEL :LOAD-TOPLEVEL :EXECUTE) (DEFVAR RCL::*R-HOME* "/usr/lib/R/") (DEFVAR RCL::*R-LIB-NAME* "libR") (DEFVAR RCL::*R-LIB-EXTENSION* ".so") (DEFVAR..
 12: (SB-C::SUB-SUB-COMPILE-FILE #)
 13: ((FLET SB-THREAD::WITH-RECURSIVE-LOCK-THUNK :IN SB-C::SUB-COMPILE-FILE))
 14: ((FLET #:WITHOUT-INTERRUPTS-BODY-676 :IN SB-THREAD::CALL-WITH-RECURSIVE-LOCK))
 15: (SB-THREAD::CALL-WITH-RECURSIVE-LOCK # #)
 19: (COMPILE-FILE #P"/home/yanqirenshi/quicklisp/dists/quicklisp/software/rcl-20141106-http/config.lisp" :OUTPUT-FILE #P"/home/yanqirenshi/.cache/common-lisp/sbcl-1.2.3-1.8-suse-linux-x64/home/yanqirenshi..

libR.so の場所

libR.so がないんじゃって。

Rはどこにインストールしたん?

/usr/lib64/R/bin/R じゃね。


> which R
/usr/bin/R

> dir /usr/bin/R
lrwxrwxrwx 1 root root 16 11月 22 19:43 /usr/bin/R -> ../lib64/R/bin/R

あ、あった。


yanqirenshi@linux-7s06:~> ls -la /usr/lib64/R/lib
合計 4856
drwxr-xr-x 1 root root      62 11月 22 19:43 .
drwxr-xr-x 1 root root     114 11月 22 19:43 ..
-rwxr-xr-x 1 root root 2959928 10月 15 18:59 libR.so
-rwxr-xr-x 1 root root  182296 10月 15 18:59 libRblas.so
-rwxr-xr-x 1 root root 1824304 10月 15 18:59 libRlapack.so

config.lisp の変更

config.lisp に設定されとるんじゃろうね /usr/lib/R/lib/ が。 これを /usr/lib64/R/lib に変えんにゃぁいけんね。

config.lisp はどこにあるんじゃろうか。

あった。


~/quicklisp/dists/quicklisp/software/rcl-20141106-http/config.lisp

Windows と Mac OS X 以外は /usr/lib/R/ になっとるね。


(defvar *r-home* 
  #+darwin "/Library/Frameworks/R.framework/Resources/"
  #+windows "c:/Program Files/R/R-3.1.2/"
  #-(or darwin windows) "/usr/lib/R/")

ここを /usr/lib64/R/lib に変更してみちゃろう。


(defvar *r-home* 
  #+darwin "/Library/Frameworks/R.framework/Resources/"
  #+windows "c:/Program Files/R/R-3.1.2/"
  ;;#-(or darwin windows) "/usr/lib/R/") ;; ここはとりあえずコメントアウト
  #-(or darwin windows) "/usr/lib64/R/")

インストール成功

あ、インストール出来た。


> (ql:quickload :rcl)
To load "rcl":
  Load 1 ASDF system:
    rcl
; Loading "rcl"
......................................
(:RCL)

稼動確認

うん。動いとるね。


> (r:r-init)
:RUNNING
> (r:r "R.Version")
((:|nickname| "Sock it to Me")
 (:|version.string| "R version 3.1.1 (2014-07-10)") (:|language| "R")
 (:|svn rev| "66115") (:|day| "10") (:|month| "07") (:|year| "2014")
 (:|minor| "1.1") (:|major| "3") (:|status| "") (:|system| "x86_64, linux-gnu")
 (:|os| "linux-gnu") (:|arch| "x86_64") (:|platform| "x86_64-suse-linux-gnu"))