Skip to content

Add warning when qiskit package not installed #11230

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

Merged

Conversation

mtreinish
Copy link
Member

Summary

Starting in Qiskit 1.0 the qiskit-terra package will no longer be published anymore. This is a major change in the packaging because since December 2018 users have been able rely on just the qiskit-terra package if they were only depending on the core functionality in qiskit. But as we're . This commit adds a warning on import of the qiskit namespace if the qiskit package is not installed to inform users that starting in 1.0.0 qiskit-terra will not recieve updates. There will still be releases for the 0.46.x release series (while it's still supported).

The other aspect with this migration is there is not a safe direct upgrade path from qiskit < 1.0.0 to qiskit>=1.0.0 due to limitations in pip. This means that users will not be able to upgrade the qiskit package in place. A critical section (the first time we've used it) release note is added to document the upgrade path for users.

Details and comments

Starting in Qiskit 1.0 the qiskit-terra package will no longer be
published anymore. This is a major change in the packaging because since
December 2018 users have been able rely on just the qiskit-terra package
if they were only depending on the core functionality in qiskit. But as
we're . This commit adds a warning on import of the `qiskit` namespace
if the `qiskit` package is not installed to inform users that starting
in 1.0.0 qiskit-terra will not recieve updates. There will still be
releases for the 0.46.x release series (while it's still supported).

The other aspect with this migration is there is **not** a safe direct
upgrade path from qiskit < 1.0.0 to qiskit>=1.0.0 due to limitations in
`pip`. This means that users will not be able to upgrade the `qiskit`
package in place. A `critical` section (the first time we've used it)
release note is added to document the upgrade path for users.
@mtreinish mtreinish added priority: high Changelog: Deprecation Include in "Deprecated" section of changelog Changelog: API Change Include in the "Changed" section of the changelog labels Nov 10, 2023
@mtreinish mtreinish added this to the 0.46.0 milestone Nov 10, 2023
@mtreinish mtreinish requested a review from a team as a code owner November 10, 2023 15:01
@qiskit-bot
Copy link
Collaborator

One or more of the the following people are requested to review this:

  • @Qiskit/terra-core

Copy link
Member

@jakelishman jakelishman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm thinking for documentation strategy, perhaps we should make a "preparing for Qiskit 1.0" blog post?

Comment on lines +24 to +35
try:
version("qiskit")
except PackageNotFoundError:
warnings.warn(
"The `qiskit` package is not installed, only `qiskit-terra` is installed. "
"Starting in Qiskit 1.0.0 only the `qiskit` package will be published. Migrate "
"any requirements files still using `qiskit-terra` to use `qiskit` instead. Also "
"when upgrading ensure you create a new venv instead of trying to "
"upgrade in place.",
FutureWarning,
stacklevel=2,
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can probably bikeshed around the exact message here, but my thoughts reading it were that it's not immediately clear to me what the remediation steps are (they're implied, not stated, for a user making their own venv rather than a library author). I'm thinking perhaps we should have an external documentation link / Qiskit blog post / whatever explaining this is in more detail that we link to from the message?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think linking to some place with more detail makes sense. I didn't want to write 10k words about the upgrade in a warning message, so linking to a location that has full details makes a lot of sense.

Copy link
Member

@jakelishman jakelishman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm just going to merge this as-is, then we'll refactor the checking and the message a little to join up relevant components as #11617 gets merged up to 0.46 as well.

@jakelishman jakelishman added this pull request to the merge queue Jan 30, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jan 30, 2024
@mtreinish mtreinish added this pull request to the merge queue Jan 30, 2024
Merged via the queue into Qiskit:stable/0.46 with commit 3e0d346 Jan 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Changelog: API Change Include in the "Changed" section of the changelog Changelog: Deprecation Include in "Deprecated" section of changelog priority: high
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants