holoviz / datashader

Quickly and accurately render even the largest data.
http://datashader.org
BSD 3-Clause "New" or "Revised" License
3.24k stars 363 forks source link

dsshow crashing with AttributeError after numpy update #1209

Closed DStauffman closed 1 year ago

DStauffman commented 1 year ago

ALL software version info

ds.__version__
'0.14.4'

np.__version__
'1.24.3'

Description of expected behavior and the observed behavior

import datashader as ds
from datashader.mpl_ext import dsshow
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd

x = np.arange(10)
y = x + 1.0
df = pd.DataFrame({"time": x, "data": y})
fig, ax = plt.subplots()
ax.plot(x, y)
dsshow(df, ds.Point("time", "data"))

In datashader\core.py, function bypixel throws an error with the np.warnings command:


  File "test_broken.py", line 14, in <module>
    dsshow(df, ds.Point("time", "data"))

  File "C:\Users\%username%\Documents\venvs\everything310\lib\site-packages\datashader\mpl_ext.py", line 716, in dsshow
    artist = ScalarDSArtist(

  File "C:\Users\%username%\Documents\venvs\everything310\lib\site-packages\datashader\mpl_ext.py", line 386, in __init__
    binned = self.aggregate(self.axes.get_xlim(), self.axes.get_ylim())

  File "C:\Users\%username%\Documents\venvs\everything310\lib\site-packages\datashader\mpl_ext.py", line 238, in aggregate
    binned = bypixel(self.df, canvas, self.glyph, self.aggregator)

  File "C:\Users\%username%\Documents\venvs\everything310\lib\site-packages\datashader\core.py", line 1258, in bypixel
    with np.warnings.catch_warnings():

  File "C:\Users\%username%\Documents\venvs\everything310\lib\site-packages\numpy\__init__.py", line 320, in __getattr__
    raise AttributeError("module {!r} has no attribute "

AttributeError: module 'numpy' has no attribute 'warnings'

Seems to be fine in older versions of numpy. I'm not sure if this is now expected behavior that needs to be adapted or if it's an upstream bug in numpy.

ianthomas23 commented 1 year ago

Hi @DStauffman. This was fixed in #1176. There will be a new release of datashader soon incorporating this fix, when we have dealt with all the other issues relating to today's release of numba 0.57 (e.g. https://github.com/holoviz/datashader/pull/1205). In the meantime if you pin either numba<0.57 or numpy<1.24 it should all work OK.

J08nY commented 1 year ago

Any ETA for the release? Numpy 1.24 is already quite old, this could (should) be a bugfix release that does not wait for all the issues in the v0.14.5 milestone.

ianthomas23 commented 1 year ago

There is a dev release 0.14.5a1 out on PyPI (https://pypi.org/project/datashader/0.14.5a1/) and the pyviz/label/dev conda channel (https://anaconda.org/pyviz/datashader/files).

The timing of numpy 1.24 isn't relevant, it is the timing of the numba release that supports numpy 1.24. That was 0.57 which was released 2 weeks ago.

J08nY commented 1 year ago

Right, I did not notice the pre-release! Thanks for handling the numba changes.