Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

If I put some viscosity (or density, ...) lookups in my notebook, such as:

muMercury = ChemicalData["Mercury", "Viscosity"] ;
muWater = ChemicalData["Water", "Viscosity"] ;

Then these are fetched each time the notebook is loaded, which is kind of slow (a little window pops up showing "Initializing Chemical Data Indices" while it does this lookup). Is there a way to cache these, without doing a kludge like manually copying the numeric values obtained from an initial call?

I've got two reasons for asking. The first is just the slowness aspect, and the second is functional. I've got a Manipulate control that depends indirectly on these values, and when I start up the notebook for the very first time, it appears that my Manipulate executes before the preceding ChemicalData functions are evaluated. The "Initializing ChemicalData indices" doesn't occur until after an explicit evaluation.

share|improve this question
up vote 25 down vote accepted

You can "preload" all the data to your computer so that it doesn't have to look it up each time. An added advantage is that it'll also be available when you're offline. This is covered in this support article on In your case, you would do:


and you should be all set. Note that it will take a while to download all the data from their servers.

share|improve this answer
Thanks, I was able to execute those commands (although I had to switch to a wired connection to do so), and verified that I was able to do an offline execution of the notebook. The values, however, are still not cached. I've got to hit shift-enter twice to get my Manipulate slider to pick up the values (the first time through produces errors because my viscosity values aren't yet loaded). – Peeter Joot Mar 27 '12 at 3:27
In one of the other answers to a question I previously asked, I found out how to deal with the sequencing issue:… – Peeter Joot Mar 27 '12 at 3:39
@PeeterJoot Re: your edit, have you tried using an initialization cell? – R. M. Mar 27 '12 at 4:49
An initialization cell was exactly the construct required here. Thanks! – Peeter Joot Mar 28 '12 at 12:46

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.