Search code examples
scalaapache-sparkjupyter-notebookamazon-emr

Adding external jars in EMR Notebooks


I use EMR Notebook connected to EMR cluster. Kernel is Spark and language is Scala. I need some jars that are located in S3 bucket. How can I add jars?

In case of 'spark-shell' it's easy:

spark-shell --jars "s3://some/path/file.jar, s3://some/path/faile2.jar"

Also in scala console I can do

:require s3://some/path/file.jar


Solution

  • After you start the notebook, you can do this in a cell:

    %%configure -f
    {
    "conf": {"spark.jars.packages": "com.jsuereth:scala-arm_2.11:2.0,ml.combust.bundle:bundle-ml_2.11:0.13.0,com.databricks:dbutils-api_2.11:0.0.3"},
    
    "jars": [
            "//path to external downloaded jars"
        ],
    
    }