Issue with 'Sampling the Dataset': data_dir not being registered in function

Hi,

I am following the setup given in the docs and have the following issue. I downloaded the data to the directory given but when I try to pass this to the data.make function it seems to not register that I am giving it the data_dir location.

Given the docs for this function this should work, is there something I have misunderstood and am doing wrong?

Thanks in advance

Phil

Add your data_dir in system variables with variable name = MINERL_DATA_ROOT

You can test from CMD by typing >echo %MINERL_DATA_ROOT% to see if it’s added to system environment or not.

Try using a named argument instead of a positional one for data_dir, e.g.
data = minerl.data.make(environment, data_dir=data_dir)

I had this issue too,

fixed it with

os.environ['MINERL_DATA_ROOT'] = data_dir
data = minerl.data.make('MineRLObtainDiamond-v0')

For the competition organisers it comes from these lines in minerl init.py

 # Ensure path is setup
if data_dir is None and 'MINERL_DATA_ROOT' in os.environ:
    data_dir = os.environ['MINERL_DATA_ROOT']
elif data_dir is not None and not os.path.exists(data_dir):
    if force_download:
        print("Provided data directory does not exist: ", data_dir)
        data_dir = download(data_dir)
    else:
        raise FileNotFoundError("Provided data directory does not exist. "
                                "Specify force_download=True to download default dataset")
else: ###
    if force_download:
        print("Provided data directory does not exist: ", data_dir)
        data_dir = download(data_dir)
    else:
        raise ValueError("No data_dir provided and $MINERL_DATA_ROOT undefined."
                         "Specify force_download=True to download default dataset")

Where clearly if data_dir is set it is not None, but if it also exists, we go to the else where I have added ### and this raises an error either way. Needs a case to catch when the data_dir is set (ie. not None) but also does os.exist()

1 Like

Thank you so much, I tried everything in the function with no success so thought something more complex was going on but wasn’t able to find the source of the problem.