The attached patch works and speeds up the sage import from between 0.1 and 0.5 seconds, depending on caching.
NOTE: It is necessary to fix a bug in sympy first.
11:57 < wstein> The fix would be to change line 99 of printing/pretty/pretty_symbology.py to
11:57 < wstein> try:
11:57 < wstein> encoding = sys.stdout.encoding
11:57 < wstein> except AttributeError: return
11:58 < wstein> Yep, that 100% fixes the problem.
11:58 < ondrej> ok, I'll commit it. thanks
11:58 < wstein> Maybe you already did that?
11:58 < wstein> It is right, I think, since you do almost the same thing 2 lines later.