Using mqtt with pyspark streaming
<p>I'm new to spark and mqtt. I'm trying to with the code using MQTTUtils that I got online named wordcount.py</p>

<pre><code>import sys

from pyspark import SparkContext
from pyspark.streaming import StreamingContext
from pyspark.streaming.mqtt import MQTTUtils
if __name__ == "__main__":
    if len(sys.argv) != 3:
        print &gt;&gt; sys.stderr, "Usage: mqtt_wordcount.py &lt;broker url&gt; &lt;topic&gt;"
        exit(-1)

    sc = SparkContext(appName="PythonStreamingMQTTWordCount")
    ssc = StreamingContext(sc, 1)

    brokerUrl = sys.argv[1]
    topic = sys.argv[2]

    lines = MQTTUtils.createStream(ssc, brokerUrl, topic)
    counts = lines.flatMap(lambda line: line.split(" ")) \
        .map(lambda word: (word, 1)) \
        .reduceByKey(lambda a, b: a+b)
    counts.pprint()

    ssc.start()
    ssc.awaitTermination()
</code></pre>

<p>and I followed the instruction to installed the mosquitto broker(it's working) ,download the spark-streaming-mqtt-assembly_2.11-1.6.2.jar and run the python script with this command:
~$ spark-submit --jars spark-streaming-mqtt-assembly_*.jar wordcount.py</p>

<p>but the error shown: </p>

<p>from pyspark.streaming.mqtt import MQTTUtils</p>

<p>ImportError: No module named mqtt</p>

<p>Is that I missed out anything from here? 
Thank you</p>