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

**URL:** <https://forum.tiledb.com/t/typeerror-invalid-dim-dtype-dtype-m8-d/153>\
**Category:** Uncategorized\
**Created:** [March 11, 2020, 12:13pm UTC](https://forum.tiledb.com/t/typeerror-invalid-dim-dtype-dtype-m8-d/153 "2020-03-11T12:13:38Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mtrl\_Scientist](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.tiledb.com/mtrl_scientist/32/134_2.png) [@Mtrl\_Scientist](https://forum.tiledb.com/u/Mtrl_Scientist)\
**Post date:** [March 11, 2020, 12:13pm UTC](https://forum.tiledb.com/t/typeerror-invalid-dim-dtype-dtype-m8-d/153/1 "2020-03-11T12:13:39Z")

</div>

When using the example code for datetime dimensions in the [documentation](https://docs.tiledb.com/developer/api-usage/datetimes-with-numpy):

```
# 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?

---

<div class="post-metadata">

**Author:** ![ihnorton](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.tiledb.com/ihnorton/32/23_2.png) [@ihnorton](https://forum.tiledb.com/u/ihnorton)\
**Post date:** [March 11, 2020, 9:05pm UTC](https://forum.tiledb.com/t/typeerror-invalid-dim-dtype-dtype-m8-d/153/2 "2020-03-11T21:05:36Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Mtrl\_Scientist](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.tiledb.com/mtrl_scientist/32/134_2.png) [@Mtrl\_Scientist](https://forum.tiledb.com/u/Mtrl_Scientist)\
**Post date:** [March 11, 2020, 9:50pm UTC](https://forum.tiledb.com/t/typeerror-invalid-dim-dtype-dtype-m8-d/153/3 "2020-03-11T21:50:46Z")

</div>

![photo_2020-03-11_22-45-23](https://canada1.discourse-cdn.com/flex035/uploads/tiledb/original/1X/756940ece6f0b6cd5ae03b215582c58b4577b6bb.jpeg)

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.

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

---

<div class="post-metadata">

**Author:** ![ihnorton](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.tiledb.com/ihnorton/32/23_2.png) [@ihnorton](https://forum.tiledb.com/u/ihnorton)\
**Post date:** [March 12, 2020, 2:39am UTC](https://forum.tiledb.com/t/typeerror-invalid-dim-dtype-dtype-m8-d/153/4 "2020-03-12T02:39:51Z")

</div>

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`.

> [@Mtrl\_Scientist](#):
>
> It seems to be working on the other machine I’ve tried.

👍
