You can run this notebook in a live session Binder or view it on Github.

Blank template

Use this notebook from Binder to test an issue or reproduce a bug report

[1]:
import xarray as xr
import numpy as np
import pandas as pd

ds = xr.tutorial.load_dataset("air_temperature")
da = ds["air"]
---------------------------------------------------------------------------
PermissionError                           Traceback (most recent call last)
File /usr/lib/python3/dist-packages/pooch/utils.py:262, in make_local_storage(path, env)
    258 if action == "create":
    259     # When running in parallel, it's possible that multiple jobs will
    260     # try to create the path at the same time. Use exist_ok to avoid
    261     # raising an error.
--> 262     os.makedirs(path, exist_ok=True)
    263 else:

File /usr/lib/python3.12/os.py:215, in makedirs(name, mode, exist_ok)
    214 try:
--> 215     makedirs(head, exist_ok=exist_ok)
    216 except FileExistsError:
    217     # Defeats race condition when another thread created the path

File /usr/lib/python3.12/os.py:215, in makedirs(name, mode, exist_ok)
    214 try:
--> 215     makedirs(head, exist_ok=exist_ok)
    216 except FileExistsError:
    217     # Defeats race condition when another thread created the path

File /usr/lib/python3.12/os.py:225, in makedirs(name, mode, exist_ok)
    224 try:
--> 225     mkdir(name, mode)
    226 except OSError:
    227     # Cannot rely on checking for EEXIST, since the operating system
    228     # could give priority to other errors like EACCES or EROFS

PermissionError: [Errno 13] Permission denied: '/sbuild-nonexistent'

The above exception was the direct cause of the following exception:

PermissionError                           Traceback (most recent call last)
Cell In[1], line 5
      2 import numpy as np
      3 import pandas as pd
----> 5 ds = xr.tutorial.load_dataset("air_temperature")
      6 da = ds["air"]

File /usr/lib/python3/dist-packages/xarray/tutorial.py:207, in load_dataset(*args, **kwargs)
    170 def load_dataset(*args, **kwargs) -> Dataset:
    171     """
    172     Open, load into memory, and close a dataset from the online repository
    173     (requires internet).
   (...)
    205     load_dataset
    206     """
--> 207     with open_dataset(*args, **kwargs) as ds:
    208         return ds.load()

File /usr/lib/python3/dist-packages/xarray/tutorial.py:161, in open_dataset(name, cache, cache_dir, engine, **kws)
    158     url = f"{base_url}/raw/{version}/{path.name}"
    160 # retrieve the file
--> 161 filepath = pooch.retrieve(url=url, known_hash=None, path=cache_dir)
    162 ds = _open_dataset(filepath, engine=engine, **kws)
    163 if not cache:

File /usr/lib/python3/dist-packages/pooch/core.py:227, in retrieve(url, known_hash, fname, path, processor, downloader, progressbar)
    222 action, verb = download_action(full_path, known_hash)
    224 if action in ("download", "update"):
    225     # We need to write data, so create the local data directory if it
    226     # doesn't already exist.
--> 227     make_local_storage(path)
    229     get_logger().info(
    230         "%s data from '%s' to file '%s'.",
    231         verb,
    232         url,
    233         str(full_path),
    234     )
    236     if downloader is None:

File /usr/lib/python3/dist-packages/pooch/utils.py:276, in make_local_storage(path, env)
    272 if env is not None:
    273     message.append(
    274         f"Use environment variable '{env}' to specify a different location."
    275     )
--> 276 raise PermissionError(" ".join(message)) from error

PermissionError: [Errno 13] Permission denied: '/sbuild-nonexistent' | Pooch could not create data cache folder '/sbuild-nonexistent/.cache/xarray_tutorial_data'. Will not be able to download data files.
[ ]: