Python Bindings¶
Installation¶
To install the latest release, you can use pip:
pip install ipctk
If you wish to install the current development code, you can compile the library from scratch. Either clone the repo manually or use git+ with pip:
pip install git+https://github.com/ipc-sim/ipc-toolkit
Build¶
To manually build the python binding you can either use the setup.py script or use cmake directly. The easiest way is to use the setup.py script which uses setuptools. To do this, use the following command from the root of the repository:
pip install .
This will build the library and install them on your system.
You can test that the installation was successful by doing
python -c "import ipctk"
SIMD¶
SIMD optimizations are enabled by default. To disable them (e.g., for compatibility with older or cross-compiled targets), set IPCTK_WITH_SIMD=0 before installing:
IPCTK_WITH_SIMD=0 pip install .
Accepted falsy values: 0, off, false, no (case-insensitive). Any other value keeps SIMD enabled.
Note
Pre-built binary wheels from PyPI have SIMD support baked in at wheel-build time. The IPCTK_WITH_SIMD variable only applies when building from source. To force a source build from PyPI, use:
IPCTK_WITH_SIMD=0 pip install --no-binary ipctk ipctk
CMake Build¶
Alternatively, you can use cmake directly. To do this, use the following commands from the root of the repository:
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release -DIPC_TOOLKIT_BUILD_PYTHON=ON ..
make -j$(nproc)