Hi Miles,
Sorry, I should have been clearer. In an iJulia notebook, I have all commands on separate lines, and it didn't work. It turns out there was a package clash between ITensors and and the Distributions package. If I call the latter first, for some reason "dim" is no longer defined in ITensors. Commenting out Distributions makes everything run fine. Thank you.