How to deploy a *.tar.gz package on Opencpu - r

I have the following issue:
I created a R package which is ending in *.tar.gz and I want to just upload this to the ubuntu server and install it into opencpu from the servers file system without using github (as Im not familiar with github that much yet).
I have the following configuration:
Ubuntu 14.04 running opencpu /opencpu-cache on it
Installed R
Installed RStudio
I haven't found any guideline which points into this direction.
Does anyone have some guidance on how a R package (tar.gz) can be installed in Opencpu without using Github?
Thank you!

There is nothing special about packages that you use with OpenCPU. Install it like any R package:
R CMD INSTALL yourpackage_1.2.tar.gz
If you are not root and you want to install in the global library you might need sudo:
sudo R CMD INSTALL yourpackage_1.2.tar.gz --library=/usr/local/lib/R/site-library
Afterward installing you should be able to interact with the package via e.g.
curl http://localhost/ocpu/user/yourname/library/yourpackage/R
curl http://localhost/ocpu/library/yourpackage/R

Related

InstallationWarning: package 'XYZ' is in use and will not be installed: R

I am trying to install package SBCK from R build using Rscript build.R -c -v -i in windows command prompt following the steps given here. However, I ended up with package SBCK being not installed because of following error/warning InstallationWarning: package 'SBCK' is in use and will not be installed. I have no package with name SBCK installed on my system, so I do not understand why I am getting this warning message and thus not to be able to install the R package.
I know that similar question have been asked before here but solution there does not work in my case.
I am using R version 4.2.0 on Windows 10.
Once 'build.R' is run, "SBCK_0.5.0.tar.gz" is created in the 'SBCK-R' folder.
You can now install it via the package archive file option or pointing to that file in the install.packages command. I faced the same issue and this solved it.

Off-line installation of IRkernel for Jupyter/IPython notebook

I am working on an off-line Ubuntu server and I would like to write an IPython notebook with only R code. I understand that for this to work I need to install the IRkernel. This shouldn't be a problem if the server was on-line, but unfortunately this is not the case. Any suggestions how to install the IRkernel off-line are greatly appreciated.
Oliver
(I have installed Anaconda3-2.2.0-x86-64 and R 3.0.2 on the Ubuntu server)
You can use Cube to download the required Ubuntu packages (I think just zmq3) on an online computer and then install it on your offline server.
You would then need to download the needed R packages (rzmq,repr,IRkernel,IRdisplay - in tar.gz form)
To load those into your server you can use the following commands to install the R packages from source.
R CMD INSTALL package_ x.y.z.tar.gz
If you don't have permission to write to the standard library directory and can't use sudo to override, you can install it somewhere else via
R CMD INSTALL -l <user_lib> package_x.y.z.tar.gz
where <user_lib> is a directory you can write to. You may need to specify lib.loc when subsequently loading the package, if <user_lib> is not in .libPaths)
See this manual for more information; R CMD INSTALL --help may also be useful
It's a less than ideal solution but it should work assuming there aren't any dependancies I've missed.

Shiny package installation on R version 3.0.2 "Frisbee Sailing"

I need some help with installing Shiny package on the following system:
Ubuntu 12.04 64 bits
R version 3.0.2 "Frisbee Sailing"
When I try to install a Shiny package by running:
sudo su - -c "R -e \"install.packages('shiny', repos='http://cran.rstudio.com/')\""
I tried different repos or even by running install.packages('shiny') in R session as sudo, the package fails to install.
There's no errors, but rather a message that "The downloaded source packages are in '/tmp/....'
and when I try to use it (library(shiny)), I got an error that package was not found.
Now, I did not have same issue and everything worked fine on:
Ubuntu 12.04 64 bits
R version 3.0.1 "Good Sport".
Please, help me see what I am missing here.
The issues you are describing are caused by out-of-memory crashes. You are probably on a VPS like EC2 or something similar. If you are using the free micro instance on EC2 or the lowest package( 512mb ram) on digital ocean then you should enable swap (you should enable swap anyway). For EC2 see How do you add swap to an EC2 instance? . For digital ocean see https://www.digitalocean.com/community/articles/how-to-add-swap-on-ubuntu-12-04
Actually, I just tried to install a different library, ggplot2, and it is the same issue.
So, it is not related to Shiny package. All the libraries I tried to install just keep being saved to a /tmp folder as archived gz files. Not really sure why R does not install them.
So, eventually I just used R CMD INSTALL [path to the package .gz]
and it worked all right. I installed all 3 libraries in the following order: Rcpp, httpuv and the shiny. library(shiny) command now loads the library ok.

OpenCPU how to install a package in R/pub?

I'm unclear about how to install an R package under R/pub in openCPU on my own openCPU server. The openCPU documentation states that package installation is handled by the administrator, but does not give any instructions (that I can find) concerning package installation.
I'm sure I'm missing something obvious but any help with this would be appreciated.
FWIW, I'm attempting to install the ''markdown'' package, which for some reason wasn't installed when calling opencpu-cran.
UPDATE:
I found this link to an example. It calls to the following URL "/Radmin/call/opencpu.demo/install.opencpu/json", but that approach appears not to work based on this SO question. So, if that's not the way to install packages via openCPU, how is it done?
The /R/pub endpoint contains all packages in public R libraries on the system. To install a package, you could ssh into the system, start R as root sudo -i R and then simply use install.packages to install the packages to the global library.
Alternatively, you can install one of the many r-cran-* packages which are available through the ubuntu repositories or cran2deb4ubuntu launchpad, e.g:
sudo apt-get install r-cran-xml

How to specify include and lib directories when locally installing RODBC?

i am trying to install RODBC with the commadn R CMD INSTALL -l /my/local/path RODBC.tar.gz and it wont find sql.h and sqlext.h ..how do i pass the include and lib paths to this command?
I had a similar problem recently while trying to install RODBC on an instance of Centos 5.8 x64. (Instead of using R CMD install, I just did sudo R, then installed the package inside R - but I was still having the same problem).
I resolved this by installing the following packages using yum:
unixODBC
unixODBC-libs
unixODBC-devel
mysql-connector-odbc
freetds
freetds-devel
Those last two are necessary because I was interfacing with an MSSQL server, which requires TDS. Anyway, once I installed unixODBC and the libs and development package, I was able to install RODBC with no difficulty (again, using sudo R and then install.packages("RODBC").
The only other thing to do is install the correct drivers/libraries for ODBC, which is what mysql-connector-odbc is. You will need to configure unixODBC to meet your needs, but the documentation is pretty solid, so I don't think you'll have too much difficulty.

Resources