Amazon EMR cluster matplotlib error

感情迁移 提交于 2019-12-13 12:28:38

问题


I'm using an AWS cluster EMR 5.3.1 with Hadoop + Spark + Hive + Zeppelin

When I use Zeppelin and type command:

%python
import matplotlib.pyplot as plt
plt.plot([1, 2, 3])

I get error:

ImportError: Gtk3 backend requires pygobject to be installed.

How to solve it?


回答1:


Before importing pyplot module you need to change matplotlib's backend to Agg

import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
plt.plot([1,2,3])


来源:https://stackoverflow.com/questions/42481911/amazon-emr-cluster-matplotlib-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!