plot.plot() issue...unexpected keyword argument 'verts'

Asked by Kevin Kuei

Hello,

I'm running Ubuntu 20.04. I seem to be running into a similar plotting error as documented in this previous thread:
https://answers.launchpad.net/yade/+question/703685

I have tried the suggestions from the thread of uninstalling and reinstalling matplotlib version 3.1.2, as well as trying on yadedaily. Both seem to produce different errors.

Can anyone help with suggestions for fixing this issue? Example code and output below. Cheers,

Kevin

The example code/script I am running:
```
from yade import pack, plot

O.bodies.append(geom.facetBox((.5, .5, .5), (.5, .5, .5), wallMask=31))
sp = pack.SpherePack()
sp.makeCloud((0, 0, 0), (1, 1, 1), rMean=.05, rRelFuzz=.5)
sp.toSimulation()

O.engines = [
        ForceResetter(),
        InsertionSortCollider([Bo1_Sphere_Aabb(), Bo1_Facet_Aabb()]),
        InteractionLoop(
                [Ig2_Sphere_Sphere_ScGeom(), Ig2_Facet_Sphere_ScGeom()],
                [Ip2_FrictMat_FrictMat_FrictPhys()],
                [Law2_ScGeom_FrictPhys_CundallStrack()]
        ),
        NewtonIntegrator(gravity=(0, 0, -9.81), damping=0.4),
        PyRunner(command='checkUnbalanced()', realPeriod=2),
        PyRunner(command='addPlotData()', iterPeriod=100)
]
O.dt = .5 * PWaveTimeStep()
O.trackEnergy = True

def checkUnbalanced():
 if unbalancedForce() < .05:
  O.pause()
  plot.saveDataTxt('bbb.txt.bz2')

def addPlotData():
 plot.addData(i=O.iter, unbalanced=unbalancedForce(), **O.energy)

kinetic_energy = sum([0.5*b.state.mass*b.state.vel.norm()**2 for b in O.bodies])
avg_mass = numpy.average([b.state.mass for b in O.bodies])
max_coord_all_particles = 0
for b in O.bodies:
 coord = len(b.intrs())
 if coord > max_coord_all_particles:
  max_coord_all_particles = coord

max_interactions_body1 = len(O.bodies[1].intrs())
plot.plots = {'i': ('unbalanced', None, O.energy.keys)}
plot.plot()
O.saveTmp()
```

The output when I run with yade:
```
$ yade gravitydep.py
Welcome to Yade 2020.01a
Using python version: 3.8.10 (default, May 26 2023, 14:05:08)
[GCC 9.4.0]
TCP python prompt on localhost:9000, auth cookie `scdyka'
XMLRPC info provider on http://localhost:21000
Running script gravitydep.py
Traceback (most recent call last):
  File "/usr/bin/yade", line 336, in runScript
    execfile(script,globals())
  File "/usr/lib/python3/dist-packages/past/builtins/misc.py", line 87, in execfile
    exec_(code, myglobals, mylocals)
  File "gravitydep.py", line 79, in <module>
    plot.plot()
  File "/usr/lib/x86_64-linux-gnu/yade/py/yade/plot.py", line 600, in plot
    createPlots(subPlots=subPlots)
  File "/usr/lib/x86_64-linux-gnu/yade/py/yade/plot.py", line 462, in createPlots
    createLines(pStrip,plots_p_y1,isY1=True,y2Exists=len(plots_p_y2)>0)
  File "/usr/lib/x86_64-linux-gnu/yade/py/yade/plot.py", line 444, in createLines
    scatter=pylab.scatter(scatterPt[0] if not math.isnan(scatterPt[0]) else 0,scatterPt[1] if not math.isnan(scatterPt[1]) else 0,s=scatterSize,color=line.get_color(),**scatterMarkerKw)
  File "/usr/local/lib/python3.8/dist-packages/matplotlib/pyplot.py", line 2790, in scatter
    __ret = gca().scatter(
  File "/usr/local/lib/python3.8/dist-packages/matplotlib/__init__.py", line 1423, in inner
    return func(ax, *map(sanitize_sequence, args), **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/matplotlib/axes/_axes.py", line 4634, in scatter
    collection._internal_update(kwargs)
  File "/usr/local/lib/python3.8/dist-packages/matplotlib/artist.py", line 1186, in _internal_update
    return self._update_props(
  File "/usr/local/lib/python3.8/dist-packages/matplotlib/artist.py", line 1160, in _update_props
    raise AttributeError(
AttributeError: PathCollection.set() got an unexpected keyword argument 'verts'
[[ ^L clears screen, ^U kills line. F12 controller, F11 3D view (press "h" in 3D view for help), F10 both, F9 generator, F8 plot. ]]

Output with yadedaily:
```
$ yadedaily gravitydep.py
Welcome to Yade 20230525-7264~94b01fd~focal1
Using python version: 3.8.10 (default, May 26 2023, 14:05:08)
[GCC 9.4.0]
TCP python prompt on localhost:9000, auth cookie `ekusyc'
XMLRPC info provider on http://localhost:21000
Running script gravitydep.py
yade.plot: creating fake plot, since there are no y-data yet
WARNING:matplotlib.legend:No artists with labels found to put in legend. Note that artists whose label start with an underscore are ignored when legend() is called with no argument.
[[ ^L clears screen, ^U kills line. F12 controller, F11 3D view (press "h" in 3D view for help), F10 both, F9 generator, F8 plot. ]]

Segmentation fault (core dumped)
```

Question information

Language:
English Edit question
Status:
Answered
For:
Yade Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Kevin Kuei (kckuei) said :
#1

I thought maybe this could maybe be due to conflict with anaconda already being installed on the system, so I uninstalled yadedaily, yade, anaconda and matplotlib.

Then I reinstalled just yade.

When running the same example script, I get this message:
``
$ yade gravitydep.py
Welcome to Yade 2020.01a
Using python version: 3.8.10 (default, May 26 2023, 14:05:08)
[GCC 9.4.0]
TCP python prompt on localhost:9000, auth cookie `ykesdc'
XMLRPC info provider on http://localhost:21000
Running script gravitydep.py
INFO:matplotlib.font_manager:Could not open font file /usr/share/fonts/truetype/noto/NotoColorEmoji.ttf: In FT2Font: Could not set the fontsize
INFO:matplotlib.font_manager:generated new fontManager
Segmentation fault (core dumped)
```

I also tried the 'pip install matplotlib==3.1.2' and still get the same above error.

When stepping through the lines in console, the segfault is triggered on plot.plot()

Revision history for this message
Jérôme Duriez (jduriez) said :
#2

Hi,

What happens if you type

from yade import plot
plot.addData(x=0,y=1)
plot.plots = {'x':'y'}
plot.plot()

Revision history for this message
Kevin Kuei (kckuei) said :
#3

HI Jérôme,

That also appears to trigger a segfault. Output provided below for reference.

```
~/yade-dem/tutorials$ yade
Welcome to Yade 2020.01a
Using python version: 3.8.10 (default, May 26 2023, 14:05:08)
[GCC 9.4.0]
TCP python prompt on localhost:9000, auth cookie `acysde'
XMLRPC info provider on http://localhost:21000
[[ ^L clears screen, ^U kills line. F12 controller, F11 3D view (press "h" in 3D view for help), F10 both, F9 generator, F8 plot. ]]

In [1]: from yade import plot
   ...: plot.addData(x=0,y=1)
   ...: plot.plots = {'x':'y'}
   ...: plot.plot()
   ...:
Segmentation fault (core dumped)
```

Revision history for this message
Bruno Chareyre (bruno-chareyre) said :
#4

Hi, in general using "pip install" is the best way to break a debian distribution. What you get is not systematic but unsurprising.
Just don't use pip. You want to "apt install".

In fact, I wonder what happens when you "pip install matplotlib" since after installing yade matplotlib is _already_ installed.

Revision history for this message
Kevin Kuei (kckuei) said :
#5

Hi Bruno,

Yes, I see what you mean.

I tried again with the uninstalling/reinstalling, and using the apt install command instead, but still get the same error, so it seems the damage has already been done and I would likely need a fresh installation of the os to resolve this issue.

On the positive side, the virtualbox and ova image works perfectly well for now and I can tinker with that until I set up my desktop with a fresh os to experiment again.

Thanks for your suggestion.

Can you help with this problem?

Provide an answer of your own, or ask Kevin Kuei for more information if necessary.

To post a message you must log in.