Describe the bug
I am running this command:
from qiskit_algorithms.utils import algorithm_globals
and getting error:
RecursionError Traceback (most recent call last)
Cell In[8], line 1
----> 1 from qiskit_machine_learning.neural_networks import EstimatorQNN
3 estimator_qnn = EstimatorQNN(
4 circuit=qc1, observables=observable1, input_params=[params1[0]], weight_params=[params1[1]]
5 )
6 estimator_qnn
File ~/miniconda3/envs/conda_env/lib/python3.12/site-packages/qiskit_machine_learning/neural_networks/__init__.py:60
1 # This code is part of a Qiskit project.
2 #
3 # (C) Copyright IBM 2019, 2023.
(...)
10 # copyright notice, and modified files need to carry a notice indicating
11 # that they have been altered from the originals.
13 """
14 Quantum neural networks (:mod:`qiskit_machine_learning.neural_networks`)
15 ========================================================================
(...)
57 LocalEffectiveDimension
58 """
---> 60 from .effective_dimension import EffectiveDimension, LocalEffectiveDimension
61 from .estimator_qnn import EstimatorQNN
62 from .neural_network import NeuralNetwork
File ~/miniconda3/envs/conda_env/lib/python3.12/site-packages/qiskit_machine_learning/neural_networks/effective_dimension.py:23
21 from qiskit_algorithms.utils import algorithm_globals
22 from qiskit_machine_learning import QiskitMachineLearningError
---> 23 from .estimator_qnn import EstimatorQNN
24 from .neural_network import NeuralNetwork
26 logger = logging.getLogger(__name__)
File ~/miniconda3/envs/conda_env/lib/python3.12/site-packages/qiskit_machine_learning/neural_networks/estimator_qnn.py:26
24 from qiskit.quantum_info import SparsePauliOp
25 from qiskit.quantum_info.operators.base_operator import BaseOperator
---> 26 from qiskit_algorithms.gradients import (
27 BaseEstimatorGradient,
28 EstimatorGradientResult,
29 ParamShiftEstimatorGradient,
30 )
32 from qiskit_machine_learning.circuit.library import QNNCircuit
33 from qiskit_machine_learning.exceptions import QiskitMachineLearningError
File ~/miniconda3/envs/conda_env/lib/python3.12/site-packages/qiskit_algorithms/__init__.py:254
252 from .algorithm_job import AlgorithmJob
253 from .algorithm_result import AlgorithmResult
--> 254 from .variational_algorithm import VariationalAlgorithm, VariationalResult
255 from .amplitude_amplifiers import Grover, GroverResult, AmplificationProblem, AmplitudeAmplifier
256 from .amplitude_estimators import (
257 AmplitudeEstimator,
258 AmplitudeEstimatorResult,
(...)
267 EstimationProblem,
268 )
File ~/miniconda3/envs/conda_env/lib/python3.12/site-packages/qiskit_algorithms/variational_algorithm.py:36
33 from qiskit.circuit import QuantumCircuit
35 from .algorithm_result import AlgorithmResult
---> 36 from .optimizers import OptimizerResult
39 class VariationalAlgorithm(ABC):
40 """The Variational Algorithm Base Class."""
File ~/miniconda3/envs/conda_env/lib/python3.12/site-packages/qiskit_algorithms/optimizers/__init__.py:145
143 from .spsa import SPSA
144 from .tnc import TNC
--> 145 from .umda import UMDA
147 __all__ = [
148 "Optimizer",
149 "OptimizerSupportLevel",
(...)
181 "UMDA",
182 ]
File ~/miniconda3/envs/conda_env/lib/python3.12/site-packages/qiskit_algorithms/optimizers/umda.py:21
18 from typing import Any
20 import numpy as np
---> 21 from scipy.stats import norm
23 from qiskit_algorithms.utils import algorithm_globals
24 from .optimizer import OptimizerResult, POINT
File ~/miniconda3/envs/conda_env/lib/python3.12/site-packages/scipy/stats/__init__.py:610
1 """
2 .. _statsrefmanual:
3
(...)
605
606 """ # noqa: E501
608 from ._warnings_errors import (ConstantInputWarning, NearConstantInputWarning,
609 DegenerateDataWarning, FitError)
--> 610 from ._stats_py import *
611 from ._variation import variation
612 from .distributions import *
File ~/miniconda3/envs/conda_env/lib/python3.12/site-packages/scipy/stats/_stats_py.py:49
46 # Import unused here but needs to stay until end of deprecation periode
47 # See https://github.com/scipy/scipy/issues/15765#issuecomment-1875564522
48 from scipy import linalg # noqa: F401
---> 49 from . import distributions
50 from . import _mstats_basic as mstats_basic
52 from ._stats_mstats_common import _find_repeats, theilslopes, siegelslopes
File ~/miniconda3/envs/conda_env/lib/python3.12/site-packages/scipy/stats/distributions.py:10
1 #
2 # Author: Travis Oliphant 2002-2011 with contributions from
3 # SciPy Developers 2004-2011
(...)
6 # instead of `git blame -Lxxx,+x`.
7 #
8 from ._distn_infrastructure import (rv_discrete, rv_continuous, rv_frozen) # noqa: F401
---> 10 from . import _continuous_distns
11 from . import _discrete_distns
13 from ._continuous_distns import * # noqa: F403
File ~/miniconda3/envs/conda_env/lib/python3.12/site-packages/scipy/stats/_continuous_distns.py:12
10 import numpy as np
11 from numpy.polynomial import Polynomial
---> 12 from scipy.interpolate import BSpline
13 from scipy._lib.doccer import (extend_notes_in_docstring,
14 replace_notes_in_docstring,
15 inherit_docstring_from)
16 from scipy._lib._ccallback import LowLevelCallable
File ~/miniconda3/envs/conda_env/lib/python3.12/site-packages/scipy/interpolate/__init__.py:167
1 """
2 ========================================
3 Interpolation (:mod:`scipy.interpolate`)
(...)
165 (should not be used in new code).
166 """
--> 167 from ._interpolate import *
168 from ._fitpack_py import *
170 # New interface to fitpack library:
File ~/miniconda3/envs/conda_env/lib/python3.12/site-packages/scipy/interpolate/_interpolate.py:12
9 from scipy._lib._util import copy_if_needed
10 from scipy.special import comb
---> 12 from . import _fitpack_py
13 from ._polyint import _Interpolator1D
14 from . import _ppoly
File ~/miniconda3/envs/conda_env/lib/python3.12/site-packages/scipy/interpolate/_fitpack_py.py:8
5 import numpy as np
7 # These are in the API for fitpack even if not used in fitpack.py itself.
----> 8 from ._fitpack_impl import bisplrep, bisplev, dblint # noqa: F401
9 from . import _fitpack_impl as _impl
10 from ._bsplines import BSpline
File ~/miniconda3/envs/conda_env/lib/python3.12/site-packages/scipy/interpolate/_fitpack_impl.py:103
52 _iermess = {
53 0: ["The spline has a residual sum of squares fp such that "
54 "abs(fp-s)/s<=0.001", None],
(...)
68 'unknown': ["An error occurred", TypeError]
69 }
71 _iermess2 = {
72 0: ["The spline has a residual sum of squares fp such that "
73 "abs(fp-s)/s<=0.001", None],
(...)
99 'unknown': ["An error occurred", TypeError]
100 }
102 _parcur_cache = {'t': array([], float), 'wrk': array([], float),
--> 103 'iwrk': array([], dfitpack_int), 'u': array([], float),
104 'ub': 0, 'ue': 1}
107 def splprep(x, w=None, u=None, ub=None, ue=None, k=3, task=0, s=None, t=None,
108 full_output=0, nest=None, per=0, quiet=1):
109 # see the docstring of `_fitpack_py/splprep`
110 if task <= 0:
File ~/miniconda3/envs/conda_env/lib/python3.12/site-packages/numpy/core/_dtype.py:46, in __repr__(dtype)
45 def __repr__(dtype):
---> 46 arg_str = _construction_repr(dtype, include_align=False)
47 if dtype.isalignedstruct:
48 arg_str = arg_str + ", align=True"
File ~/miniconda3/envs/conda_env/lib/python3.12/site-packages/numpy/core/_dtype.py:100, in _construction_repr(dtype, include_align, short)
98 return _subarray_str(dtype)
99 else:
--> 100 return _scalar_str(dtype, short=short)
File ~/miniconda3/envs/conda_env/lib/python3.12/site-packages/numpy/core/_dtype.py:143, in _scalar_str(dtype, short)
140 elif dtype.type == np.timedelta64:
141 return "'%sm8%s'" % (byteorder, _datetime_metadata_str(dtype))
--> 143 elif np.issubdtype(dtype, np.number):
144 # Short repr with endianness, like '<f8'
145 if short or dtype.byteorder not in ('=', '|'):
146 return "'%s%c%d'" % (byteorder, dtype.kind, dtype.itemsize)
File ~/miniconda3/envs/conda_env/lib/python3.12/site-packages/numpy/core/numerictypes.py:417, in issubdtype(arg1, arg2)
359 r"""
360 Returns True if first argument is a typecode lower/equal in type hierarchy.
361
(...)
414
415 """
416 if not issubclass_(arg1, generic):
--> 417 arg1 = dtype(arg1).type
418 if not issubclass_(arg2, generic):
419 arg2 = dtype(arg2).type
File ~/miniconda3/envs/conda_env/lib/python3.12/site-packages/numpy/core/_dtype.py:46, in __repr__(dtype)
45 def __repr__(dtype):
---> 46 arg_str = _construction_repr(dtype, include_align=False)
47 if dtype.isalignedstruct:
48 arg_str = arg_str + ", align=True"
File ~/miniconda3/envs/conda_env/lib/python3.12/site-packages/numpy/core/_dtype.py:100, in _construction_repr(dtype, include_align, short)
98 return _subarray_str(dtype)
99 else:
--> 100 return _scalar_str(dtype, short=short)
File ~/miniconda3/envs/conda_env/lib/python3.12/site-packages/numpy/core/_dtype.py:143, in _scalar_str(dtype, short)
140 elif dtype.type == np.timedelta64:
141 return "'%sm8%s'" % (byteorder, _datetime_metadata_str(dtype))
--> 143 elif np.issubdtype(dtype, np.number):
144 # Short repr with endianness, like '<f8'
145 if short or dtype.byteorder not in ('=', '|'):
146 return "'%s%c%d'" % (byteorder, dtype.kind, dtype.itemsize)
File ~/miniconda3/envs/conda_env/lib/python3.12/site-packages/numpy/core/numerictypes.py:417, in issubdtype(arg1, arg2)
359 r"""
360 Returns True if first argument is a typecode lower/equal in type hierarchy.
361
(...)
414
415 """
416 if not issubclass_(arg1, generic):
--> 417 arg1 = dtype(arg1).type
418 if not issubclass_(arg2, generic):
419 arg2 = dtype(arg2).type
[... skipping similar frames: __repr__ at line 46 (717 times), _construction_repr at line 100 (717 times), _scalar_str at line 143 (716 times), issubdtype at line 417 (716 times)]
File ~/miniconda3/envs/conda_env/lib/python3.12/site-packages/numpy/core/_dtype.py:143, in _scalar_str(dtype, short)
140 elif dtype.type == np.timedelta64:
141 return "'%sm8%s'" % (byteorder, _datetime_metadata_str(dtype))
--> 143 elif np.issubdtype(dtype, np.number):
144 # Short repr with endianness, like '<f8'
145 if short or dtype.byteorder not in ('=', '|'):
146 return "'%s%c%d'" % (byteorder, dtype.kind, dtype.itemsize)
File ~/miniconda3/envs/conda_env/lib/python3.12/site-packages/numpy/core/numerictypes.py:417, in issubdtype(arg1, arg2)
359 r"""
360 Returns True if first argument is a typecode lower/equal in type hierarchy.
361
(...)
414
415 """
416 if not issubclass_(arg1, generic):
--> 417 arg1 = dtype(arg1).type
418 if not issubclass_(arg2, generic):
419 arg2 = dtype(arg2).type
File ~/miniconda3/envs/conda_env/lib/python3.12/site-packages/numpy/core/_dtype.py:46, in __repr__(dtype)
45 def __repr__(dtype):
---> 46 arg_str = _construction_repr(dtype, include_align=False)
47 if dtype.isalignedstruct:
48 arg_str = arg_str + ", align=True"
File ~/miniconda3/envs/conda_env/lib/python3.12/site-packages/numpy/core/_dtype.py:100, in _construction_repr(dtype, include_align, short)
98 return _subarray_str(dtype)
99 else:
--> 100 return _scalar_str(dtype, short=short)
File ~/miniconda3/envs/conda_env/lib/python3.12/site-packages/numpy/core/_dtype.py:104, in _scalar_str(dtype, short)
103 def _scalar_str(dtype, short):
--> 104 byteorder = _byte_order_str(dtype)
106 if dtype.type == np.bool_:
107 if short:
RecursionError: maximum recursion depth exceeded
Suggested solutions
I know another issue has been opened on this but I could not find any response for that. And that is why I opened another one. thanks
Additional Information
qiskit-ibm-runtime version: qiskit-machine-learning: 0.7.2 and qiskit: 1.1.1
Describe the bug I am running this command:
from qiskit_algorithms.utils import algorithm_globals
and getting error:
Suggested solutions I know another issue has been opened on this but I could not find any response for that. And that is why I opened another one. thanks
Additional Information