0

I'm trying to install the tm package on IBM's Data Science Experience (DSX):

install.packages("tm")

However, I'm hitting this issue:

"dependency 'slam' is not available"

This post suggests that R version 3.3.1 will resolve the issue, however the R version on DSX is: R version 3.3.0 (2016-05-03)

How can I resolve this issue on IBM DSX? Note that you don't have root access on DSX.

I've seen similar questions on stackoverflow, but none are asking how to fix the issue on IBM DSX, e.g. dependency ‘slam’ is not available when installing TM package


Update:

install.packages("slam")

Returns:

Installing package into '/gpfs/global_fs01/sym_shared/YPProdSpark/user/s85d-88ebffb000cc3e-39ca506ba762/R/libs'
(as 'lib' is unspecified)
Warning message:
"package 'slam' is not available (for R version 3.3.0)"
Community
  • 1
  • 1
Chris Snow
  • 23,813
  • 35
  • 144
  • 309
  • Did you get the same error when trying to install `slam` using `install.packages`? – sebastian-c Nov 04 '16 at 09:39
  • Try some of the following: `available.packages()`, `install.packages("slam", type = "source")` – sebastian-c Nov 04 '16 at 09:47
  • 2
    See the dependency stated [on CRAN](https://cran.r-project.org/web/packages/slam/index.html). You could try to install an older version of these packages. – Roland Nov 04 '16 at 09:51
  • Ok, thanks. I'll raise this with the product team for DSX. – Chris Snow Nov 04 '16 at 09:52
  • did you try `install.packages("slam", method="curl")` ? it fixes many _... not available (for R version ...)_ errors – jangorecki Nov 04 '16 at 15:00
  • Unfortunately, still the same error with curl. – Chris Snow Nov 04 '16 at 15:04
  • R notebooks on #dsx now run on R-3.3.2 and installing the package `slam` works out of the box. In general, the approach suggested in the accepted answer is the correct way to satisfy dependencies among R packages. – Sumit Goyal Feb 19 '17 at 10:01

3 Answers3

6

If you try to install slam with install.packages(), then the version 0.1.40 will be used from CRAN. According to your error and the DESCRIPTION file of the library, it has the dependency on R (>= 3.3.1).

If a older version of slam is useful for you, then you can install it from the CRAN archives. See https://cran.r-project.org/src/contrib/Archive/slam/

According to the documentation for tm, it has a dependency on slam (≥ 0.1-31). See https://cran.r-project.org/web/packages/tm/index.html

Previous versions have a dependency on older R versions. The following code worked for me to install slam_0.1.37 on DSX:

library(devtools)
install_url("https://cran.r-project.org/src/contrib/Archive/slam/slam_0.1-37.tar.gz")

# test slam
library(slam)
a <- as.simple_sparse_array(1:3)
a
extend_simple_sparse_array(a, c( 0L, 1L))
Sven Hafeneger
  • 801
  • 6
  • 13
0

You need to install slam either by

install.packages("slam")

OR

slam_url <- "https://cran.r-project.org/src/contrib/Archive/slam/slam_0.1-37.tar.gz"
install_url(slam_url)
Djandli
  • 131
  • 1
  • 5
-3

try sudo apt-get install r-cran-slam (worked for lubuntu)