Skip to main contentIBM Quantum Documentation
This page is from an old version of Qiskit SDK and does not exist in the latest version. We recommend you migrate to the latest version. See the release notes for more information.

Installing NLopt

In order to use any of the NLOpt based global optimizers NLopt must be installed. The NLopt download and installation instructions describe how to do this.

If you running on Windows, then you might want to refer to the specific instructions for NLopt on Windows.

If you are running on a Unix-like system, first ensure that your environment is set to the Python executable for which the Qiskit package is installed and running. Now, having downloaded and unpacked the NLopt archive file (for example, nlopt-2.4.2.tar.gz for version 2.4.2), enter the following commands:

./configure --enable-shared --with-python
make
sudo make install

The above makes and installs the shared libraries and Python interface in /usr/local. To have these be used by Qiskit, the following commands can be entered to augment the dynamic library load path and python path respectively, assuming that you choose to leave these entities where they were built and installed as per above commands and that you are running Python 3.6:

export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/lib64
export PYTHONPATH=/usr/local/lib/python3.6/site-packages:${PYTHONPATH}

The two export commands above can be pasted into the .bash_profile file in the user’s home directory for automatic execution. Now you can run Qiskit and these optimizers should be available for you to use.

Was this page helpful?
Report a bug or request content on GitHub.