Install the C API

Requirements

Before compiling the qiskit-fermions C API, you need to compile the Qiskit C API. You can do this in any location, but to get started quickly, follow these steps:

$ cd path/to/qiskit-fermions
$ git clone git@github.com:Qiskit/qiskit.git build/qiskit
$ cd build/qiskit
$ make c

Hint

On Windows only, you will need to copy additional library files:

$ cp target/release/qiskit_cext.dll dist/c/lib/qiskit_cext.dll
$ cp target/release/qiskit_cext.dll.lib dist/c/lib/qiskit_cext.dll.lib
$ cp target/release/qiskit_cext.dll.lib dist/c/lib/qiskit.dll.lib

You can now move on to the steps of compiling qiskit-fermions C API that follow.

If you want to test your installation, install the following dependencies:

Install steps

  1. Ensure that you are in the right directory:

    $ cd path/to/qiskit-fermions
    
  2. Configure your shell environment with the locations of your compiled Qiskit C API library and include directory.

    Hint

    This code uses the build/qiskit path from the code at the top of this page. Adjust the paths according to your setup.

    $ export QISKIT_LIB=$(find $(pwd)/build/qiskit/dist/c/lib -name "libqiskit.*")
    $ export QISKIT_INCLUDE=$(pwd)/build/qiskit/dist/c/include
    
    $ export QISKIT_LIB=$(find $(pwd)/build/qiskit/dist/c/lib -name "qiskit_cext.dll.lib")
    $ export QISKIT_INCLUDE=$(pwd)/build/qiskit/dist/c/include
    
  3. Compile the qiskit-fermions C API:

    $ make cext
    
  1. (optional) Verify the installation by running the C unit tests:

    $ make testc
    

Verify that you see these relevant files:

  • dist/c/lib/libqiskit_fermions.so (The suffix might vary depending on your operating system)

  • dist/c/include/qiskit_fermions.h