Non-zero exit status in R Jupyter Notebook but not in R - r

I am receiving a non-zero exit status when trying to install ggpubr in my R Jupyter Notebook. I was having this same issue about 2 weeks ago when trying to install gglot2, which I kept fumbling around including changing the CRAN and the package eventually installed.
I think there may be an issue at installing the dependencies in Jupyter notebook. I went back to the previous notebook where I installed ggplot2 and tried to run that code to see whether ggplot2 would reinstall--it doesn't and now that also returns non-zero exit status. I don't understand why I was once able to eventually install ggplot2 and I no longer can and I cannot install ggpubr either.
Note I've been able to install both ggplot2 and ggpubr in R, so I think this may be a Jupyter Notebook issue. I am an absolute beginner with coding, so any help with this and advice is much appreciated!!
Using macOS Mojave 10.14.6
install.packages("ggpubr")
also installing the dependencies ‘nloptr’, ‘pbkrtest’, ‘lme4’, ‘car’, ‘rstatix’
Warning message in install.packages("ggpubr"): “installation of package ‘nloptr’ had non-zero exit status”
Warning message in install.packages("ggpubr"): “installation of package ‘lme4’ had non-zero exit status”
Warning message in install.packages("ggpubr"): “installation of package ‘pbkrtest’ had non-zero exit status”
Warning message in install.packages("ggpubr"): “installation of package ‘car’ had non-zero exit status”
Warning message in install.packages("ggpubr"): “installation of package ‘rstatix’ had non-zero exit status”
Warning message in install.packages("ggpubr"): “installation of package ‘ggpubr’ had non-zero exit status”
Updating HTML index of packages in '.Library' Making 'packages.html'
...done

I kept getting the non-zero exit status when trying to install packages with Jupyter notebook with R kernel and was failing because of multiple dependencies when wanting to install a package. I am not an expert in any of these so please forgive me if I make an error in explaining or if it is a non-issue for you but please feel free to comment to clear things out. I just want to share my success story so hopefully it can help someone else:
I am working on a MacBook Pro. Here are the information I get when I run R.version() on my jupyter notebook with R kernel:
$platform 'x86_64-conda_cos6-linux-gnu'
$arch 'x86_64'
$os 'linux-gnu'
$system 'x86_64, linux-gnu'
$language 'R'
$version.string 'R version 3.6.1 (2019-07-05)'
These are the steps to take to fix the issue:
Go to https://anaconda.org/
Search the package name that you are trying to install
Copy the one line that is given to install the package, it should be something like:
Conda install -c r r-caret
#conda install -c r r-package_name
NOTE: sometimes during installing packages, you’re asked whether or not you want to continue, so add --y at the end of the above statement to continue, so something like this
Conda install -c r r-caret --y (I will always add it just to be on the safe side)
Click on the new launcher (+ icon) to create a new notebook with PySpark (once opened it has .ipynp extension)
On the first cell paste the copied line from step 3 and run
Once done, restart the kernel on the current notebook
Restart the kernel on your other notebook with R kernel
Run library (package_name) on your notebook with R kernel (e.x. library(caret))

Related

installing R2jags library in HPC linux

I am trying to install R2jags an r package in HPC linux environment, but doesn't work. This does work in windows, but not in HPC linux. I tried several options like:
install.packages("https://cran.r-project.org/src/contrib/R2jags_0.5-7.tar.gz", repos=NULL
but ends up with error:
ERROR: dependency 'rjags' is not available for package 'R2jags'
* removing '/ddn/home/grpl22/R/x86_64-pc-linux-gnu-library/3.6/R2jags'
Warning message:
In install.packages("https://cran.r-project.org/src/contrib/R2jags_0.5-7.tar.gz", :
installation of package '/tmp/Rtmprf6lN0/downloaded_packages/R2jags_0.5-7.tar.gz' had non-zero exit status
any sugeestion please how i can install this?

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?
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
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/")
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:
library(odbc)
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/
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.
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

R Not able to install CHAID

I am trying to install CHAID package into R using the command below.
install.packages("CHAID", repos="http://R-Forge.R-project.org")
I keep getting the response
Error in dev.off() : could not find function "dev.off"
Execution halted
In R CMD INSTALL
Warning in install.packages :
installation of package ‘CHAID’ had non-zero exit status
The OS is Windows10. R is running the latest 3.5.1
I tried to google the error and find a fix but without success.
Make sure you have the partykit package installed first before installing CHAID. That worked for me.

Install R package in Jupyter

I have been trying over the weekend to install mosaic, car and some other packages on an R kernel (3.4.2) in Jupyter Notebook running Ubuntu 16.04. I have tried install.packages('car', '/home/jayaramdas/anaconda3/lib/R/library/', repos='http://cran.us.r-project.org'): it returns:
also installing the dependency ‘pbkrtest’
Warning message in install.packages("car", "/home/jayaramdas/anaconda3/lib/R/library/", :
“installation of package ‘pbkrtest’ had non-zero exit status”Warning message in install.packages("car", "/home/jayaramdas/anaconda3/lib/R/library/", :
“installation of package ‘car’ had non-zero exit status”
I've tried installing it in the original R package and I get this:
Warning messages:
1: In install.packages("car", "/home/jayaramdas/anaconda3/lib/R/library/", :
installation of package ‘pbkrtest’ had non-zero exit status
2: In install.packages("car", "/home/jayaramdas/anaconda3/lib/R/library/", :
installation of package ‘car’ had non-zero exit status
I tried using Rstudio to install it, but it won't let me write the file. I also tried downloading the zip file for Ubuntu and it still gave the 'non-zero exiterror. Is this a usual problem that people have withcar` and other R packages? I am just trying to figure how to add some packages to my jupyter notebook.
You are on Ubuntu. You want to use a package manager (conda).
May I suggest you use the native one?
sudo apt-get install r-cran-car
will install car and all its dependencies. If not, file an Ubuntu bug report.
Similarly, you can get many more packages from Ubuntu: apt-cache search 'r-cran-*'. And once you consider the Rutter PPAs you have a large part of CRAN prebuilt.

Installing GISTools R Package in DSX

I am trying to install the "GISTools" R package in my R Jupyter notebook in IBM's Data Science Experience (DSX) with the following command:
install.packages("GISTools", depend = T)
however, I get the following error message: Installing package into
‘/gpfs/global_fs01/sym_shared/YPProdSpark/user/s17c-9f3318fc11f06c-d37a4b9405b6/R/libs’
(as ‘lib’ is unspecified)
also installing the dependency ‘rgeos’
Warning message in install.packages("GISTools", depend = T):
“installation of package ‘rgeos’ had non-zero exit status”Warning message in install.packages("GISTools", depend = T):
“installation of package ‘GISTools’ had non-zero exit status”
When I try library(GISTools) command, I get the following error message:
Error in library(GISTools): there is no package called ‘GISTools’
Traceback:
1. library(GISTools)
2. stop(txt, domain = NA)
I have looked at the following links in particular (and several other threads on Stack Overflow) but have not been able to resolve my issue:
Cannot install R packages in Jupyter Notebook
conda - How to install R packages that are not available in "R-essentials"?
Please can someone help?
Thanks,
V
GISTools have dependency on R package rgeos.
Now installing rgeos need you to have GEOS installed.
https://cran.r-project.org/web/packages/rgeos/rgeos.pdf
I attempted to install GEOS on DSX, it seems that GEOS need sudo permissions to install which are not available on DSX as a user.
https://duntuk.com/how-install-geos-centos
"make[7]: Nothing to be done for `install-exec-am'.
test -z "/usr/local/include/geos/algorithm/locate" || /bin/mkdir -p "/usr/local/include/geos/algorithm/locate"
/bin/mkdir: cannot create directory ‘/usr/local/include/geos’: Permission denied
make[7]: *** [install-geosHEADERS] Error 1"
You will need to rely on DSX Team to first install GEOS package installed and then you can install rgeos.
Please raise uservoice to get that installed so that you can install rgeos and then GISTools.
https://datascix.uservoice.com/
Hope that helps!!!
Thanks,
Charles.

Resources