Commit Graph

52 Commits

Author SHA1 Message Date
Jake Lishman c3b468c832
Fix pass-manager drawing tests for pydot 3.0 (#12775)
* Fix pass-manager drawing tests for pydot 3.0

Two changes in pydot 3 changed the reference output:

1. previously, attributes were sorted before being output.  Pydot 3
   stores them in declaration order.  Here, we sort our attributes to
   maintain the closest behaviour between the two versions.

2. Text fields (like `label`) that contain special characters now have
   their values enclosed in quote marks.  This is a difference between
   the two versions, and we update the reference files to the new
   version since that's what we'll be using in CI.

Qiskit is still compatible with pydot 2 in general usage, it's just our
tests that are a little more tied to the current version.

* Add test-only constraint on pydot
2024-07-16 13:24:21 +00:00
Jake Lishman 44fe59b040
Relax CI constraint on Rustworkx 0.15.0 (#12690)
The release of Rustworkx 0.15.1 fixes the bug that was previously
blocking CI.
2024-06-28 19:39:56 +00:00
Jake Lishman 3adcd5d3df
Suppress nonsense `DeprecationWarning` caused by `unittest` (#12676)
* Suppress nonsense `DeprecationWarning` caused by `unittest`

`unittest.TestCase.assertWarns` in context-manager form has an awkward
habit of querying the `__warningregistry__` attribute on every module in
existence.  This interacts poorly with a Numpy 2 deprecation warning
trigger for code that's attempting to import functions from modules that
became private in Numpy 2, if a warning has previously been triggered
out of `numpy.linalg._linalg`.

This simply suppresses that particular warning from the test suite.

* Refine filter

* Pin Rustworkx to avoid buggy graphviz drawing

* Update test/utils/base.py

Co-authored-by: Elena Peña Tapia <57907331+ElePT@users.noreply.github.com>

---------

Co-authored-by: Elena Peña Tapia <57907331+ElePT@users.noreply.github.com>
2024-06-28 13:36:32 +00:00
Elena Peña Tapia 1ed5951a98
Pin scipy to 1.13.1 to bypass CI failures (#12654)
* Pin scipy to 1.13.1 to bypass CI failures

* whoops

* double whoops
2024-06-25 10:53:54 +00:00
Jake Lishman c399df2c65
Relax CI constraint on `jsonschema` (#11489)
This was originally added because of `nbformat` using deprecated
functionality.  The constraint is causing installation problems for some
of our optionals now, particularly on Python 3.12, and should be fixed
by now anyway.
2024-01-04 16:42:42 +00:00
Jake Lishman c865c563b9
Pin `z3-solver` on macOS VMs (#11408)
We currently use macOS 11.7 images in our CI and CPython 3.8 for the
all-optionals test run.  `z3-solver` recently released 4.12.3.0, which
upped the macOS platform version from 10.16 to 11.7.  This in theory
should be fine for our VM image, but the pre-built version of CPython
3.8 we have access to was built for an older macOS, so does not match a
`macos_11_7_x86_64` platform tag, and forces us to build Z3 from source,
often timing out the job.

This should have no effect on user machines, which will be typically be
using newer versions of Python, or will be able to install from source
if required.

This CI-only constraint can be relaxed when the version of CPython we
use on the macOS VMs supports the 11.7 macOS API version.
2023-12-13 16:12:38 +00:00
Jake Lishman 8b38060c7e
Relax CI pin on Aer <0.13 (#11313)
Now that Aer 0.13.1 is released, we expect that all the bugs and issues
we had Qiskit-side are resolved.  This releases the pin on the lower
version of Aer to get us testing properly in CI again.
2023-11-24 13:53:44 +00:00
Jake Lishman 4d4604ec68
Relax CI pin on Numpy < 1.25 (#11314)
The release of Numpy 1.26.1 included an upstream patch to fix a bug in
the compiled SIMD versions of complex multiplication loops on macOS, and
we have fixed the deprecation warnings and new CI flakiness on our
side caused by it, so it should now be safe to relax the pin.
2023-11-24 13:48:35 +00:00
Matthew Treinish 5a5c9e33f5
Add support for Python 3.12 (#11262)
* Add support for Python 3.12

Python 3.12.0 was released on 10-02-2023, this commit marks the start of
support for Python 3.12 in Qiskit. It adds the supported Pythonv ersion
in the package metadata and updates the CI configuration to run test
jobs on Python 3.12 and build Python 3.12 wheels on release.

Fixes: #10887

* Add release note

* Avoid deprecated `datetime.datetime.utcnow()` usage

In Python 3.12 `datetime.datetime.utcnow()` has been deprecated, being
replaced by: `datetime.datetime.now(datetime.UTC)`. This commit updates
the usage of `utcnow()` to follow the new convention.

* Adjust UTC usage to support Python 3.8

The recommended alternative for using utcnow() in the deprecation
warnings emitted by Python 3.12 are not compatible with Python 3.8. The
datetime.UTC alias was not added to Python until Python 3.11. To ensure
that the code is compatible with Python < 3.11 this commit updates all
the usage of datetime.UTC to use datetime.timezone.utc instead, which is
what datetime.UTC aliases to in Python >=3.11.
2023-11-23 18:17:14 +00:00
Matthew Treinish 9348cef6bf
Revert "Relax CI constraint on `numpy<1.25` (#11020)" (#11232)
Removing the restriction on the numpy version has introduced some
non-determinism to some of the unitary synthesis tests that is causing a
flaky failure in CI. This commit reverts the version cap removal to
unblock CI. In parallel we should debug the source of the instability
causing the test to fail so we can run CI using the latest version of
numpy.

This reverts commit fb8a69df2f.
2023-11-11 07:58:56 +00:00
Jake Lishman fb8a69df2f
Relax CI constraint on `numpy<1.25` (#11020)
The major problem in NumPy 1.25 transpired to be that particular
versions of Apple clang (including the one used in Numpy's wheel-build
CD pipelines) produced non-deterministic code from new SIMD routines for
complex multiplication.  This in turn destabilised our `Isometry`
decompositions, which caused major correctness problems.  As of Numpy
1.26.1 (released 2023-10-14), that SIMD code now decays to the scalar
form if the compiler was known to be buggy, which restores the previous
behaviour.
2023-11-10 16:09:06 +00:00
Jake Lishman 22f4c93022
Constrain `qiskit-aer==0.12.2` (#11120)
The 0.13.0 release of qiskit-aer causes several test failures, some of
which look like changes in the randomisation, and some of which look
like true failures.  These need a proper resolution, but it's more work
than can be easily attached to a PR that's just meant to get CI rolling
again.
2023-10-26 14:07:59 -04:00
Takashi Imamichi 4f5d90d4a4
Change cvxpy solver (#11002)
* change cvxpy solver

* apply review comments
2023-10-10 15:51:48 +00:00
Jake Lishman 337832eab4
Pin `cvxpy` to known-good version (#10997)
Some diamond-norm tests are failing with the latest 1.4.0 release of
cvxpy.  Given the complex optimisation problem that the dnorm
represents, it's quite possible that randomised tests would already have
had a low success rate, and this is just a case of some internal tweaks
destabilising the particular operator choice in our test.
2023-10-10 11:30:38 +00:00
Jake Lishman dc0002fde1
Relax pin on `qiskit-aer==0.12.0` in CI (#10419)
With the release of Aer 0.12.2, the CI problems we were having caused by
non-picklability of the Aer `Result` objects are now be resolved.
2023-07-13 07:42:40 +00:00
Jake Lishman 791a45433a
Temporarily pin `scipy<1.11` in CI (#10348)
The newest Scipy on Windows seems to have caused a convergence error in
some of the Weyl-chamber code.  This pins Scipy temporarily while we
resolve that issue.
2023-06-26 16:25:47 +00:00
Jake Lishman b8a4448c3e
Pin Numpy to less than 1.25 in CI (#10306)
We are not (should not be) fundamentally incompatible with Numpy 1.25,
there are just new deprecation warnings and seemingly some behavioural
changes that are causing flakiness in the isometry CI.  This temporarily
pins Numpy to allow people to continue working while we address the root
cause.
2023-06-19 11:23:33 +00:00
Jake Lishman 676d90cf15
Pin Aer to known good version (#10270)
* Pin Aer to known good version

The release of Aer 0.12.1 included a bug in the results output that made
the general `Result` object unpickleable.  Several places in our tests
assume that these objects should be able to be pickled to be sent across
a process boundary, or such like.

* Make GitHub Actions respect constraints
2023-06-13 12:37:54 +00:00
Jake Lishman 69d2df508d
Relax pin on sphinx-autodoc-typehints (#9379)
Version 1.21.1 was recently released, which fixes the spacing bug
introduced in 1.21.0.

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2023-01-17 13:48:35 +00:00
Jake Lishman 3d8a6e0393
Pin sphinx-autodoc-typehints (#9377)
The 1.21.0 release appears to have changed the spacing in its outputs,
which is causing a bunch of Sphinx/docutils warnings for some of our
docstrings.
2023-01-16 13:38:16 +00:00
Jake Lishman dce9fdaadf
Relax constraints on jupyter-core and ipywidgets (#9364)
* Relax constraints on jupyter-core and ipywidgets

These were originally added in #9105 and #9272 respectively, but the
original problem package `seaborn` has released since then, which may
have fixed things.

* Fix suppressions for Jupyter warnings

This removes some now-unnecessary suppressions from image-related
packages, and adds the new suppression for the pyzmq problem, which is
Jupyter's domain to handle.  The extra environment variable in the
images test run is to eagerly move to new default behaviour starting in
jupyter-core 6; there is no need for us to pin the package too low,
since this warning is just encouraging people to proactively test the
new behaviour, and it doesn't cause our suite problems.

* Use correct YAML syntax

One day I'll remember this when writing environment variables in YAML
files, but it's not this day.
2023-01-12 18:48:21 +00:00
Jake Lishman 7955d92d3e
Refactor coverage CI workflow (#9361)
This relaxes the constraint on `coverage` added in #9305.  The issue
there is actually the now unmaintained `coveragepy-lcov` package is not
compatible with Coverage.py 7.0.  However, we only needed
`coveragepy-lcov` to convert Coverage's format into LCOV, which is a
feature Coverage has had itself since version 6.0.

This commit also updates some parts of the coverage workflow that were
old:

- there are new versions of the Actions `checkout` and `setup-python`,
  which swap to using Node 16 rather than Node 12, which is deprecated
  in GHA
- `grcov` is packaged and installable from `cargo` now, rather than
  needing a manual hard-coded pull from GitHub
- we can have `grcov` only keep the parts we care about immediately,
  rather than converting everything and later discarding it

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2023-01-11 22:24:15 +00:00
Julien Gacon 9733fc0ca9
Fix NumPy 1.24.0 compatibility and pin `coverage<7.0` (#9305)
* fix Kraus from (array, None)

* fix triu_to_dense test

* fix instruction comparison

* skip snobfit if numpy 1.24.0 or above is installed

Co-authored-by: ElePT <57907331+ElePT@users.noreply.github.com>

* pin coverage <7.0

* add links to Kraus and snobfit issues

* retrigger CI

Co-authored-by: ElePT <57907331+ElePT@users.noreply.github.com>
2022-12-20 17:49:55 +00:00
Takashi Imamichi b4f4c342c2
pin ipywidgets (#9272) 2022-12-09 15:19:15 +00:00
Matthew Treinish 29c56a3c5c
Pin jupyter-core to < 5.0.0 (#9105)
The recent release of jupyter-core 5.0.0 started emitting a deprecation
warning during the image comparison tests which is causing a failure
caused by usage in seasborn via ipywidgets. To workaround this in the
short term this commit set a constraint on the jupyter-core version. We
should remove this pin after seaborn and ipywidgets are updated, or we
add an explicit warning exclude to the test suite.
2022-11-09 20:36:19 +00:00
Jake Lishman 65851b4d60
Relax now-unneeded constraints (#8968)
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2022-10-20 16:58:50 +00:00
Matthew Treinish dfca1fb90d
Revert "Pin setuptools in CI (#8526)" (#8530)
* Revert "Pin setuptools in CI (#8526)"

With the release of setuptools 64.0.1 the issues previously blocking CI
and editable installs more generally should have fixed now. This commit
reverts the pins previously introduced to unblock CI and work around the
broken release.

This reverts commit 82e38d1de0.

* Add back SETUPTOOLS_ENABLE_FEATURES env var for legacy editable install

Co-authored-by: Jake Lishman <jake.lishman@ibm.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2022-08-22 21:20:09 +00:00
Matthew Treinish 82e38d1de0
Pin setuptools in CI (#8526)
* Pin setuptools in CI

The recently released setuptools 64.0.0 release introduced a regression
that prevents editable installs from working (see pypa/setuptools#3498).
This is blocking CI as we use editable installs to build and install
terra for testing. When there is an upstream release fixing this issue
we can remove the pins.

* Remove pip/setuptools/wheel manual install step

* Try venv instead of virtualenv

* Revert "Try venv instead of virtualenv"

This reverts commit 3ada819330.

* Revert "Remove pip/setuptools/wheel manual install step"

This reverts commit 831bc6e0db.

* Pin in constraints.txt too

* Lower version further

* Pin setuptools-rust too

* Set editable install to legacy mode via env var

* Set env variable correctly everywhere we build terra

* Add missing env variable setting for image tests
2022-08-12 09:13:59 +02:00
Matthew Treinish 5c61d8f2df
Pin jinja2 in CI (#7815)
The recent jinja2 release is breaking the tutorials ci job. This is
because something in the nbsphinx, jupyter, sphinx pipeline is
incompatible with the new version. These issues have been reported
upstream to jinja2 (and promptly closed as won't fix) so until the docs
build toolchain is upgraded to work with the new version this commit
pins the jinja2 version.
2022-03-24 21:08:46 +00:00
Jake Lishman 6e0926fb65
Pin pyparsing<3 in constraints (#7174)
Matplotlib's LaTeX handling is broken by the new release of pyparsing
3.0.  We are already restricting matplotlib<3.4 in CI due to
deprecations, so we are unlikely to get updated versions of matplotlib
any time soon, which we will likely need to lift the pin.
2021-10-25 10:57:21 +00:00
Matthew Treinish 7e3ad4425d
Remove out of date constraints from constraints.txt (#7154)
The constraints.txt file is used to pin specific versions of packages in
the dependency tree when we can't (typically for dependencies of
dependencies) modify the requirements list to workaround temporary
packaging issues. With the recent release of stevedore 3.5.0 [1] the
importlib-metadata pin in the constraints.txt file was no longer needed.
However, looking at the git log for other pinned dependencies only 1
package being pinned is still required, jsonschema, because nbformat
hasn't been updated to fix the incompatibility with the latest version
yet. This commit removes all the out of date entries from the
constraints.txt file leaving only the pin for jsonschema so we're
testing the latest versions of everything in CI, so that our CI
environment is closer to what users will typically install.

[1] https://pypi.org/project/stevedore/3.5.0/
2021-10-18 16:27:28 +00:00
Matthew Treinish 4eda7993fa
Add unitary synthesis plugin interface (#6124)
* Add unitary synthesis plugin interface

This commit adds the initial steps for a unitary synthesis plugin
interface. It enables external packages to ship plugin packages that
then integrate cleanly into qiskit's transpiler without any need for
extra imports or qiskit changes. The user can then just specify the
'unitary_synthesis_method' kwarg on the transpile() call and use the
name of the external plugin and the UnitarySynthesis pass will leverage
that plugin for synthesizing the unitary.

* Also add qubits in payload with coupling map

* Fix lint

* Fix logic

* Add documentation about the plugin interface

* Export get_unitary_synthesis_plugin_names from qiskit.transpiler.passes

* Fix lint

* Tweak doc organization slightly

* Use UnitarySynthesis for unroll3q step

The usefulness of the plugin for unitaries >2q in the default pass
manager pipelines was limited by the fact that previously the pass
managers were all setup to run unroll3q before the unitary synthesis
pass is ever run. The unroll3q pass just calls the circuit.data to
decompose gates >=3q which for unitary gate objects just calls an
inlined equivalent of the 'default' plugin. The purpose of this is to
ensure later passes only ever need to deal with 2q gates. However with
plugins now if a plugin only works on > 2q we'll never actually be
passing an >= 3q unitaries to the plugin in the default pipelines. To
fix this issue, this commit calls unitary synthesis before unroll 3q to
use the synthesis pass to unroll any unitary gates instead of relying on
the gate class's internal decomposition method which will always use the
qiskit decomposition techniques.

* Run black

* Tweak doc organization slightly

* Fix lint

* Fix pylint errors

* Apply suggestions from code review

Co-authored-by: Jake Lishman <jake@binhbar.com>

* Update plugin interface docs

* Review comment updates on UnitarySynthesis pass

* Fix typos

* Include release notes

* Fix docstring typo

* Update qiskit/transpiler/passes/synthesis/unitary_synthesis.py

Co-authored-by: Kevin Krsulich <kevin@krsulich.net>

* Ignore deprecation warnings from importlib metadata

Since the importlib metadata 4.8.0 release in late August 2021,
stevedore <= 4.8.0 has raised a deprecation warning around using tuple
based access (which was deprecated in 4.8.1 after 4.8.0 removed it and
broke everything using stevedore). While this has been fixed on the
master branch of stevedore (see:
11da137e3f
) Until that fix is released this commit adds a deprecation warning
ignore because there isn't anything we can do about the warning in
qiskit. Once stevedore has a release that includes this fix we can
remove the ignore from the tests.

* Pin importlib-metadata

The previous commit tried to fix the failures in CI around the
deprecation warnings but while I'm unable to reproduce those locally
with the warning ignore in place it still fails in CI. I expect there is
a similar incompatibility around the 4 frequent importlib-metadata
releases >=4.7.0 (2 of which were yanked) causing issues in the CI
environment. Since things were working fine for the several months this
PR was open prior to 4.7.0 this commit just pins the version in the
constraints file to fix CI.

* Add length units to docstring

* Add min and max qubit abstract properties

This commit adds 2 new required properties to the plugin class interface
for min and max qubits. These enable a plugin author to specify the
number of qubits the plugin supports and if the unitary to be
synthesized is outside that range it will just fallback to using the
``default`` plugin.

* Add option to automatically find basis for a run() call

* Fix typo

* Update gate errors docstring

* Remove approximation degree from plugin interface

* Fix docstring typos

Co-authored-by: Eric Peterson <peterson.eric.c@gmail.com>

* Apply suggestions from code review

Co-authored-by: Jake Lishman <jake@binhbar.com>

* Update qiskit/transpiler/passes/synthesis/unitary_synthesis.py

Co-authored-by: Jake Lishman <jake@binhbar.com>

* Update docstrings and naming and default to 'default' plugin in kwarg

This commit updates several aspects of the documentation to make it more
clear how to use the plugin interface. It also updates the naming of
supported_basis to be supported_bases as it's actually plural. The last
change in this commit is making the default kwarg value for the
unitary synthesis method default to 'default' (for the default built-in
method) instead of None. This simplifies the logic in the unitary
synthesis pass.

* Make coupling_map run() kwarg a tuple

* Add comment on why we don't use a shared global instance

* Fix straggler basis->bases typos

* Apply suggestions from code review

Co-authored-by: Jake Lishman <jake@binhbar.com>

* Document supported_bases handling of no matching basis

Co-authored-by: Jake Lishman <jake@binhbar.com>
Co-authored-by: Kevin Krsulich <kevin@krsulich.net>
Co-authored-by: Jake Lishman <jake.lishman@ibm.com>
Co-authored-by: Eric Peterson <peterson.eric.c@gmail.com>
2021-09-30 19:09:24 +00:00
Jake Lishman c202e460a7
Pin jsonschema==3.2.0 in constraints (#7091)
This dependency is used transitively by jupyter via nbformat.  In the
new 4.0 release of jsonscheme, nbformat uses deprecated behaviour,
triggering CI failures, so we pin jsonschema to a known-good version.
The pin can be removed once nbformat is updated.
2021-09-30 17:50:23 +00:00
Matthew Treinish 39d290667b
Pin networkx for CI (#6711)
Networkx 2.6 released a few hours ago and is causing a version conflict
with the matplotlib version we install in the tutorials job. The version
we use in the tutorials job was specifically pinned because of
performance issues we were seeing with newer matplotlib releases
(admittedly a while ago) to side step the issue and get 0.18.0 out the
door this commit pins the networkx version we use in the constraints
file. After 0.18.0 releases we can investigate removing the matplotlib
pin in the tutorials job and this constraint.
2021-07-08 21:33:15 +00:00
Matthew Treinish fe9c105fd9
Pin jax version in constraints (#6636)
I have seen a couple instances of jobs failing due to segfaults or other
system errors when running tests that leverage jax. Looking at the
release history for jax and jaxlib, there have been multiple releases
the past few days. Until the project stabilizes these issues this commit
just pins the version we run in CI to the last release from May which
wa stable in CI.
2021-06-24 13:39:15 +00:00
Takashi Imamichi 0167c156d2
remove docplex in constraints.txt (#6613)
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2021-06-21 23:21:41 +00:00
Matthew Treinish 194f91c7eb
Stop using networkx for qaoa tests (#6142)
* Stop using networkx for qaoa tests

In the qaoa tests networkx was being used to generate a random
adjancency matrix as an input. This would work fine especially as the
graph size is small so performance isn't an issue. However, with the
recent release of decorator 5.0.0 earlier today these tests are
failing because of an internal incompatibility with the random state
decorator networkx is using for random_gnp_graph() function. Instead
of pinning decorator in the constraints file and hoping people running
tests without tox know to use it, this commit just switches that test to
use retworkx instead. retworkx doesn't have an external dependency on
decorator (or anything except numpy) and can generate an adjacency
matrix for a gnp random graph in basically the same exact way without
this incompatibility.

* Add decorator to constraints too

The same networkx example is used in the tutorial notebooks, since we
don't control the source to those (and we probably want to continue to
use networkx there since it's a popular package) this adds decorator to
the constraints file too to unblock the tutorials job.
2021-04-02 13:18:47 +00:00
Matthew Treinish 8188fda185
Attempt to install latest numpy in all CI jobs (#5816)
* Attempt to install latest numpy in all CI jobs

Since the pulse simulator in aer 0.7.4 release appears to not be
compatible with numpy releases <1.20.0 (see Qiskit/qiskit-aer#1120) we
need to ensure that we're running jobs that use aer with numpy 1.20.0
too. This commit attempts to ensure we're using the latest numpy release
in all CI jobs to unblock CI while we wait for a fixed aer release.

* Try to pin with constraints

* Fix issues with windows and 3.6

* Update azure-pipelines.yml

Co-authored-by: Kevin Krsulich <kevin@krsulich.net>

* Fix lint error now being caught in AbelianGrouper
2021-02-09 10:49:35 -05:00
Matthew Treinish 40f51093df
Pin appnope in CI (#5454)
The appnope 0.1.1 release from this morning is the only package change
between a working and failing CI job. This commit explicitly pins it in
the constraints file (since we don't directly require it) to ensure we
get a known working version to try and unblock CI.
2020-12-01 18:35:26 +00:00
Matthew Treinish 2d3df51b84
Pin docplex version in constraints.txt for tutorials CI job (#5366)
* Pin docplex version in constraints.txt for tutorials CI job

The recent new release of docplex has broken the released version of
aqua. There is a fix in aqua in-progress Qiskit/qiskit-aqua#1420, but
until that is included in a release we won't be able to use the latest
version of docplex in the tutorials CI job. This commit adds a pin on
the version of docplex used in the constraints file to always use a
known working version to unblock CI.

* Remove windows pip cache

The windows CI images seem to have been updated and now the pip cache
step can't find the local pip cache to upload to azure. To unblock CI
this commit just removes the windows caching from CI. It will add some
execute time, but that's still better than not working.
2020-11-09 15:30:47 -05:00
Matthew Treinish 2a2b504f97
Remove stale nbformat pin from constraints.txt (#5053)
In #3691 we added a pin on nbformat to the constraints.txt file to
workaround a broken release of nbformat. This issue has been resolved
for some time, but we never circled back to remove the pin. This pinned
version of nbformat is now too old and is causing it's own CI failure
because of a pip dep solving error. This commit fixes this by removing
the unecessary pin.
2020-09-10 20:54:04 +00:00
Matthew Treinish aa3672d6eb
Revert "Pin numpy version < 1.19.0 to unblock CI (#4599)" (#4656)
* Revert "Pin numpy version < 1.19.0 to unblock CI (#4599)"

Since #4613 is fixed it looks like we can remove the CI pin for the
latest numpy release. Failures with numpy on test_qasm_2q_unitary
haven't been reproducible locally, so there shouldn't be a blocker
anymore to running tests with the latest numpy release.

This reverts commit 6aca34a9e9.

Fixes #4606

* Round result from decomp0

The root cause of the issue causing the failure on windows for 2q
unitary decomposition of an identity matrix was a rounding issue. The
U0r matrix being returned from decomp0() was

[[1.00000000e+00+0.00000000e+00j 2.77555756e-17-2.77555756e-17j]
 [2.77555756e-17-2.77555756e-17j 1.00000000e+00+0.00000000e+00j]]

instead of the expected

[[1+0j + 0+0j]
 [0+0j + 1+0j]]

this throws off later stages that use the decomposition result. This
commit fixes this issue by rounding the output matrices from decomp0()
to 13 decimal places (which is what is used for atol and rtol other
places in the module) to avoid this type of rounding error.

Co-authored-by: Luciano Bello <luciano.bello@ibm.com>
2020-07-12 18:40:05 -04:00
Luciano Bello 6aca34a9e9
Pin numpy version < 1.19.0 to unblock CI (#4599)
Some tests are failing recently:
`test_qasm_2q_unitary` and `test_pulse_limits`

It appears to be caused by the recent numpy 1.19.0 release, which was released
released on June 20th 2020. This commit unblocks CI by pinning the numpy version
so we can continue to make progress while investigating the cause of the issue.

* numpy>=1.17,<=1.18

* constraints.txt

* !=
2020-06-23 06:44:47 -04:00
Matthew Treinish 492b7e545b
Prepare 0.12.0 release (#3798)
* Prepare for 0.12.0 release

This commit moves the release notes into a 0.12.0 subdirectory to keep
them separate from development notes post-release. It also adds a
release note to add the prelude section providing the high level
overview of the release. When this merges it should be the commit used
to tag the 0.12.0 release.

* Update parametric pulse documentation

As part of updating the release notes for recent pulse changes linking
to the new parametric pulse command classes was impossible because they
were not included in the documentation. This commit corrects that
oversight and adds the new parameters to the documentation and also
updates the formatting for some of the classes.

* Update release notes for formatting and content

This commit goes through the release notes for the 0.12 release and
updates them for content and formatting. It also adds the 0.12.0 release
note with a single prelude to describe the release at a high level.

* Update more release notes

This commit continues the process of reworking and updating the release
notes. There are still a few more files to update and fix, which will
happen in a follow on commit.

* Add missing release note

Change #3773 introduced some backwards incompatible api changes but
forgot to add a release note documenting these. This commit corrects the
oversight and adds release notes for the changes in that PR.

* Final round of release note updates

This commit finishes the cleanup and fixes for the existing release
notes in the 0.12.0 release.

* Migrate and update formatting for new release note

A new release note file was merged since this PR was originally opened.
This commit moves it to the release subdir and updates the formatting so
it links to classes and the table fits in the 100 character limit on the
meta repo when we add it there.

* Move and fix another new release note

* Minor typo fix in the release notes

* Move and update last release note

* Undo accidental change in tox.ini
2020-02-06 15:59:58 -05:00
Matthew Treinish 19f59c0a55 Pin pylint and astroid in requirements-dev.txt (#3699)
Currently we're pinning pylint and astroid via a constraints file. This
was done primarily because astroid is not a direct dependency for
development since we only actually directly use pylint. The constraints
file mechanism is designed for this purpose to let us set explict
versions for repeatability for any package installed via pip, even if
it's not a direct requirement. However, the constraints file mechanism
isn't obvious to developers who are manually installing development
requirements into their environment. Additionally, the
requirements-dev.txt had a pylint version cap which conflicts with the
version set via the constraints file which made it extra confusing.
This commit moves away from using the constraints for pylint and moves
to using requirements-dev.txt directly. To facilitate this astroid
pinned at a specific version is also added to the requirements-dev.txt
file to ensure we have a consistent output from pylint. While this isn't
a direct dependency for development it does make it simpler to find and
install a consistent pylint env locally.
2020-01-08 15:12:18 -05:00
Matthew Treinish 2fe5055411 Bump pylint version to unify across elements (#3635)
* Bump pylint version to unify across elements

This commit bumps the pinned versions of pylint and astroid to the
lastest versions of both. We are unifying the version of both used in CI
across all the elements to these versions to have a consistent
experience with the linters when working across the elements.

This adjusts the terra code to make the newer versions pass. This
involves disabling one rule globally because it doesn't apply to how
terra is structured, adding per file (and 1 per line) disable for usage
of numpy that pylint can't track because of the c extensions, and a
number of code changes to fix failing rules which are marked by the new
version.

Fixes #3629

* Fix tests

* Rename kron() args to avoid ordering confusion

* Fix lint failures introduced in recent patches

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2020-01-07 12:21:32 -05:00
Matthew Treinish 7718e3576d Pin nbformat to 4.4.0 (#3691)
The recent nbformat release 5.0.0 that was just pushed to pypi is
missing jsonschema files from the uploaded artifacts,
(see jupyter/nbformat#155). This is causing CI failures, until the issue
is resolved this commit pins the version installed via pip using the
constraints file (since it's not a direct dependency).
2020-01-06 17:40:06 -05:00
Matthew Treinish f17f8f073e Add python 3.8 support and deprecate python 3.5 (#3268)
* Add python 3.8 support and deprecate python 3.5

This commit adds support for running terra under python 3.8. It does
this by adding the trove classifiers to the package metadata and adding
a test job for python 3.8 (only travis for now this can be expanded in
the future when azure pipelines adds it to their image). At the same
time this commit starts the deprecation window for python 3.5. Python
3.5 goes end of life by upstream python in Sept. 2020. We should give
our users running with python 3.5 (which is about 10% of our users based
on pypi data) fair notice that when upstream python stops supporting it
we do as well.

* Fix lint

* Add back empty cache detection

As part of the refactors the empty stestr timing cache removal code was
removed from the travis config, but the cache wasn't removed. Adding the
python 3.8 job causes a failure because travis has no cached timing data
but still creates the empty directory which triggers
mtreinish/stestr#266. This adds back the empty cache removal to
workaround it so we can use the timing data for scheduling in future
runs.

* Add azure-pipelines python 3.8 jobs too

* Fix python 3.8 dictionary keys changed error

Starting in python 3.8 a new RuntimeError is raised, RuntimeError:
dictionary keys changed during iteration. This is caused by modifying an
iterator while looping over it. We were doing that in the
optimize_swap_before_measure pass. This commit fixes this by wrapping
the iterator in list() to make a copy of it for looping. This way we
don't modify the contents of what we're iterating over in the pass.

* Revert "Add azure-pipelines python 3.8 jobs too"

The missing matplotlib wheels are blockers for windows and osx
environment. Since we do not have the necessary dependencies installed
in those ci envs to compile matplotlib from source. We'll rely on just
travis for 3.8 testing until the matplotlib 3.2.0 release is pushed so
we don't have to compile it.

This reverts commit 40157621b1.

* Add skip for failing matplotlib test

The image comparison tests which are quite flaky are failing with
matplotlib compiled on 3.8. Looking at the image output from these
failures are very subtle (looks like resolution differences) again
questioning the value of these tests. This commit just skips the test
that is failing here to unblock the PR.

* Add azure 3.8 test jobs

* Pin to pre-release mpl for python 3.8

* Add spawn guard for python3.8 osx in examples

When running examples with execute, transpile, or any other calls using
parallel_map() the new default for spawn instead of fork requires that
scripts have a __name__ == "__main__" check in them to function
properly. If not calls to parallel_map fail errors around the
bootstrapping phase. To avoid this in the ci jobs this commit adds the
necessary checks to the example scripts we run in ci as part of
test_examples.

* Remove cryptography pin from constraints file

We pinned the cryptography package version back during the cryptography
2.6 release which broke our ci. It was a temporary step to avoid a
packaging issue in CI that was blocking development. However, when the
issue was resolved we never circled back to fix the issue. Now trying to
enable python 3.8 support to terra cryptography >=2.8 is needed for
python 3.8 on windows (to get a precompiled binary). This commit removes
the unecessary pin to unblock windows 3.8 ci.

* Bump cibuildwheel version to build 3.8 wheels

cibuildwheel 1.0.0 was released in early November [1] and added support
for building python 3.8 wheels. This commit bumps the cibuildwheel
version we use in the wheel build jobs at release time to also build 3.8
wheels for upload to pypi.

* Add skip and release note about macos py38 issues

This commit adds a skip for the failing python 3.8 test on osx and
windows so that we don't block everything over a small issue in the
tests. It also add a release note documenting the limitation with python
3.8 on macos with regardess to parallel_map/multiprocessing. Since this
limitation is new for this release (being the first release with python
3.8 support) we should document it as a known issue in the release
notes, especially since it likely won't be resolved until a python 3.8.1
release.

* Revert "Add spawn guard for python3.8 osx in examples"

While we can fix the tests to work on osx python3.8 by adjusting the
example scripts to only call functions using parallel_map from inside a
block run via if __name__ == '__main__': this unecessarily changes the
scripts for the quirks of a single environment. This commit reverts the
example scripts back to their original form and instead just skips the
unittest that executes them on python 3.8 macOS. We already have
documented this limitation in the release notes. When/if we have an
alternative solution for how we launch additional processes in python
3.8 on macOS that does not require this workaround we can look at
removing the skip.

This reverts commit 76ae197631.

* Apply suggestions from code review

Co-Authored-By: Kevin Krsulich <kevin@krsulich.net>
2019-12-10 22:43:58 +02:00
Matthew Treinish 37036f494d Rewrite dag drawer to not use nxpd (#3280)
* Rewrite dag drawer to not use nxpd

The nxpd library is quite stale and hasn't seen an update in 3 years.
The most recent release of networkx 2.4 is incompatible with nxpd now
because nxpd was using deprecated (and now removed) api calls from
networkx. Additionally, the functionality provided by nxpd already
exists in networkx so there is no reason to rely on an additional
library outside of networkx and pydot. This commit updates the dag
drawer to no longer use nxpd and uses networkx's drawing features
instead.

* Cap networkx for python 3.5

In the networkx release notes for 2.4 [1] it states clearly that the 2.4
release is the last release with python 3.5 support. Since the release
timeline is not fixed and we may end up support python 3.5 in terra
longer than networkx this adds a capped version of networkx on 2.4 for
python 3.5.

[1] https://networkx.github.io/documentation/stable/release/release_2.4.html

* Adjust python 3.5 cap

Since networkx 2.4 is seemingly relying on the guaranteed insertion
ordering for dicts introduced in 3.6 for how we're using topological
sort this adjusts the cap previously introduced to be <2.4 instead of
<=2.4. This should avoid the failures related to this on python 3.5 and
networx 2.4.

* Avoid duplicate requirements with cap
2019-11-09 04:49:46 +00:00
Matthew Treinish 38b03f4d1a Pin networkx in constraints (#3276)
With the recent release of networkx 2.4 several deprecated APIs were
removed. This broke the visualization dependency nxpd. A fix is in
progress [1] to address this. But in the meantime to get tests working
again we need to make sure we do not install networkx 2.4 for testing.
This commit does this by pinning the version we use in our testing in
the constraints file to 2.3. This will unblock our development while we
wait for a new nxpd release.

[1] https://github.com/chebee7i/nxpd/pull/15
2019-10-17 10:16:20 -04:00