1

I followed this manual in order to visualize my QISKit v0.4.8 quantum circuit by means of the latex_drawer() function (in newer versions of QISKit the function is circuit_drawer()). However, I got the following error when running the code:

! LaTeX Error: File `qcircuit.sty' not found.

Is qcircuit.sty a part of QISKit? What is the best way to fix the issue?

By the way, this is the function that I use to produce the image of a circuit:

def circuit_image(circuit, basis="u1,u2,u3,cx"):
    filename = 'circuit'
    tmpdir = 'tmp'
    if not os.path.exists(tmpdir):
        os.makedirs(tmpdir)
    filename_tex = filename + ".tex"
    filename_pdf = filename + ".pdf"
    latex_drawer(circuit, os.path.join(tmpdir, filename_tex), basis=basis)
    os.system("pdflatex -output-directory {} {}".format(tmpdir, filename_tex))
    images = pdf2image.convert_from_path(os.path.join(tmpdir, filename_pdf))
    shutil.rmtree(tmpdir)
    return images[0]
Alexander Pozdneev
  • 1,289
  • 1
  • 13
  • 31

1 Answers1

0

qcircuit is a third-party LaTeX package that is not part of QISKit. If your LaTeX distribution does not come with this package, you can install it by yourself.

For example, for Ubuntu 14.04.5 LTS do the following:

  1. Download the zip-file
  2. Unpack it to /usr/share/texlive/texmf-dist/tex/latex
  3. Run sudo texhash

For more information on installing LaTeX packages, see the following pages:

Alexander Pozdneev
  • 1,289
  • 1
  • 13
  • 31