Thank you for replying, Sean. error is as follows: Py4JJavaError: An error occurred while calling o49.load. : org.apache.spark.sql.AnalysisException: Failed to find data source: kafka. Please deploy the application as per the deployment section of "Structured Streaming + Kafka Integration Guide".; at org.apache.spark.sql.execution.datasources.DataSource$.lookupDataSource(DataSource.scala:652) at org.apache.spark.sql.streaming.DataStreamReader.load(DataStreamReader.scala:161) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at py4j.reflection.MethodInvoker.invoke(MethodInvoker.java:244) at py4j.reflection.ReflectionEngine.invoke(ReflectionEngine.java:357) at py4j.Gateway.invoke(Gateway.java:282) at py4j.commands.AbstractCommand.invokeMethod(AbstractCommand.java:132) at py4j.commands.CallCommand.execute(CallCommand.java:79) at py4j.GatewayConnection.run(GatewayConnection.java:238) at java.lang.Thread.run(Thread.java:748)
Below is the code from pyspark.sql import SparkSession spark = SparkSession.builder.appName("Test").getOrCreate() df = spark.readStream.format("kafka").option("kafka.bootstrap.servers", “myserver:9092").option("subscribe", “my_topic").load() By the way, I have the same Scala code is running with spark-shell by adding "--packages org.apache.spark:spark-sql-kafka-0-10_2.11:2.4.0” Thank you On Fri, Dec 28, 2018 at 12:44 PM Sean Owen <sro...@gmail.com> wrote: > Nothing here says what problem you ran into? > > On Fri, Dec 28, 2018 at 2:41 PM Haibo Yan <tristan....@gmail.com> wrote: > > > > Dear spark dev > > I am trying to run IPython notebook with Kafka structured streaming > support, I couldn't find a way to load Kafka package by adding "--packages > org.apache.spark:spark-sql-kafka-0-10_2.11:2.4.0" to > PYSPARK_DRIVER_PYTHON_OPTS or even I changed my local pyspark script to > "exec "${SPARK_HOME}"/bin/spark-submit --packages > org.apache.spark:spark-sql-kafka-0-10_2.11:2.4.0 pyspark-shell-main --name > "PySparkShell" "$@"". Could anyone here point out the correct way to add > support for Kafka streaming for python notebook. > > > > Much appreciated. > > > > Haibo >