Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Why using HDP2.6.5 pyspark using python2.7 and matplotlib and axes3d with Zeppelin I could'nt display a proper scatter3d graph?

Why using HDP2.6.5 pyspark using python2.7 and matplotlib and axes3d with Zeppelin I could'nt display a proper scatter3d graph?

New Contributor

I reduced the problem to a simple example, that ran out of the HDP Zeppelin using pure python2.7 and matplotlib axes3d ($python scatter.py) but does'nt ran using HDP pySpark Zeppelin? How can fix that ?

I tried using HDP Zeppelin Python3 and obtained the same error and using the python3 out the platform ran ok.

Thank in advance,

The example and the Error:

[[[

from mpl_toolkits.mplot3d import Axes3D

import matplotlib.pyplot as plt

import pandas

fig = plt.figure()

#ax = fig.add_subplot(111, projection='3d')

ax=Axes3D(fig)

x =[1,2,3,4,5,6,7,8,9,10,11,12,4]

y =[5,6,2,3,13,4,1,2,4,8,15,12,3]

z =[2,3,3,3,5,7,9,11,9,10,1,11,1]

ax.scatter(x, y, z, c='r', marker='o')

ax.set_xlabel('X Label')

ax.set_ylabel('Y Label')

ax.set_zlabel('Z Label')

plt.show()

]]]

Using HDP pySpark and zepellin i obtain the following error:

Traceback (most recent call last): File "/tmp/zeppelin_pyspark-3831492368081038681.py", line 367, in <module> raise Exception(traceback.format_exc()) Exception: Traceback (most recent call last): File "/tmp/zeppelin_pyspark-3831492368081038681.py", line 355, in <module> exec(code, _zcUserQueryNameSpace) File "<stdin>", line 9, in <module> File "/usr/lib64/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.py", line 2362, in scatter xs, ys, s=s, c=c, *args, **kwargs) File "/usr/lib64/python2.7/site-packages/matplotlib/__init__.py", line 1867, in inner return func(ax, *args, **kwargs) File "/usr/lib64/python2.7/site-packages/matplotlib/axes/_axes.py", line 4363, in scatter self.add_collection(collection) File "/usr/lib64/python2.7/site-packages/matplotlib/axes/_base.py", line 1922, in add_collection collection.set_clip_path(self.patch) File "/usr/lib64/python2.7/site-packages/matplotlib/artist.py", line 702, in set_clip_path self.stale = True

...

File "/usr/lib64/python2.7/site-packages/matplotlib/pyplot.py", line 577, in _auto_draw_if_interactive fig.canvas.draw_idle() File "/usr/hdp/current/zeppelin-server/interpreter/lib/python/backend_zinline.py", line 132, in draw_idle self.draw(*args, **kwargs) File "/usr/lib64/python2.7/site-packages/matplotlib/backends/backend_agg.py", line 437, in draw self.figure.draw(self.renderer) File "/usr/lib64/python2.7/site-packages/matplotlib/artist.py", line 55, in draw_wrapper return draw(artist, renderer, *args, **kwargs) File "/usr/lib64/python2.7/site-packages/matplotlib/figure.py", line 1493, in draw renderer, self, artists, self.suppressComposite) File "/usr/lib64/python2.7/site-packages/matplotlib/image.py", line 141, in _draw_list_compositing_images a.draw(renderer) File "/usr/lib64/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.py", line 281, in draw reverse=True)): File "/usr/lib64/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.py", line 280, in <lambda> key=lambda col: col.do_3d_projection(renderer), AttributeError: 'PathCollection' object has no attribute 'do_3d_projection'

2 REPLIES 2
Highlighted

Re: Why using HDP2.6.5 pyspark using python2.7 and matplotlib and axes3d with Zeppelin I could'nt display a proper scatter3d graph?

@jose mendez Please make sure you have the following configuration:

https://community.hortonworks.com/articles/194077/how-to-configure-zeppelin-pyspark-interpreter-to-u...

HTH

*** If you found this answer addressed your question, please take a moment to login and click the "accept" link on the answer.

Re: Why using HDP2.6.5 pyspark using python2.7 and matplotlib and axes3d with Zeppelin I could'nt display a proper scatter3d graph?

New Contributor

Dear,

I'm using the default python (python 2.7), but anyway I added the two new properties to my Zeppelin spark configuration and the problem was the same:

Traceback (most recent call last): File "/tmp/zeppelin_pyspark-9191856517467851415.py", line 367, in <module> raise Exception(traceback.format_exc()) Exception: Traceback (most recent call last): File "/tmp/zeppelin_pyspark-9191856517467851415.py", line 355, in <module> exec(code, _zcUserQueryNameSpace) File "<stdin>", line 11, in <module> File "/usr/lib64/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.py", line 2362, in scatter xs, ys, s=s, c=c, *args, **kwargs) File "/usr/lib64/python2.7/site-packages/matplotlib/__init__.py", line 1867, in inner return func(ax, *args, **kwargs) File "/usr/lib64/python2.7/site-packages/matplotlib/axes/_axes.py", line 4363, in scatter self.add_collection(collection) File "/usr/lib64/python2.7/site-packages/matplotlib/axes/_base.py", line 1922, in add_collection collection.set_clip_path(self.patch) File "/usr/lib64/python2.7/site-packages/matplotlib/artist.py", line 702, in set_clip_path self.stale = True File "/usr/lib64/python2.7/site-packages/matplotlib/artist.py", line 241, in stale self.stale_callback(self, val) File "/usr/lib64/python2.7/site-packages/matplotlib/artist.py", line 68, in _stale_axes_callback self.axes.stale = val File "/usr/lib64/python2.7/site-packages/matplotlib/artist.py", line 241, in stale self.stale_callback(self, val) File "/usr/lib64/python2.7/site-packages/matplotlib/figure.py", line 60, in _stale_figure_callback self.figure.stale = val File "/usr/lib64/python2.7/site-packages/matplotlib/artist.py", line 241, in stale self.stale_callback(self, val) File "/usr/lib64/python2.7/site-packages/matplotlib/pyplot.py", line 577, in _auto_draw_if_interactive fig.canvas.draw_idle() File "/usr/hdp/current/zeppelin-server/interpreter/lib/python/backend_zinline.py", line 132, in draw_idle self.draw(*args, **kwargs) File "/usr/lib64/python2.7/site-packages/matplotlib/backends/backend_agg.py", line 437, in draw self.figure.draw(self.renderer) File "/usr/lib64/python2.7/site-packages/matplotlib/artist.py", line 55, in draw_wrapper return draw(artist, renderer, *args, **kwargs) File "/usr/lib64/python2.7/site-packages/matplotlib/figure.py", line 1493, in draw renderer, self, artists, self.suppressComposite) File "/usr/lib64/python2.7/site-packages/matplotlib/image.py", line 141, in _draw_list_compositing_images a.draw(renderer) File "/usr/lib64/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.py", line 281, in draw reverse=True)): File "/usr/lib64/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.py", line 280, in <lambda> key=lambda col: col.do_3d_projection(renderer), AttributeError: 'PathCollection' object has no attribute 'do_3d_projection' READY

As I told and in order to clarify, How python2.7 didn't work i tries to change to python 3.7 but was the same and I returned to the original and default configuration.

Is there other possible solution ?

Regards,

Jose Miguel