GithubHelp home page GithubHelp logo

Comments (14)

BoxiLi avatar BoxiLi commented on August 27, 2024 1

Yes, I noticed this too. It will be included in the draft PR for single qubit decompositions. Would you prefer I make this a separate PR ?

A separate PR would be nice since it is not related to decomposition and is just a one line fix.

Is there a preferred spot where you want the dependencies information for a circuit diagram ?

Yeah, you are right. It is probably better to put this on the installation page and a link to that in the user guide pages, maybe also in the error message?

I think it's better to also link latextools for circuit.

Sure, if that is a piece you find missing, then let's add it.

from qutip-qip.

BoxiLi avatar BoxiLi commented on August 27, 2024 1
$ apt-get install texlive
$ tlmgr install braket qcircuit

Last evening I tried this on WSL and there is an issue about apt-get install texlive. This installs a relatively old version (2017) and tlmgr provides the packages in a more recent version (2021). This results in the following error.

tlmgr: Remote repository is newer than local (2017 < 2021)

According to tudace/tuda_latex_templates#123, it is not recommended to install using the linux package manager. So one should install texlive manually.

from qutip-qip.

BoxiLi avatar BoxiLi commented on August 27, 2024

Ok... I'm actually using a Windows installer so never tried that myself. Are you using doc\requrements.txt which fixes all the versions? If you are, you could try to start from a fresh environment and install packages without using doc\requrements.txt, as stated here. Then hopefully conda will find a resolved environment and then you can update doc\requrements.txt accordingly.

Also, I'm not using pdflatex in conda but a separate TeX library manager. Could that be the problem?

from qutip-qip.

purva-thakre avatar purva-thakre commented on August 27, 2024

I think pdflatex might be the problem. The package is old and has not been updated in quite a while. The dependencies for this are older and they clash with newer dependencies installed for the development environment.

One of the possible workarounds for it is to install full TeX package. It's downloading now and will check later if this works. I think we might need to edit the instructions to at least have a lighter version of texlive or something else. Might need to check which tex packages are needed for pdflatex and install them only. I installed texlive-full and there wer a lot of unnecessary fonts etc installed as well.

from qutip-qip.

purva-thakre avatar purva-thakre commented on August 27, 2024

pdflatex is actually not the issue. With a full texlive installation, there were no dependency errors.

There's some incompatibility with imagemagick dependencies. Yesterday, the installation for imagemagick got stuck at below before I force stopped the process.

Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: - 

Today, it's trying to resolve the errors as shown below :

Solving environment: - 
Found conflicts! Looking for incompatible packages.
This can take several minutes.  Press CTRL-C to abort.
Examining conflict for tornado pygments matplotlib pyparsing python_abi sqlite

The instructions for imagemagick installation are a bit outdated. Maybe link this webpage on the installation instructions doc page ?

from qutip-qip.

BoxiLi avatar BoxiLi commented on August 27, 2024

Actually, there is no need to install the python package pdflatex at all. By pdflatex in the doc, I meant the common latex software like texlive.

Yeah, the installation guide for imagemagick needs some update. Maybe it is best to link both the repo and the official webpage https://imagemagick.org/script/download.php.

from qutip-qip.

purva-thakre avatar purva-thakre commented on August 27, 2024

By pdflatex in the doc, I meant the common latex software like texlive.

Yeah, my mistake yesterday was thinking pdflatex was separate package.

I have attached the conda imagemagick resolution output. You talked about updating reuiqrements.txt with these but there's a lot to resolve. I think at least switching to python 3.8 instead of 3.9 could work and I will try to go over this later. Unless someone is aware of an easier way to specify the packages by going through it, they are more than welcome to tackle this.
imagemagick_conda.txt

An easier workaround I found was to install imagemagick for the whole system via sudo instead of specific to the environment. I am not that familiar with what the differences between installation by conda, pip or apt-get install are.

Another one was to use a pip virtual environment instead of conda virtual environment. If a conda virtual environment then ipython specific to conda has to be installed.

from qutip-qip.

BoxiLi avatar BoxiLi commented on August 27, 2024

Oh, let's not dig into that resolution output. I was just saying that if you managed to get a working environment with everything successfully installed, we can update requirements.txt accordingly.

I guess using apt-get install installs all dependencies along with imagemagick in a whole piece as an app, independent of conda and the packages installed. So there is no need for any dependency resolving.

I'll also try it with Ubuntu. See if I can find something.

from qutip-qip.

purva-thakre avatar purva-thakre commented on August 27, 2024

I'll also try it with Ubuntu. See if I can find something.

Maybe hold on for a while.

I think this was an issue specific to my system and/or virtual environment. Even though all the needed packages are installed properly, there is no circuit diagram output because something is not working properly. If I try qc.png, there's no error message nor a picture output. I will try with a fresh environment and install everything again.

from qutip-qip.

BoxiLi avatar BoxiLi commented on August 27, 2024

You won't see the plot in a python or IPython console. It will only work properly on Jupyter Notebook. On a Python console, you will only get

>>> from qutip_qip.circuit import QubitCircuit
>>> qc = QubitCircuit(1)
>>> qc.add_gate("SNOT", 0)
>>> qc.png
<IPython.core.display.Image object>

Now I also tried a bit. First I noticed a bug. Because we moved Gate, the method _gate_label is now undefined. It slides through because at the moment there is no tests for circuit plotting. we can correct that with a from .operations.gates import _gate_label in circuit.py.

Apart from that, I agree that apt-get imagemagick is much easier on Ubuntu. Maybe we can then just link the official website of it and let the user decide how they want to install it.

Installing the correct latex package is a big problem in deed. I never tried that on Ubuntu. I haven't figured out how to install only core texlive (~300MB) and a few necessary dependencies, instead of the full texlive (~2.5GB). On Windows, I use MikTex which sweetly did everything for me dynamically (install when needed).

All that said, I'm also thinking about getting rid of all the tex dependencies... The installation is really clumsy, considering that this is a lite python package. I found this scripts https://github.com/rpmuller/PlotQCircuit. Maybe we can adopt this instead? It uses SymPy which is much easier to make as an optional package compared to tex. He is using BSD-2 License so we should be able to make a copy of it as part of qutip-qip, keeping the original copyright, is that correct? @nathanshammah @quantshah

from qutip-qip.

purva-thakre avatar purva-thakre commented on August 27, 2024

First I noticed a bug. Because we moved Gate, the method _gate_label is now undefined. It slides through because at the moment there is no tests for circuit plotting. we can correct that with a from .operations.gates import _gate_label in circuit.py.

Yes, I noticed this too. It will be included in the draft PR for single qubit decompositions. Would you prefer I make this a separate PR ?

You won't see the plot in a python or IPython console. It will only work properly on Jupyter Notebook

Thanks for this ! I was able to print <IPython.core.display.Image object> but was unsure why I couldn't get an image.

I'm also thinking about getting rid of all the tex dependencies...

Agree with this. We could make a plan for using PlotQCircuit.

from qutip-qip.

purva-thakre avatar purva-thakre commented on August 27, 2024

@BoxiLi Is there a preferred spot where you want the dependencies information for a circuit diagram ? I am confused if I should have it on the installation page or one of the user guide pages.

I think it's better to also link latextools for qcircuit. I followed the installation from source instructions on the currently linked page but some of its dependencies were not installed for some reason. So I installed the listed prerequisistes for latextools.

from qutip-qip.

BoxiLi avatar BoxiLi commented on August 27, 2024

For me, I need several additional packages xkeyval standalone generic xypic. I have to find them out by debugging on runtime (using breakpoint()). I don't think it is a way for normal users.

Also I need apt-get ghostscript

And I end up having this error

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.

Seems to be some new policy in imagemagick.

from qutip-qip.

purva-thakre avatar purva-thakre commented on August 27, 2024

Seems to be some new policy in imagemagick.

Yes, I had the same issue. You need to make some changes in policy.xml

Closing this because the errors are no longer an issue. The separate PR's discussed in this thread will be linking the specific comments in this thread.

A separate issue was also created to switch to a different package for circuit diagrams.

from qutip-qip.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.