xiaodai
xiaodai

Reputation: 16064

How do I install R packages on the SageMaker Notebook instance?

I tried to start a R notebook in Sagemaker and I typed

install.packages("disk.frame")

and it gave me the error

also installing the dependencies ‘listenv’, ‘dplyr’, ‘rlang’, ‘furrr’, 
‘future.apply’, ‘fs’, ‘pryr’, ‘fst’, ‘globals’, ‘future’

Warning message in install.packages("disk.frame"):
“installation of package ‘rlang’ had non-zero exit status”
Warning message in install.packages("disk.frame"):
“installation of package ‘fs’ had non-zero exit status”
Warning message in install.packages("disk.frame"):
“installation of package ‘pryr’ had non-zero exit status”
Warning message in install.packages("disk.frame"):
“installation of package ‘fst’ had non-zero exit status”
Warning message in install.packages("disk.frame"):
“installation of package ‘dplyr’ had non-zero exit status”
Warning message in install.packages("disk.frame"):
“installation of package ‘disk.frame’ had non-zero exit status”
Updating HTML index of packages in '.Library'
Making 'packages.html' ... done

How do I install R packages on Sagemaker?

Upvotes: 4

Views: 4621

Answers (6)

PaulP
PaulP

Reputation: 11

In SageMaker, click "File" > "New" > "Terminal".

In that terminal type conda install -c conda-forge r-disk.frame and push the Enter key.

If you need to install other R packages on SageMaker, search for them on https://anaconda.org/ where it will show you what to enter in the Terminal to download.

Upvotes: 0

Cheng-Yi Chen
Cheng-Yi Chen

Reputation: 3

I followed the instruction: https://aws.amazon.com/blogs/machine-learning/creating-a-persistent-custom-r-environment-for-amazon-sagemaker/

And this code worked for me

system("conda install -n R -c conda-forge r-rjava")

Where r-rjava is the package name from Anaconda cloud. You can find the specific package name/version here: https://anaconda.org/

Upvotes: 0

xricky
xricky

Reputation: 41

if you are still running in to the error, I found a way to get around it. Is very simple. I answered it in this other post, which I had already created. Sorry 'bout that:

Error installing RODBC or ODBC on a Sagemaker Jupyter NoteBook Instance

Upvotes: -1

xricky
xricky

Reputation: 41

I have been getting the same error installing odbc on a sagemaker instance. I've tryed remotes::install_github() or devtools::install_github()

and also: install.packages('odbc', repo="https://cran.rstudio.com/")

and pretty much on every instance I get the same warning “installation of package ‘odbc’ had non-zero exit status”Updating HTML index of packages in '.Library' Making 'packages.html' ... done

and if I try to call the package: Error in library(odbc): there is no package called ‘odbc’ Traceback:

  1. library(odbc)

Upvotes: 1

Zain Aziz
Zain Aziz

Reputation: 66

Thank you for using Amazon SageMaker.

This issue has been resolved and you should be able to install R packages using

install.packages("disk.frame")

or

install.packages("disk.frame", repo="https://cran.rstudio.com/")

I tested it and was able to successfully install the package with ouput

also installing the dependencies ‘listenv’, ‘benchmarkmeData’, ‘doParallel’, ‘bigassertr’, ‘bit’, ‘dplyr’, ‘rlang’, ‘furrr’, ‘future.apply’, ‘fs’, ‘pryr’, ‘fst’, ‘globals’, ‘future’, ‘benchmarkme’, ‘bigreadr’, ‘bit64’

Updating HTML index of packages in '.Library'
Making 'packages.html' ... done

Upvotes: 3

xiaodai
xiaodai

Reputation: 16064

I think you just need to specify a repo. For example, setting the RStudio CRAN repo, I can install perfectly fine.

install.packages("disk.frame", repo="https://cran.rstudio.com/")

Upvotes: 1

Related Questions