You can run this notebook in a live session 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.13/os.py:217, in makedirs(name, mode, exist_ok)
216 try:
--> 217 makedirs(head, exist_ok=exist_ok)
218 except FileExistsError:
219 # Defeats race condition when another thread created the path
File /usr/lib/python3.13/os.py:217, in makedirs(name, mode, exist_ok)
216 try:
--> 217 makedirs(head, exist_ok=exist_ok)
218 except FileExistsError:
219 # Defeats race condition when another thread created the path
File /usr/lib/python3.13/os.py:227, in makedirs(name, mode, exist_ok)
226 try:
--> 227 mkdir(name, mode)
228 except OSError:
229 # Cannot rely on checking for EEXIST, since the operating system
230 # 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:213, in load_dataset(*args, **kwargs)
176 def load_dataset(*args, **kwargs) -> Dataset:
177 """
178 Open, load into memory, and close a dataset from the online repository
179 (requires internet).
(...)
211 load_dataset
212 """
--> 213 with open_dataset(*args, **kwargs) as ds:
214 return ds.load()
File /usr/lib/python3/dist-packages/xarray/tutorial.py:165, in open_dataset(name, cache, cache_dir, engine, **kws)
162 downloader = pooch.HTTPDownloader(headers=headers)
164 # retrieve the file
--> 165 filepath = pooch.retrieve(
166 url=url, known_hash=None, path=cache_dir, downloader=downloader
167 )
168 ds = _open_dataset(filepath, engine=engine, **kws)
169 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.
[ ]: