NASA-NAVO / navo-workshop

Tutorial notebooks for how to use PyVO to access NASA and other data in Python.
https://NASA-NAVO.github.io/navo-workshop
BSD 3-Clause "New" or "Revised" License
41 stars 26 forks source link

Cached queries fail due to namespace reorganization #118

Closed stargaser closed 1 year ago

stargaser commented 1 year ago

The NED queries at the end of the QuickReference and UseCase_I notebooks are failing for me with ModuleNotFoundError: No module named 'astroquery.ned.core'. I traced this to cached queries dating from May and November 2021 in the ~/.astropy/cache/astroquery cache such as /Users/shupe/.astropy/cache/astroquery/Ned/a2ead32ef8047db0ff18723913d9eec28e82092e07e7917bfe947461.pickle.

To clear the NED cache, based on the astroquery caching documentation I would expect Ned.clear_cache() to work, but that method is missing. I would also expect the caching to only last a week, but these old cache files are being used. from astroquery import cache_conf also fails with ImportError: cannot import name 'cache_conf' from 'astroquery'.

The only remedy I found is to do print(Ned.cache_location) and then remove the contents of that directory from a terminal. That fixed it.

A new user won't run into this problem so it may not be worth documenting the solution in the notebooks.

stargaser commented 1 year ago

See also issue astropy/astroquery#1239 on improving the caching documentation in astroquery.

bsipocz commented 1 year ago

cc @ceb8 - do you see you'll have time any time soon to improve the caching docs?

ceb8 commented 1 year ago

@bsipocz Yep! I will start work on this next week!

ceb8 commented 1 year ago

@stargaser The current caching infrastructure is relatively new and it seems like maybe you are running your notebook with an older version of astroquery, which is why cache_confand Ned.cache_location() are not available. Prior to the caching system overhaul the only way to clear the cache was deleting it manually.

Also with the new update, cached files expire after one week, so hopefully problems like this will occur less frequently.

stargaser commented 1 year ago

Thanks @ceb8, I'm running astroquery 0.4.6 which was released over 14 months ago. I see the caching docs don't appear with that version on RTD. So really the issue is that we're installing from conda-forge and not getting the new updates.

bsipocz commented 1 year ago

astroquery should always be pip installed, and with --pre, and since it's pure python it should cause any issues anyway.