Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Not able to run R script in zeppeling

Highlighted

Not able to run R script in zeppeling

New Contributor

Dear HDP community,


I am trying to setup R interpreter. R is installed and running on host (means I can run R script in ssh session through command line) and Spark is installed through HDP/ambari platform.


This is my notebook:

%spark2.r

1 + 1

which fails like below:

org.apache.zeppelin.interpreter.InterpreterException: sparkr is not responding 
R version 3.6.0 (2019-04-26) -- "Planting of a Tree"
Copyright (C) 2019 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> #
> # Licensed to the Apache Software Foundation (ASF) under one
> # or more contributor license agreements.  See the NOTICE file
> # distributed with this work for additional information
> # regarding copyright ownership.  The ASF licenses this file
> # to you under the Apache License, Version 2.0 (the
> # "License"); you may not use this file except in compliance
> # with the License.  You may obtain a copy of the License at
> #
> #     http://www.apache.org/licenses/LICENSE-2.0
> #
> # Unless required by applicable law or agreed to in writing, software
> # distributed under the License is distributed on an "AS IS" BASIS,
> # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
> # See the License for the specific language governing permissions and
> # limitations under the License.
> #
> 
> args <- commandArgs(trailingOnly = TRUE)
> 
> hashCode <- as.integer(args[1])
> port <- as.integer(args[2])
> libPath <- args[3]
> version <- as.integer(args[4])
> timeout <- as.integer(args[5])
> authSecret <- NULL
> if (length(args) >= 6) {
+   authSecret <- args[6]
+ }
> 
> rm(args)
> 
> print(paste("Port ", toString(port)))
[1] "Port  42291"
> print(paste("LibPath ", libPath))
[1] "LibPath  /usr/hdp/3.1.0.0-78/spark2/R/lib"
> 
> .libPaths(c(file.path(libPath), .libPaths()))
> library(SparkR)

Attaching package: ‘SparkR’

The following objects are masked from ‘package:stats’:

    cov, fi> lter, lag, na.omit, predict, sd, var, window

The following objects are masked from ‘package:base’:

> 
i    as.f (is.null(authSecret)) {dat
a+. frame, colnames, colname  SparkR:::connectBackend("localhost",s <p-o,r drop, endsWith, interste,ct, ti
meout)   
 +r } else {
+   SparkR:::connectBackend("localhost", port, timeout, authSecret)a
+ }
nk, rbind, sample, startsWith, subset, summary, transform, union


    at org.apache.zeppelin.spark.ZeppelinR.waitForRScriptInitialized(ZeppelinR.java:294)
    at org.apache.zeppelin.spark.ZeppelinR.request(ZeppelinR.java:236)
    at org.apache.zeppelin.spark.ZeppelinR.eval(ZeppelinR.java:185)
    at org.apache.zeppelin.spark.ZeppelinR.open(ZeppelinR.java:174)
    at org.apache.zeppelin.spark.SparkRInterpreter.open(SparkRInterpreter.java:106)
    at org.apache.zeppelin.interpreter.LazyOpenInterpreter.open(LazyOpenInterpreter.java:69)
    at org.apache.zeppelin.interpreter.remote.RemoteInterpreterServer$InterpretJob.jobRun(RemoteInterpreterServer.java:617)
    at org.apache.zeppelin.scheduler.Job.run(Job.java:188)
    at org.apache.zeppelin.scheduler.FIFOScheduler$1.run(FIFOScheduler.java:140)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)

Any thoughts?


thank you very much

3 REPLIES 3

Re: Not able to run R script in zeppeling

Mentor

@Manuel Sopena Ballesteros

Can you share your Zeppelin R configuration steps? To run Zeppelin with the R Interpreter, the SPARK_HOME environment variable must be set.

The best way to do this is by editing conf/zeppelin-env.sh. If it is not set, the R Interpreter will not be able to interface with Spark.

HTH

Re: Not able to run R script in zeppeling

New Contributor

I installed R from sources and copied to /usr/bin

then I went to ambari and setup the zeppeling configuration below:

      export JAVA_HOME={{java64_home}}       export MASTER=yarn-client       export ZEPPELIN_LOG_DIR={{zeppelin_log_dir}}       export ZEPPELIN_PID_DIR={{zeppelin_pid_dir}}       export ZEPPELIN_INTP_CLASSPATH_OVERRIDES="{{external_dependency_conf}}"       export KINIT_FAIL_THRESHOLD=5       export KERBEROS_REFRESH_INTERVAL=1d       export HADOOP_CONF_DIR=/etc/hadoop/conf 
export SPARK_HOME=/usr/hdp/3.1.0.0-78/spark2

Hope this helps, please let me know otherwise

Re: Not able to run R script in zeppeling

Contributor

Are you still having the issue? If so, can you share your spark interpreter config?

Don't have an account?
Coming from Hortonworks? Activate your account here