Build block2 in manylinux2010 docker image

The docker image named is used.

First we need to select one python version:

export PATH=/opt/python/cp37-cp37m/bin:$PATHBAK
export PATH=/opt/python/cp38-cp38/bin:$PATHBAK
export PATH=/opt/python/cp39-cp39/bin:$PATHBAK
export PATH=/opt/python/cp310-cp310/bin:$PATHBAK
which python3

Clone the block2 repo:

git clone

Edit the


Instal dependencies and build:

python3 -m pip install pip build twine --upgrade
python3 -m pip install mkl==2019 mkl-include intel-openmp numpy 'cmake>=3.19' pybind11
python3 -m build

Change linux tag and upload:

mv dist/block2-0.1.10-cp38-cp38-linux_x86_64.whl dist/block2-0.1.10-cp38-cp38-manylinux2010_x86_64.whl
python3 -m twine upload dist/block2-0.1.10-cp38-cp38-manylinux2010_x86_64.whl

Installing block2 using python virtual environment

This guide shows how one can manually build block2 with openmpi without using Anaconda and Intel oneapi.

First we assume a suitable python3, openmpi library, and gcc compiler can be found in the system. For example, I have

$ which gcc
$ which mpirun
$ which python3

First we install the python virtualenv

$ python3 -m pip install --user --upgrade pip
$ python3 -m pip install --user virtualenv

Then we create a virtualenv called base and activate it, which will create a folder called base in the current folder

$ python3 -m venv base
$ source base/bin/activate

Then we install necessary packages in this virtualenv

$ pip install mkl mkl-include pybind11 numpy scipy psutil
$ pip install mpi4py --no-binary mpi4py

Then we can build block as the following

$ mkdir build
$ cd build
$ export MKLROOT=/path/to/base
$ export PATH=/path/to/base:$PATH

We can test that mpi4py is working

$ mpirun -n 2 python -c 'from mpi4py import MPI;print(MPI.COMM_WORLD.rank)'