Search code examples
pythonmacospermissionshuggingface-datasets

Errno 13 Permission denied error when trying to load Huggingface dataset


I'm trying to do a very simple thing: to load a dataset from the Huggingface library (see example code here) on my Mac:

from datasets import load_dataset
raw_datasets = load_dataset("glue", "mrpc")

I'm getting the following error:

PermissionError: [Errno 13] Permission denied: '/Users/username/.cache/huggingface/datasets/downloads/6d9bc094a0588d875caee4e51df39ab5d6b6316bf60695294827b02601d421a5.759f3e257a3fad0984d9f8ba9a26479d341795eb50fa64e4c1de40f1fc421313.py.lock'

I've just spent an hour googling solutions for this, but so far nothing has worked. Can anyone help?

Thanks in advance!


Solution

  • OK, I managed to solve it by manually changing the permissions of the right folders on my Mac:

    1. I navigated to the /Users/username/.cache/huggingface/datasets/downloads folder in the Finder (you can see hidden files and folders such as ".cache" by pressing " command shift + . ")
    2. Then I went to the info window for this 'downloads' folder (" command i "), clicked 'Sharing & Permissions', clicked the lock to make changes and then gave everyone read & write access (I'm the only one using this computer, so it doesn't matter)
    3. I then got some new permission errors relating to some other folders, so I just went to each folder and changed the permissions for all of them

    Not sure why this worked and the 'chmod 777' command didn't, but I'm glad it did. Thank you @Cuartero for pointing me in the right direction!