How to pretty print in ipython notebook via sympy?

The issue is with your init_printing statement. In a notebook, you do not want to run latex, instead you should use mathjax, so try this instead:

init_printing(use_latex='mathjax')

When I use this, I get normal pretty printing everywhere, even when I have a sympy expression as the last line of the cell.


you need to use display:

from IPython.display import display

display(yourobject)

It will choose the appropriate representation (text/LaTex/png...), in recent enough version of IPython (6.0+) display is imported by default, still we recommend to explicitly import it.