diff --git a/CHANGELOG.md b/CHANGELOG.md index b116c8d90..6cbba484b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ ## 4.0.0 -The 4.0 release of pyQuil migrates its core functionality into Rigetti's latest generation of Rust SDKs. With this comes access to new features, improved performance, stronger type safety, and better error messages. While this is a significant change for the internals of pyQuil, we've attempted to keep breaking changes to a minimum. Unless necessary, we've chosen to only remove redunant or lesser used features that aren't likely to bother most users. +The 4.0 release of pyQuil migrates its core functionality into Rigetti's latest generation of Rust SDKs. With this comes access to new features, improved performance, stronger type safety, and better error messages. While this is a significant change for the internals of pyQuil, we've attempted to keep breaking changes to a minimum. Unless necessary, we've chosen to only remove redundant or lesser used features that aren't likely to bother most users. ### Breaking Changes @@ -12,6 +12,7 @@ The 4.0 release of pyQuil migrates its core functionality into Rigetti's latest - Python 3.7 is no longer supported. - The environment variable overrides for `quilc` and `QVM` URLs have been renamed to `QCS_APPLICATIONS_QUILC_URL` and `QCS_APPLICATIONS_QVM_URL`, respectively. - The `QuantumComputer`'s `run` method now takes an optional `memory_map` parameter. This mapping takes memory region names to a list of values to use for a run. This replaces the ability to use `write_memory` on `Program`s. +- `Pragma("DELAY", ...)` will now raise a parser error because it generates invalid Quil. Use the `Delay` instruction instead. ### Features @@ -21,6 +22,8 @@ The 4.0 release of pyQuil migrates its core functionality into Rigetti's latest - Better error messages when a request fails - The improved Rust backend allows on-demand access to a QPU. - The new `QPUCompilerAPIOptions` class provides can now be used to customize how a program is compiled against a QPU. +- The `diagnostics` module has been introduced with a `get_report` function that will gather information on the currently running pyQuil +installation, perform diagnostics checks, and return a summary. ## 3.5.4 diff --git a/docs/source/troubleshooting.rst b/docs/source/troubleshooting.rst index 292291438..be1ec1e5d 100644 --- a/docs/source/troubleshooting.rst +++ b/docs/source/troubleshooting.rst @@ -7,7 +7,7 @@ If you're having any trouble running your pyQuil programs locally or on the QPU, following things before sending a support request. It will save you time and make it easier for us to help! -Timeout in Compilation +Timeout in compilation ---------------------- This may occur due to the size of your program, problems with your local ``quilc`` service, or problems @@ -18,26 +18,26 @@ with the remote QCS API. 3. If you have a larger program and expect it to take a long time to compile, set a higher ``compiler_timeout`` value per the instructions here: :ref:`compiler`. -Timeout in Execution +Timeout in execution -------------------- This may occur due to one of several different problems. Often, it's because you don't have network access to the execution endpoint. -If you're running against the QVM, ensure that it is properly running: :ref:`server`. If you're using docker, +If you're running against the QVM, ensure that it's running: :ref:`server`. If you're using docker, you can check this using ``docker ps``. If you're running against the QPU, ensure that you are running your program from a supported environment. Live Rigetti QPUs are **only accessible from Rigetti-provided environments**, such as `JupyterHub `_. If you are running from anywhere else, such as a script on your local computer or a public cloud virtual machine, -**your program will not be able to reach a QPU and will time out**. +**your program won't be able to reach a QPU and will time out**. -Collect Debug Information ----------------------------- +Collect debug information +------------------------- 1. Ensure that your pyQuil version is up to date. If you're using ``pip``, you can do this with - ``pip freeze``. Within your script, you can use ``__version__``: + ``pip show pyquil``. Within your script, you can use ``__version__``: .. testcode:: version @@ -51,28 +51,41 @@ Collect Debug Information You can update pyQuil with ``pip`` using ``pip install pyquil --upgrade``. You can find the latest version available at - `our releases page `_ or + `the releases page `_ or `on PyPi `_. -2. If the error appears to be authentication-related, refer to the `QCS CLI documentation -`_. -3. Run your script with debug logging enabled. If you're running a script, you can enable that - using an environment variable: +2. pyQuil exposes a diagnostics report that prints helpful debugging information, including + whether you have connectivity to ``quilc``, ``QVM`` and access to QCS services. You can + use it by importing a function from the ``diagnostics`` module: + + .. testcode:: version + + from pyquil.diagnostics import get_report + print(get_report()) + + .. testoutput:: version + :hide: + + ... + + Use this report to confirm you have connectivity to the services you need and that your + environment matches what you expect. - .. code:: - LOG_LEVEL=DEBUG pyquil my_script.py +3. Run your script with debug logging enabled by adding the following to the top of your script: .. testcode:: python import logging - from pyquil.api._logger import logger + logging.basicConfig(level=logging.DEBUG) - logger.setLevel(logging.DEBUG) + .. note:: For information on how to filter the logs, see the `qcs-sdk-python logging documentation `_ If the problem still isn't clear, then we can help! Please file an issue on the `GitHub repo `_ if it's an issue with pyQuil itself, -or contact us at our `support page `_ for problems with QCS. +or contact us at our `support page `_ for problems with QCS. If applicable, +be sure to include the diagnostics report and debug logs from above as they will help us better +diagnose the problem. Thanks for using pyQuil! diff --git a/poetry.lock b/poetry.lock index dd7dddfc0..2f4ac1563 100644 --- a/poetry.lock +++ b/poetry.lock @@ -2416,46 +2416,49 @@ cffi = {version = "*", markers = "implementation_name == \"pypy\""} [[package]] name = "qcs-sdk-python" -version = "0.10.3rc1" +version = "0.10.8" description = "Python interface for the QCS Rust SDK" category = "main" optional = false python-versions = "*" files = [ - {file = "qcs_sdk_python-0.10.3rc1-cp310-cp310-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl", hash = "sha256:d672792c809a247bc6f919a266a477b6b624c81f228b0341e88ea3fe93ff6b99"}, - {file = "qcs_sdk_python-0.10.3rc1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:6a8a54ed0e2bcf312d0c7f2cad91f7c4fd356e5c95a746514c43b5fd676695bc"}, - {file = "qcs_sdk_python-0.10.3rc1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:389285c409990327fb5df243238b91774f6e1bcee514e23b774b96172060132b"}, - {file = "qcs_sdk_python-0.10.3rc1-cp311-cp311-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl", hash = "sha256:2e5f34f8e3240f5a60f180e048de2125872e942f287404e79c2f8b8c83affa2a"}, - {file = "qcs_sdk_python-0.10.3rc1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:69499ccc77c4fdfd632bee344d1fad8f4192eac775cb39b028e06398e77477d7"}, - {file = "qcs_sdk_python-0.10.3rc1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b203a75172e91a043edd76fa34c879b91821da164548a4533fec2f2bde80e772"}, - {file = "qcs_sdk_python-0.10.3rc1-cp38-cp38-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl", hash = "sha256:ca9c492f6dd7259e0bb12f8a8be78332941e3ef4cec35e3dd5b86b40f9ace94e"}, - {file = "qcs_sdk_python-0.10.3rc1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:b8eeb1e46a25a9daea7f2a5213f1da4fa63af3dbdcc48f1432a09ff6d2bd0b64"}, - {file = "qcs_sdk_python-0.10.3rc1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:834159e779ba82212fc644052280faa8a98e603b1a0f142350688e7405584bd6"}, - {file = "qcs_sdk_python-0.10.3rc1-cp39-cp39-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl", hash = "sha256:c21b71489ed33d9f68392253bb308d4a9337542a1c6c2e6f96157978265275b1"}, - {file = "qcs_sdk_python-0.10.3rc1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:15c25c2745ce39eaca351ebf8ce1cf8c6d6075d0e85d22bda5704c7bac7dd1a2"}, - {file = "qcs_sdk_python-0.10.3rc1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9bc60c31503458ecf5fee2203a7099eee0205748cff7024a362fdd62db2911e3"}, + {file = "qcs_sdk_python-0.10.8-cp310-cp310-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl", hash = "sha256:61710e50f43e15809ed7f29eef6b52e590a629d133943beb8a8c5ce8aca2eb39"}, + {file = "qcs_sdk_python-0.10.8-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1dd96091379b37d8eec463c004d54cf961983fd21e8e46aec787bb16a7656781"}, + {file = "qcs_sdk_python-0.10.8-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e6bffc38a0c3dfebcff3097f09527c4c93a6ee254ead8e114ca4e6084a089d99"}, + {file = "qcs_sdk_python-0.10.8-cp311-cp311-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl", hash = "sha256:2f3d0257c5cf214719a045d9fa5e3f655129c3647ab3878ce6af857b0248860d"}, + {file = "qcs_sdk_python-0.10.8-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:6e6d84ea52fefff2946ea3ea1f2b3fd363586e1d3a61672bb25f429953922f70"}, + {file = "qcs_sdk_python-0.10.8-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:bf5bf0cf949e1d1b25ecc786a0aae008d9e12083445eb6f453f9ec768f699390"}, + {file = "qcs_sdk_python-0.10.8-cp38-cp38-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl", hash = "sha256:387efb6bf7b802092e5aa181b172c91a9658aa359c5d473dfcfa1511a559d3c0"}, + {file = "qcs_sdk_python-0.10.8-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a1828876727ee47042d9da22749108ae87b4672a19a1bbba81e6c4c4122dcc7d"}, + {file = "qcs_sdk_python-0.10.8-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b2027dd9abd4673d62b61c27f492d789eedadeb7bbb3112f26b168c707ace45c"}, + {file = "qcs_sdk_python-0.10.8-cp39-cp39-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl", hash = "sha256:07b7413b8301254a89bfe45a426cddc4de0588795cea63945c6fb04ad5c5487c"}, + {file = "qcs_sdk_python-0.10.8-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:3ee0208edf8525195c1795c16766691b8758eb6fccdbaeeae226571b0f5e7fbe"}, + {file = "qcs_sdk_python-0.10.8-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8b0a7edf52b31630076e9e816bfb836b63f7e086280fd48e96da5989dc16f078"}, ] +[package.dependencies] +quil = "0.4.0" + [[package]] name = "quil" -version = "0.1.1" +version = "0.4.0" description = "A Python package for building and parsing Quil programs." category = "main" optional = false python-versions = ">=3.8" files = [ - {file = "quil-0.1.1-cp310-cp310-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl", hash = "sha256:526163b1fea7328caff0df11c8c3b9d2257a6fcc78c1db2283b049bd150677bd"}, - {file = "quil-0.1.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:df7741aa2a7a876a3e4f99c1c96724e4995d54a61b770d4cd112030ea0db9e98"}, - {file = "quil-0.1.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:aa0de6d29013cf9d931c3e6392e6db282f416bd1440bf933e4031b012c41d63f"}, - {file = "quil-0.1.1-cp311-cp311-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl", hash = "sha256:01caf59e5c5ff2a5780484ba077d9127d449403ad87dc1002e8456f7c3fbb6ab"}, - {file = "quil-0.1.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ca7e1732db27f01ae634ad847c96052039e07bce3f6269ebf3dff4ec64c32577"}, - {file = "quil-0.1.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3802b55c9af0c6f6626e4756fbd65bc89c914c018d76af4c1c2551aa2ee30e26"}, - {file = "quil-0.1.1-cp38-cp38-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl", hash = "sha256:187cb4d84a5ca4558ff60a6a73855116340095581f48d8fb9f5593be56a967fa"}, - {file = "quil-0.1.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ee05b2bdb9627e457d147d7dc331e11a38409b6e04b670c8c679f9476cd73b0c"}, - {file = "quil-0.1.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:56f565ce48f6b3294567a8efb1c56d7f2ee22c5ec939db4ae057b2800931a628"}, - {file = "quil-0.1.1-cp39-cp39-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl", hash = "sha256:1d8261377bf3f4104e2cde58059f8968377eca217031171e977a88cd7dbea422"}, - {file = "quil-0.1.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:4da5a3016af1cc23cb139891fceb698f1404eafd9f19c3fc70523f073966e97b"}, - {file = "quil-0.1.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7e4fadf2ee94779b5a05b6ff45bcbb056a7cff54830b68efb71076353fc9cb12"}, + {file = "quil-0.4.0-cp310-cp310-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl", hash = "sha256:a0693d6bf875fda6763e29a288463e477b7b32daff5206679c30462e0af0b33f"}, + {file = "quil-0.4.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5203933517aee6e2ce86b974dd6a6e60acd2a15c503c1a169ed26077ef0d7912"}, + {file = "quil-0.4.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d3f0c39ada33f5af30357cbb25476b1f1cdb16a1906aeb917071d7253b659bc4"}, + {file = "quil-0.4.0-cp311-cp311-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl", hash = "sha256:1c66a1cac2b3623210692f0199d4d246a0b1f65762cad509c3903b4964b9e10b"}, + {file = "quil-0.4.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:dbfdaefe09e7f0b73dcef17496cda271a94ed8e72e3ebc2f537d07c5e49eb0ac"}, + {file = "quil-0.4.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:1401c67a0d524308c4527da3e25f7a1f1b99d765efbdc52aca4b34f30a526b0c"}, + {file = "quil-0.4.0-cp38-cp38-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl", hash = "sha256:dc75d9c4371a8fdbdead9cda9e07913082b9dd67f00fbfdc1de4ec9c5cb2b7bf"}, + {file = "quil-0.4.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:7493ffecb808688adaee4e070883a763110aba3fc68c6c0f2f0dbf8e768cbb89"}, + {file = "quil-0.4.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:84c5bc8c0380fe67d0ab41547626a5034ba345756e1f2df1876ecd087a5954be"}, + {file = "quil-0.4.0-cp39-cp39-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl", hash = "sha256:9cc9dd2e28057308004bcfbc715be161169943056cfbc4967f33d443392cc4b0"}, + {file = "quil-0.4.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:9199bf8cfec79ea76a811d17bd57a3a254b8a7b166ae81d17c5b00dbe6e942d8"}, + {file = "quil-0.4.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b81c7b936970733e80f62870444c92c3d7cf614f239acdfbb872cc1ebb097f45"}, ] [[package]] @@ -3298,4 +3301,4 @@ latex = ["ipython"] [metadata] lock-version = "2.0" python-versions = "^3.8,<4.0" -content-hash = "17a6452e967b1b900939b86bc8570c4f5a892ced86c30d9c70dde405e8c958c8" +content-hash = "20cc304f851fa440e9226c72658b9b811ba45106bb1a4c7fda86adfe462b45ee" diff --git a/pyproject.toml b/pyproject.toml index b5338c7dd..4dd2f87e2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -28,8 +28,7 @@ rpcq = "^3.10.0" pydantic = "^1.10.7" networkx = ">=2.5" importlib-metadata = { version = ">=3.7.3,<5", python = "<3.8" } -qcs-sdk-python = "0.10.3-rc.1" -quil = "0.1.1" +qcs-sdk-python = "0.10.8" tenacity = "^8.2.2" types-python-dateutil = "^2.8.19" types-retry = "^0.9.9" diff --git a/pyquil/diagnostics.py b/pyquil/diagnostics.py new file mode 100644 index 000000000..991380c8f --- /dev/null +++ b/pyquil/diagnostics.py @@ -0,0 +1,14 @@ +import pyquil +from qcs_sdk import diagnostics + + +def get_report() -> str: + """ + Get a report of the current state of the pyQuil installation, Python environment, + and supporting packages. + + Note: this format is not stable and its content may change between versions. + """ + return f"""pyQuil version: {pyquil.__version__} +{diagnostics.get_report()} +""" diff --git a/test/unit/test_diagnostics.py b/test/unit/test_diagnostics.py new file mode 100644 index 000000000..ab72dbdae --- /dev/null +++ b/test/unit/test_diagnostics.py @@ -0,0 +1,7 @@ +import pyquil +from pyquil.diagnostics import get_report + + +def test_report(): + report = get_report() + assert report.split("\n").pop(0) == "pyQuil version: {}".format(pyquil.__version__)