Openfhe-python on linux fails

Hello, I’ve installed openfhe-python on linux following all steps from GitHub - openfheorg/openfhe-python: Official Python wrapper for OpenFHE. Current release is v0.8.6 (released on March 12, 2024). . I am facing the following error testing an example from openfhe-python/examples/pke/simple-integers.py at main · openfheorg/openfhe-python · GitHub :

Traceback (most recent call last):
File “”, line 1027, in _find_and_load
File “”, line 1006, in _find_and_load_unlocked
File “”, line 688, in _load_unlocked
File “”, line 883, in exec_module
File “”, line 241, in _call_with_frames_removed
File “/home//PycharmProjects/HETest/.venv/lib/python3.10/site-packages/openfhe/init.py”, line 1, in
from .openfhe import *
ImportError: /home//PycharmProjects/HETest/.venv/lib/python3.10/site-packages/openfhe/openfhe.so: undefined symbol: _ZN8lbcrypto12DCRTPolyImplIN9bigintdyn9mubintvecINS1_5ubintImEEEEE2atEj

Could you please help me?

Hi @svetlana,

I am not aware of any issues at the moment. Are you using the main branches of both OpenFHE and OpenFHE-Python? What OS and compilers are you using? Are you using the system-level or conda installation instructions?

The error you included seems to indicate an incompatibility between the .so files for OpenFHE and the Python wrapper. Please confirm you install the latest versions on your system (v1.1.4 and v0.8.6 for OpenFHE and Python wrapper, accordingly).

I also got the same error on arch, I installed both from their respective github repos. I should also note that I’m running pycharm, so it’s possible that it might have something to do with the venv.
However If I run from my terminal I get other error (c++ openfhe works fine):

Apparently, for the terminal error, you need to add the path of OpenFHE to your LD_LIBRARY_PATH.
Use the following:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/path/to/openfhe/library

yea that did it, but now shows same error as if run trough pycharm:

I’ve also tried updating/installing everything related to libcrypto but everything checked out

Got it working nicely with Autocompletion and everything. Here’s how to do it:

  1. Install OpenFHE trough the IDE package manager
  2. Copy your built openfhe .so file () to the openfhe folder inside the .venv folder
  3. Rename said file to openfhe.so (mine was openfhe.cpython-311-x86_64-linux-gnu.so), delete the installed by ide first
  4. Create a custom configuration for your run file on the IDE with this env variable (LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/path/to/openfhe/library/),
    It should look something like this:
  5. That’s it It should work. :smiley:
1 Like

Hi @ypolyakov, I am using the main branches and the latest versions are installed - v1.1.4 and v0.8.6 for OpenFHE and Python wrapper, respectively. Also, I am using Ubuntu 22.04.4 and the system-level installation. It still does not work.

@ypolyakov , hello again, it works now, changing the IDE from pychams to VS code helped.