Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes installation instructions for circuit diagrams #65

Merged
merged 8 commits into from Jul 11, 2021

Conversation

purva-thakre
Copy link
Contributor

Instructions for installing circuit diagram packages on Linux have been updated.

For more information, see #60.

@purva-thakre
Copy link
Contributor Author

Don't merge this yet. I need to add some information for jupyter notebook and pdflatex being part of texlive installation.

Comment on lines 51 to 78

Plotting Circuits
------------------
In order to plot circuits, following packages are needed - ``LaTex``, ``ImageMagick``,
``QCircuit``, ``pdfcrop`` and ``pdflatex``.

**For Linux** : If you would prefer to avoid installing the full ``texlive``
package for ``LaTex``, `this link has <https://tex.stackexchange.com/a/504566/203959>`_
some useful discussion on selectively installing smaller packages. ``LaTex`` is needed
to plot the circuits.

* ``braket`` will be installed as a part of ``texlive-latex-extra``
* ``qcircuit`` will be installed as a part of ``texlive-pictures``
* ``pdfcrop`` and ``pdflatex`` are installed when a minimal ``texlive`` is installed.

``ImageMagick`` can be installed as a conda package via `this link <https://github.com/conda-forge/imagemagick-feedstock#installing-imagemagick>`_
or use this `link <https://imagemagick.org/script/download.php>`_ to install
via source. This package along with ``pdfcrop`` and ``pdflatex`` are
needed to display the circuit diagrams.


You `might need to make changes <https://stackoverflow.com/a/52863413/10241324>`_ to ``policy.xml`` if following error occurs :

.. code-block:: text

RuntimeError: convert-im6.q16: not authorized `qcirc.pdf' @ error/constitute.c/ReadImage/412.
convert-im6.q16: no images defined `qcirc.png' @ error/convert.c/ConvertImageCommand/3258.

Copy link
Member

@BoxiLi BoxiLi Jun 23, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few questions/comments:

  • pdflatex is not a separate package is it? It is part of LaTeX.
  • The official ImageMagick installer is not from source, it is a binary distribution.
  • Let's not recommend conda install imagemagick. I remember neither you nor I succeeded on this, right?
  • We also need Ghostscript for the pdf to png conversion.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pdflatex is not a separate package is it? It is part of LaTeX.

Yes, I haven't pushed the new changes yet. I have made a note that they should not install pdflatex via pip. I made the mistake and I think that guy also had a similar issue.

Let's not recommend conda install imagemagick. I remember neither you nor I succeeded on this, right?

I will have to double check how it worked for me. I tried way too many things and forgot how I installed it. I think apt-get might have worked for me.

The official ImageMagick installer is not from source, it is a binary distribution.

Thanks ! I linked the wrong page.

We also need Ghostscript for the pdf to png conversion.

I don't think I had to install it separately. I can check which package installed it as a dependency.

Copy link
Member

@BoxiLi BoxiLi Jun 23, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think I had to install it separately. I can check which package installed it as a dependency.

Ok, I remember I did apt-get ghostscript.

I will have to double check how it worked for me. I tried way too many things and forgot how I installed it. I think apt-get might have worked for me.

Sure, just if it takes too much time, there is no need to put it on high priority. We can slowly work this out. The decomposition has higher priority ;)

Thanks for updating this guide and making the doc better!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is no need to put it on high priority. We can slowly work this out

I have linked source installation instructions for now. We can update the instructions later about using apt-get if someone runs into new issues.

Also, I don't think I have pdf2svg installed. Is that an option for conversion when circuit.svg is used instead of circuit.png ?

doc/source/installation.rst Outdated Show resolved Hide resolved
doc/source/qip-basics.rst Outdated Show resolved Hide resolved
@hodgestar
Copy link
Contributor

Just a note that we're looking into rendering circuit diagrams with matplotlib (like in https://github.com/sympy/sympy/blob/46e00feeef5204d896a2fbec65390bd4145c3902/sympy/physics/quantum/circuitplot.py#L49-L288) which should remove the dependency on TeX.

(Which is not to say we shouldn't merge these instructions if they're ready -- it's not entirely clear how long the matplotlib rendering will take and users of the current version might appreciate more complete instructions anyway).

@purva-thakre
Copy link
Contributor Author

Just a note that we're looking into rendering circuit diagrams with matplotlib (like in https://github.com/sympy/sympy/blob/46e00feeef5204d896a2fbec65390bd4145c3902/sympy/physics/quantum/circuitplot.py#L49-L288) which should remove the dependency on TeX.

(Which is not to say we shouldn't merge these instructions if they're ready -- it's not entirely clear how long the matplotlib rendering will take and users of the current version might appreciate more complete instructions anyway).

Yes, I remember the discussion from last meeting. The instructions are ready for now.

@BoxiLi
Copy link
Member

BoxiLi commented Jul 11, 2021

@purva-thakre Shall we merge this or do you still have more stuff to add?

@purva-thakre
Copy link
Contributor Author

I don't any any more new stuff to add.

@BoxiLi BoxiLi merged commit c848c81 into qutip:master Jul 11, 2021
@purva-thakre purva-thakre deleted the circuit_diagram branch July 11, 2021 17:10
@BoxiLi BoxiLi added this to the qutip-qip-0.1.1 milestone Jul 11, 2021
BoxiLi pushed a commit to BoxiLi/qutip-qip that referenced this pull request Jul 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants