Yes, you have to be completely out of combat to change any gear at all (so this would include weapons). It's not simply putting your weapon away, you can't have any enmity on any enemies at all. So if there is anything on the engaged enemies list on the left side of the screen, you won't be able to change.

By the way, the training dummies don't die and don't attack, but they technically gain enmity on you because you are performing actions on them. To clear enmity on them just run out of range and it will clear.