Skip to content
Switch branches/tags

OpenJij : Framework for the Ising model and QUBO.


  • python >= 3.7
  • (optional) gcc >= 7.0.0
  • (optional) cmake >= 3.17
  • (optional) Ninja


install via pip

Note: To use GPGPU algorithms, please follow the section install via pip from source codes below. GPGPU algorithms are automatically enabled once CMake finds CUDA frameworks during installation.

$ pip install openjij

install via pip from source codes

To install OpenJij from source codes, please install CMake first then install OpenJij.

cmake setup

If you want to use instead of PIP, You will need to install CMake>=3.17.
We are Highly recommended install CMake via PYPI.

$ pip install -U cmake
  • macOS
$ brew install cmake
  • Linux
# if you installed old version by apt-get
$ apt-get purge cmake

# install cmake 
$ wget
$ tar xvf cmake-3.17.5.tar.gz
$ cd cmake-3.17.5
$ ./bootstrap && make && sudo make install 
  • Windows

Please install cmake from here.

Make sure the enviroment path for CMake is set correctly.

install OpenJij

$ pip install openjij --no-binary :all:

install from github repository

$ git clone
$ cd openjij
$ python -m pip install .


Test only Python code

$ python test

Test Python and C++ code

$ export USE_TEST=1
$ python test

How to use

Python example

import openjij as oj
sampler = oj.SASampler()
response = sampler.sample_ising(h={0: -1}, J={(0,1): -1})
# [[1,1]]

# with indices
response = sampler.sample_ising(h={'a': -1}, J={('a','b'): 1})
[{index: s for index, s in zip(response.indices, state)} for state in response.states]
# [{'b': -1, 'a': 1}]

C++ example

$ source ./
$ cd ./project_template
$ make
$ ./tutorial
The result spins are [1 1 1 1 1 ]


About us

This product is maintained by Jij Inc.

Please visit our website for more information!