使用AWS-EMR jupyter笔记本进行Matplotlib绘图 [英] Matplotlib Plotting using AWS-EMR jupyter notebook

查看:163
本文介绍了使用AWS-EMR jupyter笔记本进行Matplotlib绘图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在AWS-EMR实例的jupyter笔记本中使用Matplotlib绘制数据。 Matplotlib必须在实例启动时通过引导操作安装,我已经成功完成了该操作。我还以这种方式成功安装了Pandas(并将其用于笔记本中的各种操作)。典型的%matplotlib内联不起作用。 (实际上,似乎没有魔术命令可在AWS-EMR笔记本上运行。我怀疑AWS禁用了这些命令,或者与笔记本无服务器有关。)

I am attempting to plot data using Matplotlib within a jupyter notebook on an AWS-EMR instance. Matplotlib must be installed via a bootstrap action at instance start-up, which I have done successfully. I have also successfully installed Pandas in this way (and used it for various things in my notebook). The typical %matplotlib inline does not work. (In fact, it appears that NO magic commands work on AWS-EMR notebooks. I suspect AWS has disabled these or it has something to do with the notebooks being "serverless.")

我尝试过:


  • 安装matplotlib == 2.0.2并使用魔术命令% matplotlib内联(如上所述,魔术命令似乎根本不起作用)

  • installing matplotlib==2.0.2 and using magic command %matplotlib inline (as mentioned above, magic commands seem not to work at all)

安装matplotlib == 1.5,安装ipympl,并使用 import ipympl 。尝试 .show()绘图时,使用此方法不会收到错误,但也不会显示任何绘图。该单元格在笔记本中运行,没有显示任何图。据我所知, .show()什么都不做。

installing matplotlib==1.5, installing ipympl, and using import ipympl. I don't receive errors using this method when trying to .show() a plot, but neither does a plot show up. The cell runs in the notebook with no plot appearing. As far as I can tell, .show() does nothing.

推荐答案

编辑:



检查Parag Chaudhari在火花模式下作图的答案。

Check Parag Chaudhari's answer for plotting in spark mode.

已在发行标签上测试:emr-5.21.0

Tested on release label:emr-5.21.0

没有%matplotlib 魔术。键入 %% help 查看所有支持的魔法。

There is no %matplotlib magic in spark magic kernel in EMR notebook. Type %%help to see all supported magics.

pyspark 内核通过Livy将REST请求发送到远程EMR集群。因此,在Spark群集上绘制工作没有多大意义。使用 pyspark 内核以分布式方式进行数据处理,然后以 %% local 模式执行绘图工作。

pyspark kernel send REST requests to remote EMR cluster via Livy. So plotting work on spark cluster doesn't make much sense. Do data processing using pyspark kernel in a distributed way and then perform plot work in %%local mode.

尝试使用 %% local 启动单元格,然后运行代码

Try to start the cell with %%local and then run your code

%%local 
%matplotlib inline
<some code to plot charts>

这篇关于使用AWS-EMR jupyter笔记本进行Matplotlib绘图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆