desihub / tutorials

DESI tutorials
BSD 3-Clause "New" or "Revised" License
43 stars 17 forks source link

Error in DESI Jupyter notebook code #100

Open SCO-SCI opened 5 months ago

SCO-SCI commented 5 months ago

I am in the 'getting_started' section of the DESI Jupyter notebook. Cell 14 has the code:

Tile file from SURVEY='sv3' and PROGRAM='dark'

tile_file = f'{specprod_dir}zcatalog/ztile-sv3-dark-cumulative.fits'

t_tile = Table.read(tile_file, hdu=1) ra_tile = t_tile['TARGET_RA'] dec_tile = t_tile['TARGET_DEC']

We will use Tile #30 for the example below

selec_tile = t_tile['TILEID']==30

When I try to execute that code I receive the following error:


FileNotFoundError Traceback (most recent call last) Cell In[14], line 4 1 # Tile file from SURVEY='sv3' and PROGRAM='dark' 2 tile_file = f'{specprod_dir}zcatalog/ztile-sv3-dark-cumulative.fits' ----> 4 t_tile = Table.read(tile_file, hdu=1) 5 ra_tile = t_tile['TARGET_RA'] 6 dec_tile = t_tile['TARGET_DEC']

File ~\AppData\Local\Programs\Python\Python311\Lib\site-packages\astropy\table\connect.py:62, in TableRead.call(self, *args, *kwargs) 59 units = kwargs.pop('units', None) 60 descriptions = kwargs.pop('descriptions', None) ---> 62 out = self.registry.read(cls, args, **kwargs) 64 # For some readers (e.g., ascii.ecsv), the returned out class is not 65 # guaranteed to be the same as the desired output cls. If so, 66 # try coercing to desired class without copying (io.registry.read 67 # would normally do a copy). The normal case here is swapping 68 # Table <=> QTable. 69 if cls is not out.class:

File ~\AppData\Local\Programs\Python\Python311\Lib\site-packages\astropy\io\registry\core.py:197, in UnifiedInputRegistry.read(self, cls, format, cache, *args, **kwargs) 195 try: 196 ctx = get_readable_fileobj(args[0], encoding='binary', cache=cache) --> 197 fileobj = ctx.enter() 198 except OSError: 199 raise

File ~\AppData\Local\Programs\Python\Python311\Lib\contextlib.py:137, in _GeneratorContextManager.enter(self) 135 del self.args, self.kwds, self.func 136 try: --> 137 return next(self.gen) 138 except StopIteration: 139 raise RuntimeError("generator didn't yield") from None

File ~\AppData\Local\Programs\Python\Python311\Lib\site-packages\astropy\utils\data.py:271, in get_readable_fileobj(name_or_obj, encoding, cache, show_progress, remote_timeout, sources, http_headers) 266 if is_url: 267 name_or_obj = download_file( 268 name_or_obj, cache=cache, show_progress=show_progress, 269 timeout=remote_timeout, sources=sources, 270 http_headers=http_headers) --> 271 fileobj = io.FileIO(name_or_obj, 'r') 272 if is_url and not cache: 273 delete_fds.append(fileobj)

FileNotFoundError: [Errno 2] No such file or directory: '/global/cfs/cdirs/desi/public/edr/spectro/redux/fuji/zcatalog/ztile-sv3-dark-cumulative.fits'

akremin commented 5 months ago

Hello, are you running the tutorial from a jupyter notebook at NERSC (https://jupyter.nersc.gov/) or from another machine? If you are running it at NERSC, please retry the code. There are instances where we've seen the file server incorrectly assert the file doesn't exist. These have been temporary issues in the past with the filesystem that typically resolve within a few hours. I have just verified that /global/cfs/cdirs/desi/public/edr/spectro/redux/fuji/zcatalog/ztile-sv3-dark-cumulative.fits exists.

If you are running elsewhere, that is a known issue with some of our tutorials but we thank you for reminding us that this is an ongoing problem for our users. We will work to make this more agnostic so that it can work on other machines.

forero commented 5 months ago

Hello @SCO-SCI. From lines like this one ~\AppData\Local\Programs, it looks to me like you are running the notebook on your Windows machine. Is that correct? I am asking that because the notebook you are using is only expected to work as-is on NERSC (https://jupyter.nersc.gov/).

If you do not have access to NERSC, you can try using this cloud-based service instead: https://datalab.noirlab.edu/desi/index.php. There, you also have access to some of the DESI data.

SCO-SCI commented 5 months ago

Yes, I am running this from a local Windows machine as I do not have a NERSC ID. Upon further reading I understand these notebooks were designed to run at NERSC so that explains the problem. I also read that there are two tutorials that should run in non-NEARSC environments: intro_to_DESI_EDR_files.ipynb and EDR_AnalyzeZcat.ipynb. I will try those out later today and, hopefully will not have similar problems. Thanks you.

forero commented 5 months ago

Thank you @SCO-SCI for trying this out! Please let us know if run into any other issue.

sbailey commented 5 months ago

@sco-sci FYI we don't officially support windows, but we also don't purposefully break things for windows, so if you encounter any other problems please let us know and we'll see if there is an easy workaround or not.