-
Notifications
You must be signed in to change notification settings - Fork 127
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
Import of LocalReadoutError from qiskit_experiments.library in IBM Quantum Lab #1050
Comments
Problem seems to exist for other applications using the scikit-learn package as well. Downgrading to scikit-learn 1.1.0 using the command |
Hmm, while it seems like this is an issue outside of qiskit-experiments and has a workaround, I think we might want to address it by pushing the scikit-learn imports lower into the stack so that most users will not encounter them. |
### Summary This commit pushes the import of scikit-learn lower into the code, so that it does not occur until first usage. ### Details and comments Previously, scikit-learn was in a `try` block which allowed for code that did not use scikit-learn to work fine when it was not installed. However, sometimes scikit-learn can be installed but have errors (like in #1050) which were not caught by the `try` block. Further delaying the import can help in this case. Additionally, scikit-learn is a little bit of a slow import, so not importing it when it is not needed gives a little bit of efficiency (maybe; mostly it imports scipy modules but those might get imported any way by other analysis code). --------- Co-authored-by: Helena Zhang <[email protected]>
I removed the 0.5.0 milestone because #1061 was merged. I will leave this open until |
|
Informations
What is the current behavior?
When using
from qiskit_experiments.library import LocalReadoutError
in the IBM Quantum Lab, the error notificationAttributeError: module 'sklearn.metrics._dist_metrics' has no attribute 'DistanceMetric32'
is printed and the requested import does not happen.Steps to reproduce the problem
Use 'from qiskit_experiments.library import LocalReadoutError' in IBM Quantum Lab.
What is the expected behavior?
Import of LocalReadoutError
Suggested solutions
The text was updated successfully, but these errors were encountered: