RHEL 7.4 Creating R Package


#1

Trying to make the R package on Red Hat Enterprise Linux Server release 7.4 (Maipo) using command:
make rpkg

the libmxnet.so file completed building without error:
[root@lrlkwk01 incubator-mxnet]# locate libmxnet.so
/root/incubator-mxnet/R-package/inst/libs/libmxnet.so
/root/incubator-mxnet/lib/libmxnet.so
/usr/lib/libmxnet.so

But keep running into the below error and seen to have hit a wall

installing to /usr/local/lib64/R/library/mxnet/libs
** R
** demo
** inst
** preparing package for lazy loading
** help
No man pages found in package ‘mxnet’
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
Error : .onLoad failed in loadNamespace() for ‘mxnet’, details:
call: dyn.load(file, DLLpath = DLLpath, …)
error: unable to load shared object ‘/usr/local/lib64/R/library/mxnet/libs/libmxnet.so’:
libopenblas.so.0: cannot open shared object file: No such file or directory
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/usr/local/lib64/R/library/mxnet’
make: *** [rpkg] Error 1


#2

Issue seems due to OpenBlas not being found. Was the OpenBlas library properly installed prior to mxnet? If it was, you may try to add a symbolic link to openblas.so to your /lib/ directory.


#3

Looks like the link is present in /lib/:
root@lrlkwk01 lib]# ls -l | grep openblas
lrwxrwxrwx. 1 root root 32 Mar 1 13:37 libopenblas.so -> /opt/OpenBLAS/lib/libopenblas.so

[root@lrlkwk01 library]# locate libopenblas.so.0
/opt/OpenBLAS/lib/libopenblas.so.0
/root/OpenBLAS/libopenblas.so.0

Do I need to create a similar link in /usr/local/lib?


#4

Added a symlink as follows:
ln -s /opt/OpenBLAS/lib/libopenblas.so.0 /usr/lib64/libopenblas.so.0
ls -s /opt/OpenBLAS/lib/libopenblas.so /usr/lib64/libopenblas.so

which got past this error, now at a new problem where it reports this error:
R CMD INSTALL R-package

  • installing to library ‘/usr/local/lib64/R/library’
  • installing source package ‘mxnet’ …
    ** libs
    make[1]: Entering directory /root/incubator-mxnet/R-package/src' make[1]: Nothing to be done forall’.
    make[1]: Leaving directory `/root/incubator-mxnet/R-package/src’
    installing to /usr/local/lib64/R/library/mxnet/libs
    ** R
    ** demo
    ** inst
    ** preparing package for lazy loading
    Error : object ‘set_global_graph_attrs’ is not exported by ‘namespace:DiagrammeR’
    ERROR: lazy loading failed for package ‘mxnet’
  • removing ‘/usr/local/lib64/R/library/mxnet’
  • restoring previous ‘/usr/local/lib64/R/library/mxnet’
    make: *** [rpkg] Error 1

Installed this in R using this command:
devtools::install_github(‘rich-iannone/DiagrammeR’)

which seemed to install ok, but still getting the error. Also found this on stack overflow:

require(devtools)
install_version(“DiagrammeR”, version = “0.9.0”, repos = “http://cran.us.r-project.org”)
require(DiagrammeR)

but get this:

install_version(“DiagrammeR”, version = “0.9.0”, repos = “http://cran.us.r-project.org”)
Downloading package from url:
R/DiagrammeR_0.9.0.tar.gz
Installation failed: Timeout was reached: Connection timed out after 10000 milliseconds


#5

Got around it by using an australian mirror:
install_version(“DiagrammeR”, version = “0.9.2”, repos = “https://cran.csiro.au/”)


#6

And it built succesfully:
R version 3.3.0 (2016-05-03) – “Supposedly Educational”
Copyright © 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-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.

Natural language support but running in an English locale

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.

library(mxnet)
a <- mx.nd.ones(c(2,3), ctx = mx.cpu())
b <- a * 2 + 1
b
[,1] [,2] [,3]
[1,] 3 3 3
[2,] 3 3 3

Did see a number of these errors in the build process, do we need to worry about them?
Warning: /root/incubator-mxnet/R-package/man/mx.symbol.MAERegressionOutput.Rd:32: unknown macro ‘\hat’
Warning: /root/incubator-mxnet/R-package/man/mx.symbol.MAERegressionOutput.Rd:32: unknown macro ‘\textbf’
Warning: /root/incubator-mxnet/R-package/man/mx.symbol.MAERegressionOutput.Rd:32: unknown macro ‘\rVert’


#7

The warnings in the building process have been present for as far as I remember, not tied to any performance issue, seems only tied to the documentation building.

Regarding the DiagrammeR issue, it was caused from the migration of DiagrammeR to 1.0.0 that deprecated a function used in mxnet package. Issue has been fixed, so if you build mxnet from the current master version, it should work just fine with the up to date DiagrammeR package (as well as past versions).