SparkMagic is a Jupyter/IPython magic command extension for interactively working with Spark clusters via Livy (REST API). It supports multiple sessions, language interpreters (PySpark, Spark, Scala, SQL), and automatic visualization of DataFrames. Current version is 0.23.0 (released 2025-02-14) with active but low-frequency releases; the project is in maintenance mode.
pip install sparkmagicVerified import paths — ran on the pinned version, not inferred.
Load the extension, manage Spark sessions, and execute code against a remote Spark cluster via Livy.
Update any custom code to handle async execution; test with simple cells first.
Upgrade Python to 3.7+.
Ensure Livy is installed and running, and configure the endpoint via %manage_spark or config file.
Install the JupyterLab extension: `jupyter labextension install jupyterlab-sparkmagic`
Run `pip install sparkmagic` in the terminal and restart the kernel.
Use `%load_ext sparkmagic` in a notebook cell instead of a Python import.
Check your Livy URL and ensure the Livy server is running. Use `%manage_spark` to set the endpoint.