Installing OpenFHE python wrapper

Hello,
I have been trying to install the Python wrapper on my Windows with conda based on the instructions provided in GitHub - openfheorg/openfhe-python: Official Python wrapper for OpenFHE. Current release is v0.8.9 (released on September 10, 2024).
I installed OpenFHE 1.1.3+ as instructed and then I cloned the repository for the Python wrapper in another directory and created a new environment using Anaconda prompt. I then used the following commands after making the build directory since the ones provided in the documentation were not working in my Anaconda prompt.

cmake -G “MinGW Makefiles” …
mingw32-make
mingw32-make install

Afterwards, I created the lib directory and since I did not have any .so files, I moved the openfhe.cp311-win_amd64.pyd file into the lib directory. I also added the following directories into the path variables:

set PYTHONPATH=C:\Users\mahta\openfhe-python\lib;%PYTHONPATH%
set PATH=%PATH%;C:\Program Files (x86)\OpenFHE\lib

but when I try to run pytest I get the following error messages:

================================================= test session starts =================================================
platform win32 – Python 3.11.9, pytest-7.4.4, pluggy-1.0.0
rootdir: C:\Users\mahta\openfhe-python
configfile: pytest.ini
plugins: anyio-4.2.0
collected 0 items / 6 errors

======================================================= ERRORS ========================================================
_________________________________________ ERROR collecting tests/test_bgv.py __________________________________________
ImportError while importing test module ‘C:\Users\mahta\openfhe-python\tests\test_bgv.py’.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
…\anaconda3\envs\openfhe_env\Lib\importlib_init_.py:126: in import_module
return _bootstrap.gcd_import(name[level:], package, level)
tests\test_bgv.py:5: in
import openfhe as fhe
E ImportError: DLL load failed while importing openfhe: The specified module could not be found.
_______________________________________ ERROR collecting tests/test_boolean.py ________________________________________
ImportError while importing test module ‘C:\Users\mahta\openfhe-python\tests\test_boolean.py’.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
…\anaconda3\envs\openfhe_env\Lib\importlib_init
.py:126: in import_module
return _bootstrap.gcd_import(name[level:], package, level)
tests\test_boolean.py:1: in
from openfhe import *
E ImportError: DLL load failed while importing openfhe: The specified module could not be found.
_________________________________________ ERROR collecting tests/test_ckks.py _________________________________________
ImportError while importing test module ‘C:\Users\mahta\openfhe-python\tests\test_ckks.py’.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
…\anaconda3\envs\openfhe_env\Lib\importlib_init
.py:126: in import_module
return _bootstrap.gcd_import(name[level:], package, level)
tests\test_ckks.py:4: in
import openfhe as fhe
E ImportError: DLL load failed while importing openfhe: The specified module could not be found.
____________________________________ ERROR collecting tests/test_cryptocontext.py _____________________________________
ImportError while importing test module ‘C:\Users\mahta\openfhe-python\tests\test_cryptocontext.py’.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
…\anaconda3\envs\openfhe_env\Lib\importlib_init
.py:126: in import_module
return _bootstrap.gcd_import(name[level:], package, level)
tests\test_cryptocontext.py:2: in
import openfhe as fhe
E ImportError: DLL load failed while importing openfhe: The specified module could not be found.
_______________________________________ ERROR collecting tests/test_examples.py _______________________________________
ImportError while importing test module ‘C:\Users\mahta\openfhe-python\tests\test_examples.py’.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
…\anaconda3\envs\openfhe_env\Lib\importlib_init
.py:126: in import_module
return _bootstrap.gcd_import(name[level:], package, level)
tests\test_examples.py:8: in
import openfhe as fhe
E ImportError: DLL load failed while importing openfhe: The specified module could not be found.
______________________________________ ERROR collecting tests/test_serial_cc.py _______________________________________
ImportError while importing test module ‘C:\Users\mahta\openfhe-python\tests\test_serial_cc.py’.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
…\anaconda3\envs\openfhe_env\Lib\importlib_init
.py:126: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
tests\test_serial_cc.py:4: in
import openfhe as fhe
E ImportError: DLL load failed while importing openfhe: The specified module could not be found.
=============================================== short test summary info ===============================================
ERROR tests/test_bgv.py
ERROR tests/test_boolean.py
ERROR tests/test_ckks.py
ERROR tests/test_cryptocontext.py
ERROR tests/test_examples.py
ERROR tests/test_serial_cc.py
!!! Interrupted: 6 errors during collection !!!
================================================== 6 errors in 0.24s ==================================================

I tried multiple times to rebuild the openfhe-development and openfhe-python but I still face the same issue every time.

Afterward, I decided to try using Docker for that and the installation was successful but when I opened the notebook on http://localhost:8888/ I was not able to import openfhe library.

!pip show openfhe
WARNING: Package(s) not found: openfhe

Could you please assist me in gaining access to the Python library using either method?

Thanks!

@mahta We have not tested the OpenFHE wrapper in MinGW yet. There is an open issue for adding Windows support: Add support for Windows (MinGW) · Issue #58 · openfheorg/openfhe-python · GitHub for this.

Okay thanks, but is there also an issue regarding the docker? because I am not able to import OpenFHE as a library in Jupyterlab after I have followed the instructions.

@mahta I believe it’s the same issue. Would you be able to use a different environment, such as Ubuntu, instead?