title: Failed to find data source: com.microsoft.kusto.spark.datasource
body: <p>I tried to run the following sample code of reading kusto data from spark notebook. (The sample code is from the link: <a href="https://github.com/Azure/azure-kusto-spark/blob/dev/samples/src/main/scala/pyKusto.py" rel="nofollow noreferrer">https://github.com/Azure/azure-kusto-spark/blob/dev/samples/src/main/scala/pyKusto.py</a>)</p>
  
  <pre><code>from pyspark.sql import SparkSession    
  pyKusto = SparkSession.builder.appName("kustoPySpark").getOrCreate()    
  kustoOptions = {"kustoCluster":"&lt;cluster-name&gt;", "kustoDatabase" : "&lt;database-name&gt;", "kustoTable" : "&lt;table-name&gt;", "kustoAADClientID":"&lt;AAD-app id&gt;" ,"kustoClientAADClientPassword":"&lt;AAD-app key&gt;", "kustoAADAuthorityID":"&lt;AAD authentication authority&gt;"}    
  # Read the data from the kusto table in 'lean' mode
  kustoDf  = pyKusto.read. \    
              format("com.microsoft.kusto.spark.datasource"). \
              option("kustoCluster", kustoOptions["kustoCluster"]). \
              option("kustoDatabase", kustoOptions["kustoDatabase"]). \
              option("kustoQuery", kustoOptions["kustoTable"]). \
              option("kustoAADClientID", kustoOptions["kustoAADClientID"]). \
              option("kustoClientAADClientPassword", kustoOptions["kustoClientAADClientPassword"]). \
              option("kustoAADAuthorityID", kustoOptions["kustoAADAuthorityID"]). \
              option("readMode", "lean"). \
              load()
  </code></pre>
  
  <p>It throws the following exceptions, ClassNotFoundException: Failed to find data source: com.microsoft.kusto.spark.datasource.</p>
  
  <p>Anyone knows how to fix these?</p>
  
  <pre><code>An error occurred while calling o97.load.
  : java.lang.ClassNotFoundException: Failed to find data source: com.microsoft.kusto.spark.datasource. Please find packages at http://spark.apache.org/third-party-projects.html
      at org.apache.spark.sql.execution.datasources.DataSource$.lookupDataSource(DataSource.scala:639)
      at org.apache.spark.sql.DataFrameReader.load(DataFrameReader.scala:190)
      at org.apache.spark.sql.DataFrameReader.load(DataFrameReader.scala:164)
      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)
  Caused by: java.lang.ClassNotFoundException: com.microsoft.kusto.spark.datasource.DefaultSource
      at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
      at org.apache.spark.sql.execution.datasources.DataSource$$anonfun$23$$anonfun$apply$15.apply(DataSource.scala:622)
      at org.apache.spark.sql.execution.datasources.DataSource$$anonfun$23$$anonfun$apply$15.apply(DataSource.scala:622)
      at scala.util.Try$.apply(Try.scala:192)
      at org.apache.spark.sql.execution.datasources.DataSource$$anonfun$23.apply(DataSource.scala:622)
      at org.apache.spark.sql.execution.datasources.DataSource$$anonfun$23.apply(DataSource.scala:622)
      at scala.util.Try.orElse(Try.scala:84)
      at org.apache.spark.sql.execution.datasources.DataSource$.lookupDataSource(DataSource.scala:622)
      ... 13 more
  
  Traceback (most recent call last):
    File "/usr/hdp/current/spark2-client/python/pyspark/sql/readwriter.py", line 172, in load
      return self._df(self._jreader.load())
    File "/usr/hdp/current/spark2-client/python/lib/py4j-0.10.7-src.zip/py4j/java_gateway.py", line 1257, in __call__
      answer, self.gateway_client, self.target_id, self.name)
    File "/usr/hdp/current/spark2-client/python/pyspark/sql/utils.py", line 63, in deco
      return f(*a, **kw)
    File "/usr/hdp/current/spark2-client/python/lib/py4j-0.10.7-src.zip/py4j/protocol.py", line 328, in get_return_value
      format(target_id, ".", name), value)
  py4j.protocol.Py4JJavaError: An error occurred while calling o97.load.
  : java.lang.ClassNotFoundException: Failed to find data source: com.microsoft.kusto.spark.datasource. Please find packages at http://spark.apache.org/third-party-projects.html
      at org.apache.spark.sql.execution.datasources.DataSource$.lookupDataSource(DataSource.scala:639)
      at org.apache.spark.sql.DataFrameReader.load(DataFrameReader.scala:190)
      at org.apache.spark.sql.DataFrameReader.load(DataFrameReader.scala:164)
      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)
  Caused by: java.lang.ClassNotFoundException: com.microsoft.kusto.spark.datasource.DefaultSource
      at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
      at org.apache.spark.sql.execution.datasources.DataSource$$anonfun$23$$anonfun$apply$15.apply(DataSource.scala:622)
      at org.apache.spark.sql.execution.datasources.DataSource$$anonfun$23$$anonfun$apply$15.apply(DataSource.scala:622)
      at scala.util.Try$.apply(Try.scala:192)
      at org.apache.spark.sql.execution.datasources.DataSource$$anonfun$23.apply(DataSource.scala:622)
      at org.apache.spark.sql.execution.datasources.DataSource$$anonfun$23.apply(DataSource.scala:622)
      at scala.util.Try.orElse(Try.scala:84)
      at org.apache.spark.sql.execution.datasources.DataSource$.lookupDataSource(DataSource.scala:622)
      ... 13 more
  </code></pre>