我想寻求与Anaconda Jupyter笔记本相关的帮助。我想在Jupyter笔记本中编写PySpark和SparkR,然后按照在线教程进行讲解,该教程指导如何与Jupyter笔记本一起安装Apache Toree。

我正在使用Cloudera Manager包裹来管理我的kerberized Hadoop集群。

但是,我无法通过服务器日志中的以下错误打开Apache Toree PySpark的内核。

[I 15:24:50.529 NotebookApp] Creating new notebook in
[I 15:24:52.079 NotebookApp] Kernel started: 8cb4838c-2171-4672-96a4-b21ef191ffc6
Starting Spark Kernel with SPARK_HOME=/opt/cloudera/parcels/CDH/lib/spark
WARNING: User-defined SPARK_HOME (/opt/cloudera/parcels/CDH-5.9.0-1.cdh5.9.0.p2024.2115/lib/spark) overrides detected (/opt/cloudera/parcels/CDH/lib/spark).
WARNING: Running spark-class from user-defined location.
Exception in thread "main" java.lang.NoSuchMethodError: joptsimple.OptionParser.acceptsAll(Ljava/util/Collection;Ljava/lang/String;)Ljoptsimple/OptionSpecBuilder;
    at org.apache.toree.boot.CommandLineOptions.<init>(CommandLineOptions.scala:37)
    at org.apache.toree.Main$delayedInit$body.apply(Main.scala:25)
    at scala.Function0$class.apply$mcV$sp(Function0.scala:40)
    at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12)
    at scala.App$$anonfun$main$1.apply(App.scala:71)
    at scala.App$$anonfun$main$1.apply(App.scala:71)
    at scala.collection.immutable.List.foreach(List.scala:318)
    at scala.collection.generic.TraversableForwarder$class.foreach(TraversableForwarder.scala:32)
    at scala.App$class.main(App.scala:71)
    at org.apache.toree.Main$.main(Main.scala:24)
    at org.apache.toree.Main.main(Main.scala)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.apache.spark.deploy.SparkSubmit$.org$apache$spark$deploy$SparkSubmit$$runMain(SparkSubmit.scala:731)
    at org.apache.spark.deploy.SparkSubmit$.doRunMain$1(SparkSubmit.scala:181)
    at org.apache.spark.deploy.SparkSubmit$.submit(SparkSubmit.scala:206)
    at org.apache.spark.deploy.SparkSubmit$.main(SparkSubmit.scala:121)
    at org.apache.spark.deploy.SparkSubmit.main(SparkSubmit.scala)

我将jopt-simple-4.5.jar放在Toree lib和Spark主页中。我必须在哪里放置 jar ,以便在尝试创建新笔记本时可以找到 jar ?谢谢。

最好的祝福,
鲁卡

最佳答案

我找到的最简单的解决方案是在spark-submit中添加以下选项:

--conf "spark.driver.extraClassPath=/usr/local/share/jupyter/kernels/apache_toree_scala/lib/toree-assembly-0.1.0-incubating.jar" --conf "spark.executor.extraClassPath=/usr/local/share/jupyter/kernels/apache_toree_scala/lib/toree-assembly-0.1.0-incubating.jar"

可以将其添加到__TOREE_SPARK_OPTS__文件的/usr/local/share/jupyter/kernels/apache_toree_scala/kernel.json变量中,也可以直接添加到/usr/local/share/jupyter/kernels/apache_toree_scala/bin/run.sh文件中的bash命令中。

通过添加此项,您可以强制类加载器从Toree JAR而不是从默认的CDH库加载joptsimple.OptionParser

P. S.这是与CDH 5.10.0兼容的Toree版本:https://github.com/Myllyenko/incubator-toree/releases

关于hadoop - 带有Anaconda Jupyter笔记本的Apache Toree,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/42898590/

10-11 07:34