Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dsshow crashing with AttributeError after numpy update #1209

Closed
DStauffman opened this issue May 3, 2023 · 4 comments
Closed

dsshow crashing with AttributeError after numpy update #1209

DStauffman opened this issue May 3, 2023 · 4 comments

Comments

@DStauffman
Copy link

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
Copy link
Member

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. #1205). In the meantime if you pin either numba<0.57 or numpy<1.24 it should all work OK.

weiji14 added a commit to weiji14/zen3geo that referenced this issue May 14, 2023
The latest numpy=1.24 version installed via readthedocs is incompatible with datashader=0.14.4, resulting in an error like `AttributeError: module 'numpy' has no attribute 'warnings'`. This was reported in holoviz/datashader#1209 and fixed in holoviz/datashader#1176, but will need to wait for datashader>=0.14.5 to be released.
weiji14 added a commit to weiji14/zen3geo that referenced this issue May 14, 2023
* 🐛 Fix DatashaderRasterizer to allow N:1 instead of just 1:1

Used to wrong boolean operator (should be and, not or) which meant DatashaderRasterizer didn't work when the vector_datapipe was length 1 and canvas_datapipe was length 2 or more. This prevents false errors like `ValueError: Unmatched lengths for the canvas datapipe (XarrayCanvasIterDataPipe) and vector datapipe (PyogrioReaderIterDataPipe). The vector datapipe's length (1) should either be (1) to allow for broadcasting, or match the canvas datapipe's length of (2)`.

Patches the bugfix at #39 from zen3geo v0.3.0. Also updated a unit test to use a 2:1 canvas:vector ratio to prevent regression.

* 📌 Temporarily pin numpy<1.24 to prevent AttributeError

The latest numpy=1.24 version installed via readthedocs is incompatible with datashader=0.14.4, resulting in an error like `AttributeError: module 'numpy' has no attribute 'warnings'`. This was reported in holoviz/datashader#1209 and fixed in holoviz/datashader#1176, but will need to wait for datashader>=0.14.5 to be released.
@J08nY
Copy link
Contributor

J08nY commented May 17, 2023

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
Copy link
Member

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
Copy link
Contributor

J08nY commented May 17, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants