implicit icon indicating copy to clipboard operation
implicit copied to clipboard

Error with get_lastfm()

Open mrticker opened this issue 3 years ago • 1 comments

I'm trying to run the tutorial code and I get this error:

from implicit.datasets.lastfm import get_lastfm

artists, users, artist_user_plays = get_lastfm()

## -- End pasted text --
184MB [00:11, 15.5MB/s]
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-1-37855098b3dc> in <module>
      1 from implicit.datasets.lastfm import get_lastfm
      2
----> 3 artists, users, artist_user_plays = get_lastfm()

C:\usr\Miniconda3\lib\site-packages\implicit\datasets\lastfm.py in get_lastfm()
     29         m = f.get("artist_user_plays")
     30         plays = csr_matrix((m.get("data"), m.get("indices"), m.get("indptr")))
---> 31         return np.array(f["artist"].asstr()[:]), np.array(f["user"].asstr()[:]), plays
     32
     33

AttributeError: 'Dataset' object has no attribute 'asstr'

Python 3.8.12 | packaged by conda-forge | (default, Oct 12 2021, 21:22:46) [MSC v.1916 64 bit (AMD64)]

mrticker avatar Sep 22 '22 18:09 mrticker

What version of h5py are you running? The Dataset.asstr function was added in v3.0 https://docs.h5py.org/en/stable/high/dataset.html#h5py.Dataset.asstr - Can you try upgrading to at least this version?

benfred avatar Sep 22 '22 22:09 benfred

Thank you, that worked. Initially I just did "pip install h5py" (or maybe "conda install h5py"), I don't know why it installed 2.10.

mrticker avatar Sep 23 '22 17:09 mrticker