mirror of https://github.com/Qiskit/qiskit.git
Make pip error for version discovery non-fatal (#2661)
As part of the qiskit.__qiskit_version__ attribute we have to call pip to check for the meta-package version (since it doesn't contain any python code). However, when doing this there was no error handling in case pip failed for any reason. This is an issue because the version discovery code runs on import, so if pip fails for any reason, this becomes fatal and makes all of qiskit unusable. Since versions queried via pip aren't critical to the operation this commit adds the necessary error handling to the pip call. If pip fails for any reason we catch it and just move on. Fixes #2660
This commit is contained in:
parent
2151cb9249
commit
5a9cc56b21
|
@ -108,7 +108,10 @@ def _get_qiskit_versions():
|
|||
pass
|
||||
|
||||
cmd = [sys.executable, '-m', 'pip', 'freeze']
|
||||
reqs = _minimal_ext_cmd(cmd)
|
||||
try:
|
||||
reqs = _minimal_ext_cmd(cmd)
|
||||
except Exception:
|
||||
return out_dict
|
||||
reqs_dict = {}
|
||||
for req in reqs.split():
|
||||
req_parts = req.decode().split('==')
|
||||
|
|
Loading…
Reference in New Issue