How to use IPython in Apache Zeppelin Notebook
Tags: apachezeppelin, ipython, python, notebook
Published: 2021-07-10 07:51:32

Apache Zeppelin Notebook is web-based notebook that enables data-driven, interactive data analytics and collaborative documents with SQL, Scala, Python and more.

In this post, I will talk about how to use IPython in Apache Zeppelin Notebook (Although Zeppelin support vanilla Python, it is strongly recommended to use IPython). This would make the Python development experience in Zeppelin notebook almost the same as Jupyter notebook. 

All the contents in this notebook can be found in these 2 example notebook.

* [IPython Basic Tutorial](http://zeppelin-notebook.com/#/notebook/2EYDJKFFY)
* [IPython Visualization Tutorial](http://zeppelin-notebook.com/#/notebook/2F1S9ZY8Z)

## How to configure

Enable IPython in Zeppelin is pretty straightforward, first you need to install the following 3 python packages

```
pip install jupyter
pip install grpcio
pip install protobuf
```

Besides manually installing these packages, you can also use conda to create a customized python environment which has these installed. You can check this post for more details.

Then configure Python Interpreter，the most important configuration is zeppelin.python which need to point to the correct python executable in case you have multiple python installed in your machine.

![IPython Config](https://miro.medium.com/max/1400/1*0j2LwKBOi-pSlKHrf7a0XA.png)

## IPython Features

Now, you can experience almost the same python development experience as Jupyter notebook. Here’s a list of feature that I’d like to highlight.

* Support ipython magic function
* Better code completion
* Rich visualization libraries support

### IPython magic function
![Magic function](https://miro.medium.com/max/1400/1*xqSuHG09u4pL7kp2VDIjJQ.png)

### Code completion

![Code completion](https://miro.medium.com/max/1400/0*F9ArQnKQ11wkQQWx.gif)

### Rich visualization libraries support

Visualization libraries are a big family of python ecosystem. Like jupyter notebook, you can use most of the popular python visualization libraries in Zeppelin notebook.

Here’re a list of examples of how to use popular python visualization libraries in Zeppelin:
* Matplotlib
* Pandas
* Seaborn
* Plotnine
* Bokeh
* Holoviews
* Altair

![Matplotlib](https://miro.medium.com/max/1400/1*y7eDPkuhnifoeI-EKLQ1Gw.png)

![Pandas](https://miro.medium.com/max/1400/1*oK7m8fK0XOEFkudju9Qtsg.png)

![Seaborn](https://miro.medium.com/max/1400/1*RztBq4Svc_zb9iBP0S_SIg.png)

![Plotnine](https://miro.medium.com/max/1400/1*tGdVKQF_NX-w0DvX-JSzGA.png)

![Bokeh](https://miro.medium.com/max/1400/1*9zinRcwcKseFrhzGIQxBxQ.png)

![Holoviews](https://miro.medium.com/max/1400/1*Sn0XaBOURKIEEDNE9DtQWw.png)

![Altair](https://miro.medium.com/max/1400/1*rLJLq4tWRv1ICGK5ugHGqA.png)

## Summary

This is just a brief introduction of how to use IPython in Zeppelin notebook. If you have any question, you can ask in zeppelin user mail list or slack channel (http://zeppelin.apache.org/community.html)


## References

* [Apache Zeppelin](http://zeppelin.apache.org/)
* [Flink on Zeppelin gitbook](https://zjffdu.gitbook.io/flink-on-zeppelin/)
* [Zeppelin notebooks website](http://zeppelin-notebook.com/)
* [Zeppelin notebooks git repo]( https://github.com/zjffdu/zeppelin-notebook)