|
35 | 35 | from .layer import * |
36 | 36 | from .encoding import * |
37 | 37 | from .util import * |
38 | | -from .noise_model import * |
| 38 | +# Note: noise_model requires qiskit and is not imported by default |
| 39 | +# from .noise_model import * |
39 | 40 | from .algorithm import * |
40 | 41 | from .dataset import * |
41 | 42 | from .pulse import * |
42 | 43 |
|
43 | 44 | # here we check whether the Qiskit parameterization bug is fixed, if not, a |
44 | 45 | # warning message will be printed |
45 | | -import qiskit |
46 | | -import os |
| 46 | +# This is only done if qiskit is available |
| 47 | +try: |
| 48 | + import qiskit |
| 49 | + import os |
47 | 50 |
|
48 | | -path = os.path.abspath(qiskit.__file__) |
49 | | -# print(path) |
50 | | -# path for aer provider |
51 | | -path_provider = path.replace("__init__.py", "providers/aer/backends/aerbackend.py") |
52 | | -# print(path_provider) |
| 51 | + path = os.path.abspath(qiskit.__file__) |
| 52 | + # print(path) |
| 53 | + # path for aer provider |
| 54 | + path_provider = path.replace("__init__.py", "providers/aer/backends/aerbackend.py") |
| 55 | + # print(path_provider) |
53 | 56 |
|
54 | | -# with open(path_provider, 'r') as fid: |
55 | | -# for line in fid.readlines(): |
56 | | -# if 'FIXED' in line: |
57 | | -# # print('The qiskit parameterization bug is already fixed!') |
58 | | -# break |
59 | | -# else: |
60 | | -# print(f'\n\n WARNING: The qiskit parameterization bug is not ' |
61 | | -# f'fixed!\n\n' |
62 | | -# f'run python fix_qiskit_parameterization.py to fix it!' |
63 | | -# ) |
64 | | -# break |
| 57 | + # with open(path_provider, 'r') as fid: |
| 58 | + # for line in fid.readlines(): |
| 59 | + # if 'FIXED' in line: |
| 60 | + # # print('The qiskit parameterization bug is already fixed!') |
| 61 | + # break |
| 62 | + # else: |
| 63 | + # print(f'\n\n WARNING: The qiskit parameterization bug is not ' |
| 64 | + # f'fixed!\n\n' |
| 65 | + # f'run python fix_qiskit_parameterization.py to fix it!' |
| 66 | + # ) |
| 67 | + # break |
| 68 | +except ImportError: |
| 69 | + # qiskit not available, skip the check |
| 70 | + pass |
0 commit comments