Update fails - TypeError: can't pickle module objects

Yes, this is the issue that I experienced.

In developer mode, the hooks are not cached which is why it works fine normally.

With developer mode off, hooks are cached. So when you import a module it’s trying to cache the dict() containing a module key which isn’t possible and that causes the pickle error.

Another workaround besides just turning on developer mode, is you can rewrite your imports to be like this: “import xyz as _xyz”

This works because the caching function skips any keys that begin with underscores.

9 Likes