mretegan / crispy

Core-Level Spectroscopy Simulations in Python

Home Page:http://www.esrf.eu/computing/scientific/crispy

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Plotting on ubuntu (silx error)

cwgaldino opened this issue · comments

I have tried to use crispy 0.7.3 on Ubuntu 20.04, but got the following error when plotting spectra:

Traceback (most recent call last):
  File "/home/galdino/envs/my_env/lib/python3.8/site-packages/silx/gui/plot/backends/BackendBase.py", line 343, in postRedisplay
    plot.replot()
  File "/home/galdino/envs/my_env/lib/python3.8/site-packages/silx/gui/plot/PlotWidget.py", line 2949, in replot
    item._update(self._backend)
  File "/home/galdino/envs/my_env/lib/python3.8/site-packages/silx/gui/plot/items/core.py", line 442, in _update
    self._backendRenderer = self._addBackendRenderer(backend)
  File "/home/galdino/envs/my_env/lib/python3.8/site-packages/silx/gui/plot/items/curve.py", line 199, in _addBackendRenderer
    return backend.addCurve(xFiltered, yFiltered,
TypeError: addCurve() missing 1 required positional argument: 'legend'
Aborted (core dumped)

Then I used the following workaround:

  1. Edit line 199 of curve.py in the silx package (the full file path can be found in error message above).

Before it was

return backend.addCurve(xFiltered, yFiltered,

and I changed it to

return backend.addCurve(xFiltered, yFiltered, legend='',

Note that this "breaks" the silxs installation within that environment. Particularly, I have separated environment just for running crispy 0.7.3.

  1. Edit line 58 of plot.py in the crispy folder (<crispy_folder>/crispy/gui/plot.py)

Before it was

x, y, legend, *args, **kwargs)

and I changed it to

x, y, *args, **kwargs)

You may close this. I just thought it would be a good idea to report this error here since other people might also have the same issue when using crispy on ubuntu.

Thanks a lot for reporting this. The plotting API changed in the more recent silx versions. Another way to solve the issue is to install an older version of silx.

python3 -m pip install silx==0.11

The issue here is that older versions of silx don't provide wheels, so pip will compile the library from the source, which might not be too much of a problem on Linux.

I'll update the README.rst to reflect this. Hopefully, I will finish the new release soon.