LaTeX plotting error on MAC

14 views
Skip to first unread message

umberto borso

unread,
Oct 30, 2022, 5:35:35 AM10/30/22
to QuTiP: Quantum Toolbox in Python
Hi,

I have been trying to install qutip on my MAC but I keep getting the same error when trying to plot a circuit using the QubitCircuit().png function: pdflatex failed. Perhaps you do not have it installed, or you are missing the LaTeX package 'qcircuit'.

I have literally tried everything: installing latex via homebrew (both MacTeX and MiKTeX), installing qutip in his own environment, installing via anaconda (using conda install), installing pdflatex and qcircuit using pip install. Nothing works, I keep getting the same error.

Any suggestions?
Thanks!

Boxi Li

unread,
Oct 30, 2022, 5:45:18 AM10/30/22
to QuTiP: Quantum Toolbox in Python

Hello,

have you tried to compile any circuits yourself using only pdflatex? `qcircuit`  needs to be installed with a LaTeX package manager, not pip. So it might still be missing.

You can save the following latex code in a tex file and try to compile it in the command line (`pdflatex temp.tex`).

\documentclass[border=3pt]{standalone}
\usepackage[braket]{qcircuit}
\begin{document}
\Qcircuit @C=1cm @R=1cm {
 &  &  \targ  & \qw \\
 &  &  \ctrl{-1}  & \qw \\
}
\end{document}

If you are using the standalone package `qutip-qip` (not qutip.qip module), you can get the above code directly using `print(qc.latex_code())`

Best wishes
Boxi Li
Reply all
Reply to author
Forward
0 new messages