Durch die Nutzung von AWS re:Post stimmt du den AWS re:Post Nutzungsbedingungen

Is there a way to install R libraries in SageMaker that receive a non-zero exit status?

0

Hi all, I'm having an issue with an R kernel/Jupyter notebook. I've come across two different libraries that result in the following error:

Warning message in install.packages("XML", repos = "https://cran.r-project.org"):
“installation of package ‘XML’ had non-zero exit status”Updating HTML index of packages in '.Library'
Making 'packages.html' ... done

XML is the second package that I have run into this issue with. The other is rJava.

I found a workaround that could work if I had root access, which is installing via the command line in a terminal. Which involves commands such as:

yum install r-cran-rjava

However, I don't have root access and cannot install as I get the message "You need to be root to perform this command." So this workaround hasn't been possible.

After checking the documentation for rJava and XML, I am running the requirements for JDK and other system requirements in SageMaker. This issue wasn't reproducible on a local RStudio environment. XML is a dependency for multiple R libraries (as is rJava). Is there a way that I can still install these packages?

gefragt vor 7 Jahren1519 Aufrufe
1 Antwort
0
Akzeptierte Antwort

For Amazon SageMaker notebook Instances, you have the ability to assume root privileges, so instead of:

$ yum install r-cran-rjava

you can try:

$ sudo yum install r-cran-rjava

which will allow you to impersonate the superuser (ie. root) for that command 1

But I don't believe that package exists in the available repos (ie. may be valid for another distro of Linux, but does not appear to be available in the yum repos -- running yum search 'r-cran-rjava' returned no results 2)

Instead, from a prompt, install R + the necessary development files for later installation of R packages:

$ sudo yum install -y R-java-devel.x86_64

And finally, install the necessary XML libraries to support the XML package in R:

$ sudo yum install -y libxml2-devel 3

After which you can then open R (either as root user...)

$ sudo R

or personal/local user

$ R

and execute the package installation:

> install.packages("XML", repos = "https://cran.r-project.org")

EDITED TO FIX RJAVA PACKAGE INSTALLATION

It looks like the installation is requiring libgomp.spec/libgomp.a files, so you can first find that file:

$ sudo find / -iname libgomp.spec

which should be located at /usr/lib/gcc/x86_64-amazon-linux/4.8.5/libgomp.spec -- if so, you can manually create symlinks to fix this:

$ sudo ln -s /usr/lib/gcc/x86_64-amazon-linux/4.8.5/libgomp.spec /usr/lib64/
$ sudo ln -s /usr/lib/gcc/x86_64-amazon-linux/4.8.5/libgomp.a /usr/lib64/

If that ran correctly, you should now see both files in /usr/lib64 path:

$ ls /usr/lib64/libgomp*

Once confirmed, you can run the install.package('rJava') command.

beantwortet vor 7 Jahren
profile picture
EXPERTE
überprüft vor 5 Monaten

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen