A fork of https://github.com/openfheorg/openfhe-python to add some missing functionality

Rener Oliveira 44a5f65973 Merge pull request #44 from openfheorg/yspolyakov-patch-1 1 ano atrás
docs 93a1ad31cf sphinks make 1 ano atrás
include 38a88ff92a licensa clause in source files 1 ano atrás
src 3802f9a8ef BinFHE enums fix for OpenFHE v1.1 (#43) 1 ano atrás
.gitignore 8a09d5998e Preview of First Release (#32) 1 ano atrás
CMakeLists.txt 8a09d5998e Preview of First Release (#32) 1 ano atrás
LICENSE 72c9603a08 Initial commit 2 anos atrás
README.md 9ca45db8a9 Update README.md 1 ano atrás

README.md

Official Python wrapper for OpenFHE

Table of Contents

Building

Requirements

Before building, make sure you have the following dependencies installed:

We recommend following OpenFHE C++ installation instructions first (which covers Linux, Windows and MacOS) and then get back to this repo.

You can install pybind11 by runnning:

pip install "pybind11[global]" # or alternatively, if you use conda:
conda install -c conda-forge pybind11

For custom installation or any other issues, please refer to the official pybind11 documentation in the link above.

Linux

With all the dependencies set up, clone the repository, open a terminal in the repo folder and run the following commands:

mkdir build
cd build
cmake ..  # Alternatively, cmake .. -DOpenFHE_DIR=/path/to/installed/openfhe
make

At this point the .so file has been built. Your exact installation process will depend on your virtual environment. Cmake will automatically find the python installation path, if unwanted, you can specify the python path by adding -DPYTHON_EXECUTABLE_PATH=/path/to/python to the cmake command.

Conda

conda create -n ${ENV_NAME} python=3.{X} anaconda

where ${ENV_NAME} should be replaced with the name of your environment, and {X} should be replaced with your desired python version. For example you might have conda create -n openfhe_python python=3.9 anaconda

It's recommended to specify the python path to avoid any issues with conda environments. To do this, run the following commands:

mkdir build
cd build
cmake ..  # Or cmake .. -DPYTHON_EXECUTABLE_PATH=$CONDA_PREFIX/bin/python
make

The CONDA_PREFIX variable is set by conda, and points to the root of your active conda environment.

Then, you can develop the library:

mkdir lib
mv *.so lib
conda develop lib

which creates a lib folder, moves the built .so file into that lib folder, and tells conda where to look for external libraries.

Note You may wish to copy the .so file to any projects of your own, or add it to your system path to source from.

System install

make install  # You may have to run sudo make install

Code Examples

To get familiar with the OpenFHE Python API, check out the examples:

OpenFHE Python Wrapper Documentation

OpenFHE Python Wrapper API Reference