BUG: ImportError: No module named thread

Fixes #5136. Import dummy_threading if importing threading fails.