Do not call load_state before installing a package: this has a side-effect to delete the temp dirs associated to uninstalled package, so this breaks initial installation of devel and pinned packages (which are reinstalled from scratch on the first update).
Specify the call-site when using load_state.