Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Poison import if Qiskit 1.0+ is detected (#11617)
* Poison import if Qiskit 1.0+ is detected This uses `importlib.metadata` to search for installations of Qiskit 1.0 at runtime, and poison the import if one is detected. The two packages are incompatible in a way that we cannot express to `pip` without having poisoned the `qiskit-terra` package as a whole, which is something we're less willing to do in order to keep it easier to install old versions of Qiskit-dependent software, and to keep the Qiskit 1.0 packaging story clean for the coming years. It is not generally expected that a user specifically attempting to install Qiskit 0.45/0.46 will accidentally install Qiskit 1.0 as well. The intention of this poisoning in the "stable" branch is so that the case that a user installs Qiskit 1.0, but either also includes an old package with a dependency purely on `qiskit-terra`, or runs a subsequent `pip install` command whose version resolution causes `qiskit-terra` to become installed. In both these cases, it could be the case that the `import qiskit` command finds the `qiskit-terra` `__init__.py` file, and so any error we also place in Qiskit 1.0 would have been skipped. * Hide inner variable from init * Add shortlink to migration guide * Improve release note * Use specific version ranges Co-authored-by: Matthew Treinish <[email protected]> --------- Co-authored-by: Matthew Treinish <[email protected]>
- Loading branch information