40 lines
1.9 KiB
Plaintext
40 lines
1.9 KiB
Plaintext
---
|
||
title: nlopts (v0.31)
|
||
description: API reference for qiskit.algorithms.optimizers.nlopts in qiskit v0.31
|
||
in_page_toc_min_heading_level: 2
|
||
python_api_type: module
|
||
python_api_name: qiskit.algorithms.optimizers.nlopts
|
||
---
|
||
|
||
<span id="module-qiskit.algorithms.optimizers.nlopts" />
|
||
|
||
<span id="qiskit-algorithms-optimizers-nlopts" />
|
||
|
||
# qiskit.algorithms.optimizers.nlopts
|
||
|
||
<span id="id1" />
|
||
|
||
## Installing NLopt
|
||
|
||
In order to use any of the NLOpt based global optimizers NLopt must be installed. The [NLopt download and installation instructions](https://nlopt.readthedocs.io/en/latest/#download-and-installation) describe how to do this.
|
||
|
||
If you running on Windows, then you might want to refer to the specific [instructions for NLopt on Windows](https://nlopt.readthedocs.io/en/latest/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:
|
||
|
||
```sh
|
||
./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:
|
||
|
||
```sh
|
||
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.
|
||
|