Code Monkey home page Code Monkey logo

Comments (13)

1ucian0 avatar 1ucian0 commented on July 19, 2024 3

#28 merged. Please, reinstall from repository and let's check it.

from qiskit-quantinuum-provider.

mtreinish avatar mtreinish commented on July 19, 2024 1

I just merged #24 which changed some of the authentication bits, can you test with the current main branch and see if it's working. If it still doesn't work we'll need to get @chris-theroux or someone else at Quantinuum to take a look

from qiskit-quantinuum-provider.

chris-theroux avatar chris-theroux commented on July 19, 2024 1

I'll put up a fix to the README today.

We definitely want the project on pypi.
I'm not sure if I have the permissions to do a new release there.

@mtreinish can I handle this or do I need your help?

from qiskit-quantinuum-provider.

vprusso avatar vprusso commented on July 19, 2024

Hi @mtreinish.

Thanks for taking a look at this. I gave this another go and it still seems to be giving some grief. It's possible I'm doing something silly, so allow me to explicitly write out what I am attempting to do:

  1. Since the project is not on the Pypi server, I am pip installing via Git:
pip install https://github.com/qiskit-community/qiskit-quantinuum-provider/archive/refs/heads/master.zip
  1. Once installed, I attempt to run the import command as specified in the README.md file. Namely:
from qiskit_quantinuum import Quantinuum

which fails with:

Traceback (most recent call last):
  File "/Users/vincent.russo/Projects/research/unitary_fund/metriq-api/benchmark/benchmark/QC-App-Oriented-Benchmarks/quantum-fourier-transform/qiskit/qft_benchmark.py", line 403, in <module>
    from qiskit_quantinuum import Quantinuum
ModuleNotFoundError: No module named 'qiskit_quantinuum'
  1. If I run with a pip list, I do indeed see the package installed:
>>> pip list

...
qiskit                     0.42.1
qiskit-aer                 0.12.0
qiskit-ibmq-provider       0.20.2
qiskit-quantinuum-provider 0.4.0
...
  1. Since the package name is qiskit-quantinuum-provider and not qiskit-quantinuum, I also tried doing:
from qiskit_quantinuum_provider import Quantinuum

which also fails.

Is it possible I am doing something incorrectly here?

from qiskit-quantinuum-provider.

chris-theroux avatar chris-theroux commented on July 19, 2024

Hey @vprusso, taking a look at this. Will update soon

Update:
This should work:
from qiskit_quantinuum import Quantinuum
Ran into the same issue. Looking into why the import isn't working.

@mtreinish what do we need to do to get the package updated on pypi?

from qiskit-quantinuum-provider.

vprusso avatar vprusso commented on July 19, 2024

Hey @vprusso, taking a look at this. Will update soon

Update: This should work: from qiskit_quantinuum import Quantinuum Ran into the same issue. Looking into why the import isn't working.

@mtreinish what do we need to do to get the package updated on pypi?

For some reason GitHub doesn't notify me if a comment has been updated, so I just by luck saw that you updated this comment.

Regarding your update:

Update:
This should work:
from qiskit_quantinuum import Quantinuum
Ran into the same issue. Looking into why the import isn't working.

This still does not appear to work on my end. If you read the comment I made up above, I did indeed attempt this import pattern, but it fails.

Let me know if I can provide anything further that might be helpful in diagnosing this.

from qiskit-quantinuum-provider.

chris-theroux avatar chris-theroux commented on July 19, 2024

Hey, sorry wasn't clear. I meant you had to correct import and it 'should' work but isn't.

from qiskit-quantinuum-provider.

vprusso avatar vprusso commented on July 19, 2024

Hey, sorry wasn't clear. I meant you had to correct import and it 'should' work but isn't.

Gotcha. We're on the same page then :)

Thanks for confirming, and do let me know if anything can be helpful from my end!

from qiskit-quantinuum-provider.

chris-theroux avatar chris-theroux commented on July 19, 2024

Thanks for catching the issues!

I made a small fix that should hopefully clear up the import problem.
If it goes through I'll update here again.
#28

from qiskit-quantinuum-provider.

vprusso avatar vprusso commented on July 19, 2024

Thanks for catching the issues!

I made a small fix that should hopefully clear up the import problem. If it goes through I'll update here again. #28

Thanks for keeping me up-to-date! The fix you put in looks like a likely candidate for a fix. When it goes in, if you want to give me a ping, I'll give it a go! Thanks again, @chris-theroux

from qiskit-quantinuum-provider.

vprusso avatar vprusso commented on July 19, 2024

Hi @1ucian0,

Thanks for following up on this.

Indeed, I can now confirm that I can install (via git):

pip install --upgrade https://github.com/qiskit-community/qiskit-quantinuum-provider/archive/refs/heads/master.zip

and then perform the import statement properly:

from qiskit_quantinuum import Quantinuum

I'm so close to being able to run something. Attempting to follow the README:

    import os
    from qiskit_quantinuum import Quantinuum
    from qiskit import *

    Quantinuum.save_account(os.environ.get("QUANTINUUM_USERNAME"))

    backends = Quantinuum.backends()
    backend = Quantinuum.get_backend("H1-2E")
    qc = QuantumCircuit(2, 2)
    qc.h(0)
    qc.cx(0, 1)
    qc.measure([0,1], [0,1])
    result = execute(qc, backend).result()
    print(result.get_counts(qc))

Most of this runs fine (I can import qiskit_quantinuum without issue, save my account, and log in with no problem).

However, the line:

print(result.get_counts(qc))

results in the following error:

Traceback (most recent call last):
  File "/Users/vincent.russo/Projects/research/unitary_fund/metriq-api/benchmark/benchmark/QC-App-Oriented-Benchmarks/quantum-fourier-transform/qiskit/qft_benchmark.py", line 416, in <module>
    print(result.get_counts(qc))
          ^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/qiskit/result/result.py", line 269, in get_counts
    exp = self._get_experiment(key)
          ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/qiskit/result/result.py", line 380, in _get_experiment
    raise QiskitError('Data for experiment "%s" could not be found.' % key)
qiskit.exceptions.QiskitError: 'Data for experiment "circuit-119" could not be found.'

I imagine this is something that is most likely on the side of Quantinuum, but just putting here in case that's not right.

(Minor point):
If I may also suggest, it would be prudent I think to alter the README.md file to indicate that one still cannot install via pip from the PyPi server.

fyi @chris-theroux , @1ucian0

from qiskit-quantinuum-provider.

nathanshammah avatar nathanshammah commented on July 19, 2024

According to this note in the docstrings of the result() method, maybe removing qc from get_counts() may get it to work?

        Notes:
            Currently when calling get_counts() on a result returned by a Quantinuum
            backend, since Quantinuum backends currently support only running one
            experiment per job, do not supply an argument to the get_counts() function.
            Doing so may raise an exception.

@vprusso can you have a try? Thanks all for the support, @1ucian0 @chris-theroux.

from qiskit-quantinuum-provider.

vprusso avatar vprusso commented on July 19, 2024

According to this note in the docstrings of the result() method, maybe removing qc from get_counts() may get it to work?

        Notes:
            Currently when calling get_counts() on a result returned by a Quantinuum
            backend, since Quantinuum backends currently support only running one
            experiment per job, do not supply an argument to the get_counts() function.
            Doing so may raise an exception.

@vprusso can you have a try? Thanks all for the support, @1ucian0 @chris-theroux.

Yes, that did the trick!

Thanks to @chris-theroux and @1ucian0 for all the back-and-forth and work on this. Thanks as well to @nathanshammah for catching that in the docstrings.

Before we close this issue out, might I make two minor suggestions (mostly for the benefit of any other users who might be planning on using this package):

I would suggest either:

  1. Updating the install line in the README to:
pip install https://github.com/qiskit-community/qiskit-quantinuum-provider/archive/refs/heads/master.zip

and removing the PyPi badge on the README or

  1. Putting the package up on the PyPi server so that the install line in the README is correct.

Granted, I think it's definitely worth putting on PyPi, so as an alternative, perhaps it's worthwhile to do that, but I'll leave that ball in your court as to what makes the most sense.

Additionally, I would make the following adaptation to the example in the README:

from qiskit import *
qc = QuantumCircuit(2, 2)
qc.h(0)
qc.cx(0, 1)
qc.measure([0,1], [0,1])
result = execute(qc, backend).result()
print(result.get_counts())

(Note that the qc object has been removed from the get_counts function.

Thanks again, @chris-theroux , @1ucian0 and @nathanshammah !

from qiskit-quantinuum-provider.

Related Issues (9)

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.