Skip to content

Commit

Permalink
Remove numpy 1.25 constraint (#83)
Browse files Browse the repository at this point in the history
Co-authored-by: Elena Peña Tapia <[email protected]>
  • Loading branch information
woodsp-ibm and ElePT authored Oct 9, 2023
1 parent 6ca1e09 commit 57d21b9
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 7 deletions.
5 changes: 1 addition & 4 deletions constraints.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
# Numpy 1.25 deprecated some behaviours that we used, and caused the isometry
# tests to flake. See https://github.com/Qiskit/qiskit-terra/issues/10305,
# remove pin when resolving that.
numpy<1.25
# Constraints may be listed here

3 changes: 1 addition & 2 deletions qiskit_algorithms/optimizers/snobfit.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,7 @@ def __init__(
See https://github.com/scikit-quant/scikit-quant/issues/24 for more details.
"""
# check version
version = tuple(map(int, np.__version__.split(".")))
if version >= (1, 24, 0):
if tuple(map(int, np.__version__.split(".")[:2])) >= (1, 24):
raise AlgorithmError(
"SnobFit is incompatible with NumPy 1.24.0 or above, please "
"install a previous version. See also scikit-quant/scikit-quant#24."
Expand Down
2 changes: 1 addition & 1 deletion qiskit_algorithms/optimizers/spsa.py
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,7 @@ def minimize(
logger.info("SPSA: Finished in %s", time() - start)

if self.last_avg > 1:
x = np.mean(last_steps, axis=0) # type: ignore[call-overload]
x = np.mean(np.asarray(last_steps), axis=0)

result = OptimizerResult()
result.x = x
Expand Down

0 comments on commit 57d21b9

Please sign in to comment.