# Installing OpenFHE python wrapper

**URL:** <https://openfhe.discourse.group/t/installing-openfhe-python-wrapper/1602>\
**Category:** OpenFHE ports/wrappers\
**Created:** [September 23, 2024, 9:23pm UTC](https://openfhe.discourse.group/t/installing-openfhe-python-wrapper/1602 "2024-09-23T21:23:58Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mahta](https://avatars.discourse-cdn.com/v4/letter/m/53a042/32.png) [@mahta](https://openfhe.discourse.group/u/mahta)\
**Post date:** [September 23, 2024, 9:23pm UTC](https://openfhe.discourse.group/t/installing-openfhe-python-wrapper/1602/1 "2024-09-23T21:23:58Z")

</div>

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).](https://github.com/openfheorg/openfhe-python?tab=readme-ov-file)  
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/](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!

---

<div class="post-metadata">

**Author:** ![dsuponitskiy-duality](https://avatars.discourse-cdn.com/v4/letter/d/c68b51/32.png) [@dsuponitskiy-duality](https://openfhe.discourse.group/u/dsuponitskiy-duality)\
**Post date:** [September 24, 2024, 11:21am UTC](https://openfhe.discourse.group/t/installing-openfhe-python-wrapper/1602/2 "2024-09-24T11:21:55Z")

</div>

@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](https://github.com/openfheorg/openfhe-python/issues/58) for this.

---

<div class="post-metadata">

**Author:** ![mahta](https://avatars.discourse-cdn.com/v4/letter/m/53a042/32.png) [@mahta](https://openfhe.discourse.group/u/mahta)\
**Post date:** [September 24, 2024, 11:48am UTC](https://openfhe.discourse.group/t/installing-openfhe-python-wrapper/1602/3 "2024-09-24T11:48:42Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![dsuponitskiy-duality](https://avatars.discourse-cdn.com/v4/letter/d/c68b51/32.png) [@dsuponitskiy-duality](https://openfhe.discourse.group/u/dsuponitskiy-duality)\
**Post date:** [September 24, 2024, 2:08pm UTC](https://openfhe.discourse.group/t/installing-openfhe-python-wrapper/1602/4 "2024-09-24T14:08:47Z")

</div>

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