{"id":27688539,"url":"https://github.com/openfheorg/openfhe-python","last_synced_at":"2026-04-10T21:19:20.456Z","repository":{"id":104797600,"uuid":"580440874","full_name":"openfheorg/openfhe-python","owner":"openfheorg","description":"Official Python wrapper for OpenFHE. Current release is v0.8.10 (released on October 28, 2024).","archived":false,"fork":false,"pushed_at":"2025-04-17T21:12:41.000Z","size":11899,"stargazers_count":102,"open_issues_count":17,"forks_count":34,"subscribers_count":9,"default_branch":"main","last_synced_at":"2025-04-18T08:37:42.587Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://openfheorg.github.io/openfhe-python/html/index.html","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/openfheorg.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-12-20T15:11:11.000Z","updated_at":"2025-04-08T07:44:38.000Z","dependencies_parsed_at":"2023-10-03T08:46:15.320Z","dependency_job_id":"96e7e49c-4554-4689-90df-e792b67f491a","html_url":"https://github.com/openfheorg/openfhe-python","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openfheorg%2Fopenfhe-python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openfheorg%2Fopenfhe-python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openfheorg%2Fopenfhe-python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openfheorg%2Fopenfhe-python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/openfheorg","download_url":"https://codeload.github.com/openfheorg/openfhe-python/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250796314,"owners_count":21488706,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-04-25T10:01:36.288Z","updated_at":"2026-04-10T21:19:20.445Z","avatar_url":"https://github.com/openfheorg.png","language":"C++","funding_links":[],"categories":["Libraries","OpenFHE Software Interfaces"],"sub_categories":[],"readme":"# OpenFHE-Python\n\n[![License](https://img.shields.io/badge/License-BSD%202--Clause-blue.svg)](https://opensource.org/licenses/BSD-2-Clause)\n[![Python Versions](https://img.shields.io/badge/python-3.10%2B-blue)](https://www.python.org/)\n[![OpenFHE Version](https://img.shields.io/badge/OpenFHE-1.5.1%2B-green)](https://github.com/openfheorg/openfhe-development)\n\nPython wrapper for the main cryptographic capabilities of the OpenFHE C++ library. `OpenFHE-Python` provides a more user-friendly interface for Python developers, while keeping the efficiency of C++ FHE operations.\n\n## Table of Contents\n\n- [Installing using pip](#installing-using-pip)\n- [Running from Docker](#running-from-docker)\n- [Building from Source](#building-from-source)\n  - [Prerequisites](#requirements)\n  - [Linux Install](#linux)\n    - [Installing directly on your system](#system-level-installation)\n    - [Using Conda environments](#conda)\n- [Running Examples](#code-examples)\n- [OpenFHE Python Wrapper Documentation](#openfhe-python-wrapper-documentation)\n- [Contributing Guide](#contributing-guide)\n\n## Installing using pip (for Ubuntu)\n\nOn Ubuntu, openfhe-python can be installed using pip.  All available releases are listed at [Python Package Index OpenFHE Release History](https://pypi.org/project/openfhe/#history). Find the release for your version of Ubuntu and run\n\n```\npip install openfhe==\u003copenfhe_package_version\u003e\n```\n\nOnce installed, any python example at https://github.com/openfheorg/openfhe-python/tree/main/examples can be executed.\n\nNote that Ubuntu LTS 22.04 and 24.04 are currently supported. `pip uninstall` can be used to uninstall the openfhe package.\n\n## Building from Source\n\nWe recommend installing the wrapper from PyPI using `pip`, as this is the simplest method.\nIf you prefer to build from source, you can use the [openfhe-python-packager](https://github.com/openfheorg/openfhe-python-packager) on Linux or follow the build instructions below. The packager generates a wheel that can be installed with `pip`.\n\nThe legacy build instructions below are for other operating systems where [openfhe-python-packager](https://github.com/openfheorg/openfhe-python-packager) may not work.\n\n### Requirements\n\nBefore building, make sure you have the following dependencies installed:\n\n- [OpenFHE 1.5.1+](https://github.com/openfheorg/openfhe-development) by following the instructions in [OpenFHE Documentation](https://openfhe-development.readthedocs.io/en/latest/sphinx_rsts/intro/installation/installation.html)\n- [Python 3.10+](https://www.python.org/)\n- [pybind11](https://pybind11.readthedocs.io/en/stable/installing.html)\n\nWe recommend following OpenFHE C++ installation instructions first (which covers Linux, Windows and MacOS) and then getting back to this repo. See notes on installing `pybind11` below\n\n### Linux\n\n#### System-level installation\n\nTo install OpenFHE-python directly to your system, ensure the dependencies are set up. Then clone the repository, open a terminal in the repo folder and run the following commands:\n\n```bash\npip install \"pybind11[global]\" \nmkdir build\ncd build\ncmake ..  # Alternatively, cmake .. -DCMAKE_PREFIX_PATH=/path/to/installed/openfhe if you installed OpenFHE elsewhere\nmake\nmake install  # You may have to run sudo make install\n```\n\nAt this point the `.so` file has been built. Your exact installation process will depend on your virtual environment.\nCmake 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.\n\nIf you see an error saying that one of OpenFHE .so files cannot be found when running a Python example (occurs only for some environments), \nadd the path where the .so files reside to the `PYTHONPATH` environment variable:\n\n```\nexport PYTHONPATH=(/path/to/installed/openfhe):$PYTHONPATH\n```\n\nIn some environments (this happens rarely), it may also be necessary to add the OpenFHE libraries path to `LD_LIBRARY_PATH`.\n\nIf OpenFHE is not installed in the default location, then both `PYTHONPATH and LD_LIBRARY_PATH` must be set before running any Python example.\n\n#### Conda\n\nAlternatively you can install the library and handle the linking via Conda. Clone the repository, open a terminal in the repo folder and run the following commands:\n\n```bash\nconda create -n ${ENV_NAME} python=3.{X} anaconda\n```\n\nwhere `${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 `\nconda create -n openfhe_python python=3.9 anaconda`. Now, you would install `pybind11` either via:\n\n`pip install \"pybind11[global]\"` or via `conda install -c conda-forge pybind11`, but for now we recommend using the first method, with pip. Some users have reported issues when using the conda pybind11\n\nNow, you would clone the repository, and run the following commands to install :\n\n```bash\nmkdir build\ncd build\ncmake .. # Add in -DCMAKE_PREFIX_PATH=/path/to/installed/openfhe if you installed OpenFHE elsewhere\nmake\nmake install  # You may have to run sudo make install\n```\n\nThen, you can develop the library to link\n\n```\ncd ..\nmkdir lib\nmv *.so lib\nconda develop lib\n```\n\nwhich creates a lib folder, moves the built `.so` file into that lib folder, and tells conda where to look for external libraries.\n\n**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.\n\n## Running Tests\n\nRun tests with [pytest](https://docs.pytest.org), which may be called `pytest-3` on your system. See the [testing readme](tests/README.md) for more information.\n\n```bash\npytest [--run-long]\n```\n\n## Code Examples\n\nTo get familiar with the OpenFHE Python API, check out the examples:\n\n- FHE for arithmetic over integers (BFV):\n  - [Simple Code Example](examples/pke/simple-integers.py)\n  \u003c!-- - [Simple Code Example with Serialization](examples/pke/simple-integers-serial.py) --\u003e\n- FHE for arithmetic over integers (BGV):\n  - [Simple Code Example](examples/pke/simple-integers-bgvrns.py)\n  \u003c!-- - [Simple Code Example with Serialization](examples/pke/simple-integers-serial-bgvrns.py) --\u003e\n- FHE for arithmetic over real numbers (CKKS):\n  - [Simple Code Example](examples/pke/simple-real-numbers.py)\n  - [Advanced Code Example](examples/pke/advanced-real-numbers.py)\n  - [Advanced Code Example for High-Precision CKKS](examples/pke/advanced-real-numbers-128.py)\n  - [Arbitrary Smooth Function Evaluation](examples/pke/function-evaluation.py)\n  - [Simple CKKS Bootstrapping Example](examples/pke/simple-ckks-bootstrapping.py)\n  - [Advanced CKKS Bootstrapping Example](examples/pke/advanced-ckks-bootstrapping.cpp)\n  - [Double-Precision (Iterative) Bootstrapping Example](examples/pke/iterative-ckks-bootstrapping.py)\n- FHE for Boolean circuits and larger plaintext spaces (FHEW/TFHE):\n  - [Simple Code Example with Symmetric Encryption](examples/binfhe/boolean.py)\n  - [Truth Table Example](examples/binfhe/boolean-truth-table.py)\n- Scheme Switching:\n  - [Examples with Scheme Switching between CKKS and FHEW/TFHE](examples/pke/scheme-switching.py)\n  \u003c!-- - [Code with JSON serialization](examples/binfhe/boolean-serial-json.py) --\u003e\n  \u003c!-- - [Code with Binary Serialization](examples/binfhe/boolean-serial-binary.py) --\u003e\n  \u003c!-- - [Large-Precision Comparison](examples/binfhe/eval-sign.py) --\u003e\n  \u003c!-- - [Small-Precison Arbitrary Function Evaluation](examples/binfhe/eval-function.py) --\u003e\n- Threshold FHE: \n  - [Code Example for BGV, BFV, and CKKS](examples/pke/threshold-fhe.py)\n  - [2-party Interactive Bootstrapping Examples](examples/pke/interactive-bootstrapping.py)\n  - [Simple n-party Interactive Bootstrapping Example](examples/pke/tckks-interactive-mp-bootstrapping.py)\n  - [n-party Interactive Bootstrapping after Chebyshev Approximation](examples/pke/tckks-interactive-mp-bootstrapping-Chebyschev.py)\n  - [Code Example for BFV with 5 parties](examples/pke/threshold-fhe-5p.py)\n\n## OpenFHE Python Wrapper Documentation\n\n[OpenFHE Python Wrapper API Reference](https://openfhe-python.readthedocs.io/en/latest/)\n\n## Contributing Guide\n\n[OpenFHE Development - Contributing Guide](https://openfhe-development.readthedocs.io/en/latest/sphinx_rsts/contributing/contributing_workflow.html)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenfheorg%2Fopenfhe-python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopenfheorg%2Fopenfhe-python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenfheorg%2Fopenfhe-python/lists"}