TypeError: invalid Dim dtype dtype('<M8[D]')

When using the example code for datetime dimensions in the documentation:

# Domain is 10 years, day resolution, one tile per 365 days
dim = tiledb.Dim(name='d1', ctx=ctx,
                 domain=(np.datetime64('2010-01-01'), np.datetime64('2020-01-01')),
                 tile=np.timedelta64(365, 'D'),
                 dtype=np.datetime64('', 'D').dtype)
dom = tiledb.Domain(dim, ctx=ctx)
schema = tiledb.ArraySchema(ctx=ctx, domain=dom,
                            attrs=(tiledb.Attr('a1', dtype=np.float64),))

tiledb.Array.create(my_array_name, schema)

I get the error:
TypeError: invalid Dim dtype dtype('<M8[D]')

tileDB version: 0.4.4
numpy version: 1.18.1

Can anyone confirm this or is it just me?

Hi @Mtrl_Scientist, could you please try with the most recent version of TileDB-Py (0.5.6)? I’ve just tested your snippet and it works there – we’ve made a number of improvements for datetime support recently.

There are binary wheels for the latest release on PyPI (for macos and linux), as well as packages on conda-forge (for mac, linux, and windows).

tileDB version: 0.4.4

Out of curiosity, how did you install this version?

When trying to upgrade with pip, it says it’s version 0.5.6, but when trying to show the version with tiledb.__version__ it shows 0.4.4.

I’ve tried the installation with both pip and conda-forge.

It seems to be working on the other machine I’ve tried.

It looks like you might have overlapping environments there? I would suggest using either pip or conda for binary packages but not both. Please note that (somewhat unfortunately) the conda package for TileDB python API is called tiledb-py, whereas the pip package is called tiledb.