holoviz / geoviews

Simple, concise geographical visualization in Python
http://geoviews.org
BSD 3-Clause "New" or "Revised" License
595 stars 77 forks source link

Regression with numpy=1.20 #503

Open jbednar opened 3 years ago

jbednar commented 3 years ago

The Large Data user guide is rendered fine on the website (http://holoviews.org/user_guide/Large_Data.html), but I can't reproduce it locally with holoviews=1.14.4, datashader=0.12.2a1, pandas=1.2.4, spatialpandas=0.4.0, numpy=1.20.2 due to a SpatialPandasInterface error ("Did not pass numpy.dtype object"):

image

It does work if I downgrade numpy to 1.19.2, so presumably HoloViews or SpatialPandas needs updating.

jbednar commented 3 years ago

Minimal example that works with numpy=1.19.2 but not numpy=1.20.2:

import holoviews as hv
import spatialpandas
from holoviews.operation.datashader import rasterize
from bokeh.sampledata.unemployment import data as unemployment
from bokeh.sampledata.us_counties import data as counties

hv.extension('matplotlib')

polys = hv.Polygons([dict(county, unemployment=unemployment[k]) 
                     for k, county in counties.items()
                     if county['state'] == 'tx'], 
                    ['lons', 'lats'], ['unemployment']).opts(color='unemployment')
rasterize(polys)
jbednar commented 3 years ago

Looks like an issue with pyarrow. I can reproduce the bug using this environment:

conda create -n spbug3 -c pyviz python=3.7 holoviews=1.14.4 datashader=0.12.1 pandas=1.2.4 spatialpandas=0.4.0 numpy=1.20.2 pyarrow=0.15

but if I leave off pyarrow=0.15 I get pyarrow=3, which works fine. I think spatialpandas is what's tied to pyarrow, so probably spatialpandas should be the one to pin to pyarrow (2 and 3 work fine), not HoloViews.

Note that I didn't actually request an old pyarrow version, but I seem to get one in any environment I have where geoviews is installed. So my guess is that this issue will only come up for geoviews users, and possibly only for geoviews users who conda install from defaults rather than conda-forge, given that @philippjfr doesn't see the issue when he installs from conda-forge.