Skip to content
This repository has been archived by the owner on Dec 7, 2021. It is now read-only.

Commit

Permalink
Merge branch 'master' into fix-docplex2
Browse files Browse the repository at this point in the history
  • Loading branch information
manoelmarques authored Feb 8, 2021
2 parents 8921ff4 + adf5296 commit 722b914
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,10 @@ jobs:
- uses: ./.github/actions/install-aqua
- name: Install Dependencies
run: |
pip install jax jaxlib
# pin jax and jaxlib as the latest jaxlib 0.1.60 forces
# numpy 1.19.5 to be installed which causes cvxpy failure to load
# with 'numpy.core.multiarray failed to import.' error.
pip install -U jax==0.2.9 jaxlib==0.1.59
shell: bash
- name: Aqua Unit Tests under Python ${{ matrix.python-version }}
uses: ./.github/actions/run-tests
Expand Down
12 changes: 5 additions & 7 deletions qiskit/aqua/utils/qp_solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,6 @@
import logging

import numpy as np
try:
import cvxpy
_HAS_CVX = True
except ImportError:
_HAS_CVX = False

from qiskit.aqua import MissingOptionalLibraryError

Expand Down Expand Up @@ -57,11 +52,14 @@ def optimize_svm(kernel_matrix: np.ndarray,
MissingOptionalLibraryError: If cvxpy is not installed
"""
# pylint: disable=invalid-name, unused-argument
if not _HAS_CVX:
try:
import cvxpy
except ImportError as ex:
raise MissingOptionalLibraryError(
libname='CVXPY',
name='optimize_svm',
pip_install="pip install 'qiskit-aqua[cvx]'")
pip_install="pip install 'qiskit-aqua[cvx]'",
msg=str(ex)) from ex

if max_iters is not None:
warnings.warn('The max_iters parameter is deprecated as of '
Expand Down

0 comments on commit 722b914

Please sign in to comment.