-
Notifications
You must be signed in to change notification settings - Fork 160
Importing tomography with cvxpy installed fails #429
Comments
In the recent ignis 0.3.2 (and 0.3.1, but that had other bugs) release a bug slipped in that crashes ignis if cvxpy is not installed. This is causing the docs jobs to fail to build any documentation that ends up importing process tomography (see qiskit-community/qiskit-ignis#429). This commit explicitly adds cvxpy to the docs jobs to unblock them so we upload complete documentation. An ignis bugfix release 0.3.3 will be out soon to fix the ignis bug, but until then this will fix the hosted documentation.
This commit fixes an issue in the process tomography module. When cvxpy was not installed the module would fail to import. That's because the selection logic was reworked in qiskit-community#422 but never updated in process tomography to reflect that change. Since no CI job runs without cvxpy installed we never caught this edge case. This commit fixes the underlying issue to rework the process tomography fitter selection logic to mirror the changes to state tomography in qiskit-community#422 and then also try and add ci coverage it removes cvxpy from the docs tox job. With warnings set to fatal this should ensure we are always able to import everything and build the docs if cvxpy is not installed. Fixes qiskit-community#429
This was easy enough to fix (#433 ) - the crash resulted from Process tomography explicitly testing I was unable, however, to add a corresponding test; I tried something along the lines of
but I couldn't get it to crash (while switching to a |
In the recent ignis 0.3.2 (and 0.3.1, but that had other bugs) release a bug slipped in that crashes ignis if cvxpy is not installed. This is causing the docs jobs to fail to build any documentation that ends up importing process tomography (see qiskit-community/qiskit-ignis#429). This commit explicitly adds cvxpy to the docs jobs to unblock them so we upload complete documentation. An ignis bugfix release 0.3.3 will be out soon to fix the ignis bug, but until then this will fix the hosted documentation.
@gadial mocking imports is not always straightforward because there is a multiple pieces of state to track and also module vs global scoping. You can see an example of what I did for a similar case in: https://github.com/Qiskit/qiskit-terra/pull/4296/files (in that case I wasn't trying to mock it away but replace a module with a mock). That being said I already have a fix up in #431 which makes the docs job run without cvxpy which should catch this case in the future. But I also am going to push a new CI job that runs without cvxpy (and without matplotlib), it's the only way to reliably test the absence of a dependency across the board. We can mock it away in one place, but there might be unseen consequences somewhere else in the code (cvxpy's usage is pretty well isolated though). |
This commit fixes an issue in the process tomography module. When cvxpy was not installed the module would fail to import. That's because the selection logic was reworked in #422 but never updated in process tomography to reflect that change. Since no CI job runs without cvxpy installed we never caught this edge case. This commit fixes the underlying issue to rework the process tomography fitter selection logic to mirror the changes to state tomography in #422 and then also try and add ci coverage it removes cvxpy from the docs tox job. With warnings set to fatal this should ensure we are always able to import everything and build the docs if cvxpy is not installed. Fixes #429
This commit fixes an issue in the process tomography module. When cvxpy was not installed the module would fail to import. That's because the selection logic was reworked in qiskit-community#422 but never updated in process tomography to reflect that change. Since no CI job runs without cvxpy installed we never caught this edge case. This commit fixes the underlying issue to rework the process tomography fitter selection logic to mirror the changes to state tomography in qiskit-community#422 and then also try and add ci coverage it removes cvxpy from the docs tox job. With warnings set to fatal this should ensure we are always able to import everything and build the docs if cvxpy is not installed. Fixes qiskit-community#429 (cherry picked from commit 01e9070)
This commit adds a new ci job for running ignis tests without any optional dependencies. There are several optional dependencies which do not not always get installed with ignis. They are needed to enable optional features but shouldn't be required, we've had a slew of recent bugs around accidentally requiring these optional dependencies (see issues qiskit-community#429, qiskit-community#422, and qiskit-community#312). None of these were caught in CI because we always install all optional dependencies in CI test jobs. By adding a new job which explicitly installs the bare minimum we're emulating what a user does when they install just ignis. As part of this a missing dependency was added to the requirements list. Ignis has a hard dependency on scikit learn for the measurement discriminators, but this was never explicitly listed. This was never caught because the test jobs were always installing it.
This commit adds a new ci job for running ignis tests without any optional dependencies. There are several optional dependencies which do not not always get installed with ignis. They are needed to enable optional features but shouldn't be required, we've had a slew of recent bugs around accidentally requiring these optional dependencies (see issues qiskit-community#429, qiskit-community#422, and qiskit-community#312). None of these were caught in CI because we always install all optional dependencies in CI test jobs. By adding a new job which explicitly installs the bare minimum we're emulating what a user does when they install just ignis. As part of this a missing dependency was added to the requirements list. Ignis has a hard dependency on scikit learn for the measurement discriminators, but this was never explicitly listed. This was never caught because the test jobs were always installing it.
This commit fixes an issue in the process tomography module. When cvxpy was not installed the module would fail to import. That's because the selection logic was reworked in #422 but never updated in process tomography to reflect that change. Since no CI job runs without cvxpy installed we never caught this edge case. This commit fixes the underlying issue to rework the process tomography fitter selection logic to mirror the changes to state tomography in #422 and then also try and add ci coverage it removes cvxpy from the docs tox job. With warnings set to fatal this should ensure we are always able to import everything and build the docs if cvxpy is not installed. Fixes #429 (cherry picked from commit 01e9070)
…ies (#436) * Add scikit-learn dependency and add CI job without optional deps This commit adds a new ci job for running ignis tests without any optional dependencies. There are several optional dependencies which do not not always get installed with ignis. They are needed to enable optional features but shouldn't be required, we've had a slew of recent bugs around accidentally requiring these optional dependencies (see issues #429, #422, and #312). None of these were caught in CI because we always install all optional dependencies in CI test jobs. By adding a new job which explicitly installs the bare minimum we're emulating what a user does when they install just ignis. As part of this a missing dependency was added to the requirements list. Ignis has a hard dependency on scikit learn for the measurement discriminators, but this was never explicitly listed. This was never caught because the test jobs were always installing it. * Don't install cvxopt in no-opt job * Add job name
…ies (qiskit-community#436) * Add scikit-learn dependency and add CI job without optional deps This commit adds a new ci job for running ignis tests without any optional dependencies. There are several optional dependencies which do not not always get installed with ignis. They are needed to enable optional features but shouldn't be required, we've had a slew of recent bugs around accidentally requiring these optional dependencies (see issues qiskit-community#429, qiskit-community#422, and qiskit-community#312). None of these were caught in CI because we always install all optional dependencies in CI test jobs. By adding a new job which explicitly installs the bare minimum we're emulating what a user does when they install just ignis. As part of this a missing dependency was added to the requirements list. Ignis has a hard dependency on scikit learn for the measurement discriminators, but this was never explicitly listed. This was never caught because the test jobs were always installing it. * Don't install cvxopt in no-opt job * Add job name * Update tox.ini to point to remove master terra for stable branch (cherry picked from commit f0b68e4)
…ies (#436) (#439) * Add scikit-learn dependency and add CI job without optional deps This commit adds a new ci job for running ignis tests without any optional dependencies. There are several optional dependencies which do not not always get installed with ignis. They are needed to enable optional features but shouldn't be required, we've had a slew of recent bugs around accidentally requiring these optional dependencies (see issues #429, #422, and #312). None of these were caught in CI because we always install all optional dependencies in CI test jobs. By adding a new job which explicitly installs the bare minimum we're emulating what a user does when they install just ignis. As part of this a missing dependency was added to the requirements list. Ignis has a hard dependency on scikit learn for the measurement discriminators, but this was never explicitly listed. This was never caught because the test jobs were always installing it. * Don't install cvxopt in no-opt job * Add job name * Update tox.ini to point to remove master terra for stable branch (cherry picked from commit f0b68e4)
Informations
What is the current behavior?
import qiskit.ignis.verification
raise an
ImportError
if cvxpy isn't installed:It looks like an edge case was missed in #422. We don't have a ci job that doesn't install cvxpy so this is never tested and thus this slipped through
Steps to reproduce the problem
import qiskit.ignis.verification
What is the expected behavior?
You can import ignis without an optional dependency.
Suggested solutions
Fix the import in process tomography and add a test job.
The text was updated successfully, but these errors were encountered: