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

[qiskit 0.33.0] Error - cannot execute a circuit-runner program #53

Closed
fvarchon opened this issue Dec 8, 2021 · 3 comments
Closed

[qiskit 0.33.0] Error - cannot execute a circuit-runner program #53

fvarchon opened this issue Dec 8, 2021 · 3 comments
Labels
bug Something isn't working

Comments

@fvarchon
Copy link
Collaborator

fvarchon commented Dec 8, 2021

Describe the bug
circuit-runner ends in JobStatus.ERROR: 'job incurred error'

RuntimeJobFailureError: 'Unable to retrieve job result. Job c6oeij749l014bc1li40 has failed:\n2021-12-08T17:20:17.898524224Z /usr/local/lib/python3.8/site-packages/qiskit/circuit/qpy_serialization.py:1044: UserWarning: The qiskit version used to generate the provided QPY file, 0.19.0, is newer than the current qiskit version 0.18.3. This may result in an error if the QPY file uses instructions not present in this current qiskit version\n2021-12-08T17:20:17.898607193Z   warnings.warn(\n2021-12-08T17:20:17.900382476Z Traceback (most recent call last):\n2021-12-08T17:20:17.900445376Z   File "/code/program_starter.py", line 61, in <module>\n2021-12-08T17:20:17.900466190Z     user_params = json.loads(params, cls=RuntimeDecoder)\n2021-12-08T17:20:17.900484234Z   File "/usr/local/lib/python3.8/json/__init__.py", line 370, in loads\n2021-12-08T17:20:17.900502446Z     return cls(**kw).decode(s)\n2021-12-08T17:20:17.900524499Z   File "/usr/local/lib/python3.8/json/decoder.py", line 337, in decode\n2021-12-08T17:20:17.900540271Z     obj, end = self.raw_decode(s, idx=_w(s, 0).end())\n2021-12-08T17:20:17.900557031Z   File "/usr/local/lib/python3.8/json/decoder.py", line 353, in raw_decode\n2021-12-08T17:20:17.900574133Z     obj, end = self.scan_once(s, idx)\n2021-12-08T17:20:17.900591325Z   File "/usr/local/lib/python3.8/site-packages/qiskit/providers/ibmq/runtime/utils.py", line 229, in object_hook\n2021-12-08T17:20:17.900608293Z     return _decode_and_deserialize(obj_val, qpy_serialization.load)[0]\n2021-12-08T17:20:17.900624306Z   File "/usr/local/lib/python3.8/site-packages/qiskit/providers/ibmq/runtime/utils.py", line 87, in _decode_and_deserialize\n2021-12-08T17:20:17.900642771Z     orig = deserializer(buff)\n2021-12-08T17:20:17.900659013Z   File "/usr/local/lib/python3.8/site-packages/qiskit/circuit/qpy_serialization.py", line 1053, in load\n2021-12-08T17:20:17.900676157Z     circuits.append(_read_circuit(file_obj))\n2021-12-08T17:20:17.900692123Z   File "/usr/local/lib/python3.8/site-packages/qiskit/circuit/qpy_serialization.py", line 1058, in _read_circuit\n2021-12-08T17:20:17.900709416Z     header, name, metadata = _read_header(file_obj)\n2021-12-08T17:20:17.900725306Z   File "/usr/local/lib/python3.8/site-packages/qiskit/circuit/qpy_serialization.py", line 467, in _read_header\n2021-12-08T17:20:17.900741567Z     metadata = json.loads(metadata_raw)\n2021-12-08T17:20:17.900759109Z   File "/usr/local/lib/python3.8/json/__init__.py", line 343, in loads\n2021-12-08T17:20:17.900775347Z     s = s.decode(detect_encoding(s), \'surrogatepass\')\n2021-12-08T17:20:17.900792170Z   File "/usr/local/lib/python3.8/encodings/utf_32_be.py", line 11, in decode\n2021-12-08T17:20:17.900807579Z     return codecs.utf_32_be_decode(input, errors, True)\n2021-12-08T17:20:17.900823068Z UnicodeDecodeError: \'utf-32-be\' codec can\'t decode bytes in position 4-7: code point not in range(0x110000)\n'

Steps to reproduce

circ = QuantumCircuit(2)
circ.h(0)
circ.cx(0,1)
circ.measure_all()
from qiskit.providers.ibmq import RunnerResult
backend=provider.backend.ibmq_qasm_simulator

program_inputs = {
    'circuits': circ,
}
options = {'backend_name': backend.name()}

job = provider.runtime.run(program_id="circuit-runner",
                           options=options,
                           inputs=program_inputs,
                          )
result = job.result(decoder=RunnerResult)

Expected behavior
Same job runs OK in qiskit 0.32.0 & 0.32.1

Additional Information

  • Qiskit version: qiskit 0.33.0 (local and Quantum Lab)
  • Python version: 3.8.3
  • Operating system: W10
@fvarchon fvarchon added the bug Something isn't working label Dec 8, 2021
@LenaPer
Copy link

LenaPer commented Dec 9, 2021

I have the same kind of error with the VQEProgram :

---------------------------------------------------------------------------
RuntimeJobFailureError                    Traceback (most recent call last)
/opt/anaconda3/envs/qiskit33/lib/python3.8/site-packages/qiskit_nature/runtime/vqe_program.py in compute_minimum_eigenvalue(self, operator, aux_operators)
    281         try:
--> 282             result = job.result()
    283         except Exception as exc:

/opt/anaconda3/envs/qiskit33/lib/python3.8/site-packages/qiskit/providers/ibmq/runtime/runtime_job.py in result(self, timeout, wait, decoder)
    150             if self._status == JobStatus.ERROR:
--> 151                 raise RuntimeJobFailureError(f"Unable to retrieve job result. "
    152                                              f"{self.error_message()}")

RuntimeJobFailureError: 'Unable to retrieve job result. Job c6oslgutpkrb4a8528tg has failed:\n2021-12-09T09:22:16.872880026Z Traceback (most recent call last):\n2021-12-09T09:22:16.872924208Z   File "/code/program_starter.py", line 61, in <module>\n2021-12-09T09:22:16.872934511Z     user_params = json.loads(params, cls=RuntimeDecoder)\n2021-12-09T09:22:16.872940295Z   File "/usr/local/lib/python3.8/json/__init__.py", line 370, in loads\n2021-12-09T09:22:16.872948511Z     return cls(**kw).decode(s)\n2021-12-09T09:22:16.872961384Z   File "/usr/local/lib/python3.8/json/decoder.py", line 337, in decode\n2021-12-09T09:22:16.872967043Z     obj, end = self.raw_decode(s, idx=_w(s, 0).end())\n2021-12-09T09:22:16.872970630Z   File "/usr/local/lib/python3.8/json/decoder.py", line 353, in raw_decode\n2021-12-09T09:22:16.872979221Z     obj, end = self.scan_once(s, idx)\n2021-12-09T09:22:16.872985246Z   File "/usr/local/lib/python3.8/site-packages/qiskit/providers/ibmq/runtime/utils.py", line 229, in object_hook\n2021-12-09T09:22:16.872991404Z     return _decode_and_deserialize(obj_val, qpy_serialization.load)[0]\n2021-12-09T09:22:16.872997088Z   File "/usr/local/lib/python3.8/site-packages/qiskit/providers/ibmq/runtime/utils.py", line 87, in _decode_and_deserialize\n2021-12-09T09:22:16.873003717Z     orig = deserializer(buff)\n2021-12-09T09:22:16.873009503Z   File "/usr/local/lib/python3.8/site-packages/qiskit/circuit/qpy_serialization.py", line 1053, in load\n2021-12-09T09:22:16.873015140Z     circuits.append(_read_circuit(file_obj))\n2021-12-09T09:22:16.873020644Z   File "/usr/local/lib/python3.8/site-packages/qiskit/circuit/qpy_serialization.py", line 1058, in _read_circuit\n2021-12-09T09:22:16.873028100Z     header, name, metadata = _read_header(file_obj)\n2021-12-09T09:22:16.873033730Z   File "/usr/local/lib/python3.8/site-packages/qiskit/circuit/qpy_serialization.py", line 467, in _read_header\n2021-12-09T09:22:16.873039049Z     metadata = json.loads(metadata_raw)\n2021-12-09T09:22:16.873044260Z   File "/usr/local/lib/python3.8/json/__init__.py", line 343, in loads\n2021-12-09T09:22:16.873054760Z     s = s.decode(detect_encoding(s), \'surrogatepass\')\n2021-12-09T09:22:16.873060800Z   File "/usr/local/lib/python3.8/encodings/utf_32_be.py", line 11, in decode\n2021-12-09T09:22:16.873060856Z     return codecs.utf_32_be_decode(input, errors, True)\n2021-12-09T09:22:16.873073215Z UnicodeDecodeError: \'utf-32-be\' codec can\'t decode bytes in position 4-7: code point not in range(0x110000)\n'

The above exception was the direct cause of the following exception:

RuntimeError                              Traceback (most recent call last)
<ipython-input-15-514be2738cef> in <module>
----> 1 runtime_result = runtime_vqe.compute_minimum_eigenvalue(hamiltonian)

/opt/anaconda3/envs/qiskit33/lib/python3.8/site-packages/qiskit_nature/runtime/vqe_program.py in compute_minimum_eigenvalue(self, operator, aux_operators)
    282             result = job.result()
    283         except Exception as exc:
--> 284             raise RuntimeError(f"The job {job.job_id()} failed unexpectedly.") from exc
    285 
    286         # re-build result from serialized return value

RuntimeError: The job c6oslgutpkrb4a8528tg failed unexpectedly.

@jyu00
Copy link
Collaborator

jyu00 commented Dec 9, 2021

@fvarchon @LenaPer The error is because Qiskit Runtime is still at Qiskit 0.32, and data serialized by 0.33 QPY will not work with 0.32. We are waiting for a QPY fix in qiskit-terra before upgrading. For the time being it should work if you continue using Qiskit 0.32. I'll close this once Qiskit Runtime is updated.

@jyu00
Copy link
Collaborator

jyu00 commented Dec 10, 2021

Qiskit Runtime has been updated to Qiskit 0.33.1. Please update your Qiskit version to 0.33.1, since it has important fixes on encoder we use to send data to Runtime. Thanks for your patience!

@jyu00 jyu00 closed this as completed Dec 10, 2021
daka1510 pushed a commit to daka1510/qiskit-ibm-runtime that referenced this issue Jan 11, 2022
jyu00 added a commit that referenced this issue Jan 11, 2022
* Initial commit

* [WIP] Add RuntimeResult class

* change headers

* cleanup

* add setup file

* Add a quasidistribution test

* style fixes

* Start the documentation

* Add classes

* Add result to docs

* fix header

* tweak doc string

* add intro and upload tutorials

* remove bad import

* update some texts

* move things into circuit-runner folder

* rename to RunnerResult

* move to runner

* update to runner dir

* rename apidoc entry

* fix directories

* Move to automodapi

* remove unused docs

* fix what I thought I fixed earlier

* update docs requirements

* add to/from json

* Fix docs doing inherited members

* rename intro

* fix json

* add circuit runner tutorial

* update README

* version should be string

* add shields

* fix json

* fix plot

* add 120x wording

* Add CI configuration (#8)

* Add CI configuration

This commit adds a basic CI configuration for the qiskit-runtime
repository. It adds 3 jobs, a unittest job that runs the repository's
sole unit test on all supported platforms, a docs build job that
verifies the docs build, and a doc publishing job that will build the
documentation on tags and upload the built html to
https://qiskit.org/documentation/partners/qiskit_runtime . We should add
some lint/style jobs but that can be done in a follow up commit because
it's likely that we'll need to update the code to conform to whichever
tooling we decide on.

* Add missing docs artifact upload to docs PR/Push ci job

* Fix typo in deploy_documentation.sh

The output path for the built documentation is `docs/_build/html`
not `docs/build/html`.

* Add ``VQEProgram``  (#9)

* VQEProgram + lightweight tests

* fix aux_values

* add tutorial

* small fixes

* fix allowed settings for qn-spsa
* fix missing optimal_value in result dict
* remove print of job id

* add tutorial

* remove old tutorial

* rm tutorial from this PR

* fix leftover todos

* rename program_name to program_id
* callback stddev has been fixed
* initial_point can be none
* also cast aux_ops to PauliSumOp

* Adding QKA files (#12)

* Create kernel_matrix.py

* Create featuremaps.py

* Create temp.py

* Add files via upload

* Delete temp.py

* Add a tutorial for the VQE script and ``VQEProgram`` (#11)

* add tutorial

* update the VQE tutorital texts

replace runtime for Qiskit Runtime. and add some context to differientate Qiskit Runtime programs, and Qiskit Runtime service

* rerun notebook once to get final cell executed

* add link to qiskit nature tutorials

Co-authored-by: Ismael Faro <Ismael.Faro1@ibm.com>

* Fix circuit runner parameters (#14)

* fix runner parameters

* remove update_program

* add job retrieval to intro

* Move circuit runner tests (#15)

* remove program update from title (#16)

* Add docs logistics (#17)

* Add docs logistics

* add nbsphinx

* Add some frontmatter (#18)

* Add docs meat (#19)

* Add some frontmatter

* updates

* tweaks

* add links (#20)

* Start a list of current runtime limitations (#21)

* Add runtime limitations

* add note about missing upload support

* Tweak the nav bar to simplify things (#22)

* Tweak the nav bar to simplify things

* slide in a text fix

* fix a lint error

* Fix README text and link (#24)

* fix install in README

* fix tutorial link

* Add init file (#25)

* Create __init__.py

* Update featuremaps.py

* Update kernel_matrix.py

* add API direct tutorial (#30)

* runtime to program inputs (#28)

* update the installation process (#33)

* update the installation process

* update qiskit install to force update

* Add lint configuration and run in CI (#27)

This commit adds a lint configuration based on the current pattern used
in upstream Qiskit. Leverage black for auto code formatting and then
pylint for a deeper analysis and catch common issues. The code style is
updated to then conform to these guidelines.

Fixes #23

* Remove API docs (#34)

* remove api docs

* remove unused test

* Update installation wording in README (#35)

* update installation wording

* add additional requirements

* a word

* remove unused badges

* move runnerresult import (#36)

* Move api direct tutorial from 05 to 01 (#32)

* move api direct tutorial

* number uploading

* renumber

* Update intro wording (#39)

* fix wording and directory

* update intro tutorial

* update qiskit requirements (#41)

* Add circuit runner overview (#40)

* Add circuit runner overview

* remove VQE listed twice

* specify it is an overview section

* move circuit runner nb to tutorials

* Move REST API to navbar (#42)

* Move REST API to navbar

* update arch image while I am here

* capitalize Runtime

* Update getting started (#43)

* Update the getting started.

* add links to the IQX docs

* Build docs on merges with main (#44)

* Fix source path for docs upload

The tools/deploy_documentation.sh script had a typo and was trying to upload the wrong
source path which was causing a job error. This commit fixes the path so that the built
documentation will actually be uploaded.

* Update VQE tutorial (#45)

* update to latest VQEProgram version from nature

* update imoprt location and REM -> MEM, and re-run

* add nature to the requirements

* Add qka files and figs (#37)

* Create qka.py

* Add figs for qka notebook

* Add qka notebook

* Update qka.ipynb

* Update requirements.txt

added `pandas` and `scikit-learn`

* Delete qka.ipynb

* Upload updated qka notebook

* Update qka.py

Fix linter errors

* Update qka.py

Fix more linter errors

* Update qka.py

Fix one more tiny linter error

* Update qka.py

Fix more linter errors

* Update qka.py

* Update qka.py

* Delete chip.png

* Delete subgraphs.png

* Add images for the QKA tutorial

* Update QKA tutorial with new image location

* Update qka.py

* Update qka.py

fix more linter errors

* Update qka.py

and some more

* Update qka.py

* Update qka.py

fix missing return type doc

* Update qka.py

* Create temp.py

* Add images for qka to tutorials folder

* Delete qka.ipynb

* Add updated qka tutorial

* Delete temp.py

* Update path to images

* Update path again

* update path one more time

* Delete qka.ipynb

* Add updated tutorial

* Delete qka.ipynb

* Add qka tutorial with updated eqrefs

* Update qka.py

Update comment and remove `warnings`

* Delete chip.png

* Delete subgraphs.png

* add qka and remove vqe (#47)

* Update documentation about simulator access (#49)

* update doc on access

* make wording more generic

* Update 01_circuit_runner.ipynb (#50)

Minor editing suggestions.

* Rename runtime-simple to sample-program (#52)

* rename simple program to sample

* fix import

* add querying for backends (#53)

* remove 5 circ limit on circuit runner (#55)

* remove 5 circ limit on circuit runner

* remove payload size from readme

* 63 Add tests (#62)

* remove vqe program and tests

* add empty test file

* Revert "remove vqe program and tests"

This reverts commit 463986347a660e2bae99f26c880780be6d19e4b6.

* add tests

* address some comments

* address comments

* format

* address comments

* address comments

* address comments and fix lint

* fix serialize inputs

Co-authored-by: Lucy-Xing <Lucy.Xing@ibm.com>

* Update tutorials (#65)

* update tutorials

* return final result

* fix test

* use returned result

* lint fix

* add to docstring

* add return type

Co-authored-by: Lucy-Xing <Lucy.Xing@ibm.com>

* Add IEEE workshop tutorial (#67)

* add ieee tutorial

* rename file

* use image files

* Remove system limitation (#68)

* remove system limitation

* remove simulators

* update upload tutorial (#69)

* update upload tutorial

* add more details

* address comments

* update tutorial (#71)

* update requirements (#72)

* Move IEEE tutorial (#73)

* move ieee tutorial

* fix wording

* Circuit runner tutorial not using proper format (#74)

* add binary_probabilities

* remove has_service call

* use quasi obj

* fix max execution time

* Update README.md (#75)

* Update README.md (#76)

* Add full custom program tutorial (#77)

* fix some typos, lang consistency, etc. (#78)

* fix some typos, lang consistency, etc.

* Update tutorials/sample_vqe_program/qiskit_runtime_vqe_program.ipynb

oops missed one

* Add back cell contents (#79)

* Tweaks to full example based on review (#80)

* tweaks based on review

* one more tweak

* Fix readme to avoid saying premium users (#81)

* avoid premium

* fix format

* Add UUID to program name in full example (#82)

* Add custom expval program (#83)

* Add custom expval program

* Add QV example

* Update IEEE tutorial (#84)

* add qce21 tutorial

* revert accidental changes

* minor update the sample expval program (#85)

* Add missing files (#86)

* add missing files

* add vqe

* fix version

* Update tutorials (#90)

* Update tutorials

* Undo changes about which backend was used

* Remove version from 02_uploading_program

* Fixes

- Update metadata for sample_expval and sample_vqe_program
- Undo backend change in execution_count 7 of 01_circuit_runner

* Update cells where programs are printed

* Update tutorials sample notebooks

* Fixes for tutorials sample notebooks

* Update tutorials/02_uploading_program.ipynb

Co-authored-by: Jessie Yu <jessieyu@us.ibm.com>

* Address PR comments

- Remove last cell with version info in 00_introduction
- Rerun cell with spec populated

Co-authored-by: Jane Kwon <janeheekwon@ibm.com>
Co-authored-by: Jessie Yu <jessieyu@us.ibm.com>

* Update wording on public programs (#88)

* update wording on public programs

* consistent wording

* update Qiskit version

* Add link to article on 120x quantum speedup (#91)

* Introduction Tutorial - more updates (#92)

* More tutorial updates

* Update tutorials/00_introduction.ipynb

Co-authored-by: Jessie Yu <jessieyu@us.ibm.com>

* Fix review comments

* lower case

Co-authored-by: Jessie Yu <jessieyu@us.ibm.com>

* Update tutorials for ibmq-provider 0.18 (#93)

* reflect ibmq provider 0.18 changes

* fix 02

* program names need not be unique

* no more version

* QAOA runtime (#94)

* * QAOA runtime.

* * Runtime script.

* * Black.

* 71 rename sample_program to hello_world (#96)

* rename to hello_world

* update docs

* add back sample program

* Update qiskit_runtime/hello_world/hello_world.py

Co-authored-by: Jessie Yu <jessieyu@us.ibm.com>

* Update qiskit_runtime/sample_program/sample_program.json

Co-authored-by: Jessie Yu <jessieyu@us.ibm.com>

Co-authored-by: Jessie Yu <jessieyu@us.ibm.com>

* remove files/folders no longer needed

* delete notebook that is no longer needed

Co-authored-by: Jessie Yu <jessieyu@us.ibm.com>
Co-authored-by: Paul Nation <nonhermitian@gmail.com>
Co-authored-by: Ismael Faro <Ismael.Faro1@ibm.com>
Co-authored-by: Matthew Treinish <mtreinish@kortar.org>
Co-authored-by: Julien Gacon <gaconju@gmail.com>
Co-authored-by: Jen Glick <41485571+jenglick@users.noreply.github.com>
Co-authored-by: Ismael Faro Sertage <ismael.faro.sertage@gmail.com>
Co-authored-by: beckykd <66339736+beckykd@users.noreply.github.com>
Co-authored-by: Lucy Xing <88128115+LucyXing@users.noreply.github.com>
Co-authored-by: Lucy-Xing <Lucy.Xing@ibm.com>
Co-authored-by: Jay Gambetta <jay.gambetta@us.ibm.com>
Co-authored-by: abbycross <across@us.ibm.com>
Co-authored-by: Hwajung Kang <hwajungkang@gmail.com>
Co-authored-by: kwoane <12764049+kwoane@users.noreply.github.com>
Co-authored-by: Jane Kwon <janeheekwon@ibm.com>
Co-authored-by: Rathish Cholarajan <rathishc24@gmail.com>
Co-authored-by: Daniel J. Egger <38065505+eggerdj@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants