deployment of shiny app fails due to cmake - r

I have a shiny app that uses nloptr , which in turns needs cmake. I installed it locally and everything works, when I try to publish it to an private rsconnect server, it fails with the following error:
[Connect] 2022/12/06 14:24:08.680333733 CMake was not found on the PATH. Please install CMake: ...
So it is clear that the compiler is missing, is there any solution besides asking the server admin to install cmake or a way for R to install it?

Related

packrat init in an existing project does not initialise

I have a working project on Rstudio Server and I want to freeze all packages into the actual working versions to avoid future issues due to global library updates.
So I run
> packrat::init()
Initializing packrat project in directory: - "~/R/statistics"
After a while all packages are downloaded and installed with no apparent issue. So I run a command to get status:
packrat::status()
and I get:
Error: This project has not yet been packified. Run 'packrat::init()' to init packrat.
Restarted R session, Rstudio and even server, but to no avail. Same message no matter I insisted. Maybe this is not the correct procedure to add packrat to an existing project but packrat documentation is not very complete.
Rstudio Server version 1.1.456
R version : 3.4.4

R Shiny - Error: there is no package called ‘shinyjs’

My app works perfectly when I run it locally, but when I host it in shinyapps.io this error comes out:
An error has occurred
The application failed to start.
Error in value[3L] : there is no package called ‘shinyjs’
Calls: local ... tryCatch -> tryCatchList -> tryCatchOne -> Anonymous
I have two more apps online with the same ui.R and server.R layouts and both work fine. Even if I avoid the code involving shinyjs, it shows the app in the browser but the same error appears in the app log with the package openxlsx. The other two almost-identical apps working perfect got me completely lost.
In my experience, the issue happens in RStudio projects with a DESCRIPTION file, when the offending package (e.g. shinyjs) is NOT included in the Imports section of the DESCRIPTION file.
I know this answer is late but in case is useful, here it is:
1.- Open a terminal and run: sudo R
2.- I installed shinyjs: install.packages("shinyjs", dependencies=TRUE)
3.- Create shinyjs directory: mkdir /usr/local/lib/R/site-library/shinyjs
4.- cd /usr/local/lib/R/site-library/shinyjs
4.- copy the shinyjs folder from the active username home R directory:
cp /home/username/R/x86_64-pc-linux-gnu-library/3.5/shinyjs/* -r .
Go to your web browsers and it will open your app.
Note. Be sure to change username for correct value and remember to set the privileges.
When you deploy your app on shinyapps.io the serve has to understand where the packages were installed from. The two most common sources of package installations probably are:
CRAN
Github
Looking at the documentation you see that Github packages must be installed with devtools. I have had the same issue you face because I had packages installed with remotes or pak, simply reinstall the packages locally you need using either install.packages for CRAN versions and devtools for dev versions and re-deploy:
install.packages("openxlsx")
# install.packages("devtools")
devtools::install_github("daattali/shinyjs")

Installing R on Apache Zeppelin

I'm trying to install Apache Zeppelin on my old computer that runs Ubuntu. So far, I'm able to install Zeppelin very easily by cloning the latest 0.6.0 snapshot release using
git clone https://github.com/apache/incubator-zeppelin.git
cd incubator-zeppelin
mvn clean package -DskipTests
but I want to have R on Zeppelin. Supposedly, the 0.6.0 snapshot has two R interpreters, but when I run the R tutorial (the pre-made note that uses %r), I get this list of errors.
I followed several guides to try and install R as an interpreter, but each one resulted in some kind of error. I tried this instructional:
http://www.r-bloggers.com/interactive-data-science-with-r-in-apache-zeppelin-notebook/, and got a build failure on "R Interpreter". The error message was
"dependency 'evaluate' is not available for package 'rzeppelin'
* removing '/home/rebecca/Zeppelin-With-R/R/lib/rzeppelin'"
and then a bit lower down
Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec (default) on project zeppelin-zrinterpreter: Command execution failed. Process exited with an error: 1
I also tried this Stack Overflow guide: Anyone tried to add R interpreter onto Apache Zeppelin?, and while I was able to run incubator-zeppelin, I received an error when I used either the %spark.r or %r interpreter tags, saying both "interpreter not found" and "prefix not found". Spark doesn't work either after following the first solution, getting the same error mentioned in the second solution (the jar file not being there), and then trying the second solution.
Does anyone have a guide for installing R onto the newest version of Zeppelin? I'm very flexible in the way I can install it. I can run other operating systems onto my computer, and I also have Virtual Box installed on my other computer, which is a mac.
There is currently a bug in the latest HEAD of zeppelin that was recently introduced and prevents the R interpreter from launching cleanly
Did anyone created a Zeppelin Jira Issue for that?
For me it is working on Zeppelin branch-0.6
build Zeppelin with r profile: -DskipTests -Prthis will...
create a directory 'R' in git repo root
copy the 'zeppelin-rinterpreter*.jar' into git_repo_root/interpreter/spark
build Zeppelin with build distro profile: e.g. -DskipTests -Pbuild-distr -Pspark-1.6 -Phadoop-2.6
use zeppelin-distribution/target/zeppelin*.tar.gz for installation
ensure both 1.1 and 1.2 are present in your zeppelin installation
The error you're getting is that you need to have the R package evaluate installed. You can install this simply by launching R and typing install.packages('evaluate').
That said, your excerpt mentions the directory Zeppelin-with-R. That's my repo, which is the R interpreter in the form when it was accepted into Zeppelin. That is version 0.5.6, not 0.6.0. There is currently a bug in the latest HEAD of zeppelin that was recently introduced and prevents the R interpreter from launching cleanly. Your best bet for now is to use the one from my repo and install clean, without trying to pull-in from Zeppelin HEAD.

QtWebKit gstreamer1.0 not found

I want to compile PhantomJS with gstreamer. I downloaded the source code and started the build process with
./build.sh --qmake-args WEBKIT_CONFIG+='use_gstreamer'
I get the following Error
Project ERROR: gstreamer-1.0 development package not found
I have an debian 8.0 system with installed libgstreamer1.0 and glib2.0 (installed with apt-get).
Can someone help me?
If you haven't installed them, you'll need the development packages as well which should be something like libgstreamer(X.X.X)-dev, where X.X.X is whichever version of gstreamer you have installed. The development package has the necessary header files required for compilation.
you may need to modify the build script to add "{GStreamerInstallDir}/1.0/{architecture}/lib/pkgconfig" to the CMAKE_MODULE_PATH configuration so cmake can find the package.
Not sure how to do this in your environment as I build on a windows OS where I just specify this using an environment variable from a wrapping batch script.

R studio failing to use rJava lib and failing javareconf

I'm running Rstudio on its own server.
Java is installed with good java_home and bin.
R is installed. rJava is installed.
Tried to do command: library("rJava") but had issues with libjvm.so, do following Rstudio recommandation I did sudo R CMD javareconf with root.
Here is the output of my javareconf:
Java interpreter : /home/scoremd/jdk1.7.0_03/jre/bin/java
Java version : 1.7.0_03
Java home path : /home/scoremd/jdk1.7.0_03
Java compiler : /home/scoremd/jdk1.7.0_03/bin/javac
Java headers gen.: /home/scoremd/jdk1.7.0_03/bin/javah
Java archive tool: /home/scoremd/jdk1.7.0_03/bin/jar
NOTE: Your JVM has a bogus java.library.path system property!
Trying a heuristic via sun.boot.library.path to find jvm library...
Java library path: $(JAVA_HOME)/jre/lib/amd64:$(JAVA_HOME)/jre/lib/amd64/server
JNI linker flags : -L$(JAVA_HOME)/jre/lib/amd64 -L$(JAVA_HOME)/jre/lib/amd64/server -ljvm
JNI cpp flags : -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux
Seems there is issue with finding the java library path... but my java is working fine and R also.
I didn't receive any solution from RStudio support and community (told me to ask in SO ....).
I have rstudio-server installed on my Centos server. There are a couple of users using rstudio and we decided to upgrade R from 3.6 to 4.0.
After the upgrade :
all users were running R 4.0.
No user could install rJava using install.package('rJava'). This error always popped up
configure: error: Cannot compile a simple JNI program. See config.log for details.
Make sure you have Java Development Kit installed and correctly registered in R.
If in doubt, re-run "R CMD javareconf" as root.
ERROR: configuration failed for package ‘rJava’
Running SUDO R CMD javareconf went smoothly, and also when I opened R as root and went along and tried install.packages('rJava') it installed the package just fine. (unbeknownst to me, root ran R 3.6 and users 4.0, see solution below)
However it did not work installing the package for users in R studio server. Always stating the same "try running sudo R CMD javareconf" as if the Java path for the users was wrong.
so we tried setting the "JAVA_HOME" variable to the same path that java jdk was installed in (found by searching installed packages in yum). That did not solve it.
my solution
I saw that root was running version 3.6 of R while all users ran 4.0. This was because I had installed 4.0 in another directory.. The directory of R 4.0 happens to be found first by the users. However for the root user... it finds the path of R 3.6 first.
So I set the path to the 4.0 folder in the $PATH variable of the root user, so that would find version 4.0 before finding R 3.6
echo $PATH
export PATH="/usr/local/bin:$PATH"
echo $PATH
Then I ran R as that user and ran "R CMD javareconf", installed the packages and all users are happy and working again.
(disclaimer, I'm not a experienced linux admin, there may be a better solution for running different R versions)
It's been some time since I used rJava, and it was on Windows, but I have some notes which may help you:
Make sure that the JRI native library is in a directory listed in java.library.path
(also confirmed using Process Explorer that jri.dll is being loaded)
The R process loads up jvm.dll when you do library(rJava)
Replace jvm.dll iny my notes above with libjvm.so in your case, and jri.dll with whatever .so file is relevant to you.

Resources