benfred / implicit

Fast Python Collaborative Filtering for Implicit Feedback Datasets
https://benfred.github.io/implicit/
MIT License
3.57k stars 612 forks source link

can't download the lastfm dataset locally #547

Closed mengxi-ream closed 2 years ago

mengxi-ream commented 2 years ago

when I run the code

from implicit.datasets.lastfm import get_lastfm

artists, users, artist_user_plays = get_lastfm()

I got the error

0.00B [00:00, ?B/s]
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
/tmp/ipykernel_205/3617457491.py in <module>
      1 from implicit.datasets.lastfm import get_lastfm
      2 
----> 3 artists, users, artist_user_plays = get_lastfm()

~/.local/lib/python3.7/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'
benfred commented 2 years ago

What version of h5py are you using ? (like what does python -c 'import h5py; print(h5py.__version__)' display ?

According to the h5py documentation this method was added in v3.0 : https://docs.h5py.org/en/latest/high/dataset.html?highlight=asstr#h5py.Dataset.asstr . I'm wondering if you have an older version installed which is causing this issue.

mengxi-ream commented 2 years ago

What version of h5py are you using ? (like what does python -c 'import h5py; print(h5py.__version__)' display ?

According to the h5py documentation this method was added in v3.0 : https://docs.h5py.org/en/latest/high/dataset.html?highlight=asstr#h5py.Dataset.asstr . I'm wondering if you have an older version installed which is causing this issue.

The version is 2.10.0 Then I updated the version to 3.6.0, the problem was solved.

Thank you very much!