Giter VIP home page Giter VIP logo

openfhe-python's People

Contributors

dsuponitskiy-duality avatar g-arakelov avatar gpujana avatar ianqs avatar iquah1 avatar mctriplett avatar reneroliveira avatar thadah avatar yspolyakov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

openfhe-python's Issues

binfhe examples are not working

I am getting the following error

~/git/openfhe-python$ python3 examples/binfhe/boolean.py
Generating the bootstrapping keys...

Traceback (most recent call last):
  File "examples/binfhe/boolean.py", line 23, in <module>
    cc.BTKeyGen(sk)
TypeError: BTKeyGen(): incompatible function arguments. The following argument types are supported:
    1. (self: openfhe.BinFHEContext, arg0: lbcrypto::LWEPrivateKeyImpl, arg1: lbcrypto::KEYGEN_MODE) -> None

Invoked with: <openfhe.BinFHEContext object at 0x7f79c09cd5b0>, <openfhe.LWEPrivateKey object at 0x7f79c0a552f0>

installation error

cmake is successfull

When I try to make the project, I met these problem,how can I solve it?

pavanr@central-server:~/Downloads/openfhe-python/build$ cmake .. -DPYTHON_EXECUTABLE_PATH=/usr/bin/python3 -Dpybind11_DIR=/home/pavanr/.local/lib/python3.8/site-packages/pybind11/share/cmake/pybind11 -DOpenFHE_DIR=/usr/local/include/openfhe
-- The C compiler identification is GNU 9.4.0
-- The CXX compiler identification is GNU 9.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found PythonInterp: /usr/bin/python3 (found suitable version "3.8.10", minimum required is "3.6")
-- Found PythonLibs: /usr/lib/x86_64-linux-gnu/libpython3.8.so
-- Performing Test HAS_FLTO
-- Performing Test HAS_FLTO - Success
-- Found pybind11: /home/pavanr/.local/lib/python3.8/site-packages/pybind11/include (found version "2.11.1")
-- Python site packages directory: /usr/lib/python3/dist-packages
-- Configuring done
-- Generating done
-- Build files have been written to: /home/pavanr/Downloads/openfhe-python/build
pavanr@central-server:~/Downloads/openfhe-python/build$ make
Scanning dependencies of target openfhe
[ 16%] Building CXX object CMakeFiles/openfhe.dir/src/lib/bindings.cpp.o
In file included from /home/pavanr/Downloads/openfhe-python/src/lib/bindings.cpp:1:
/home/pavanr/.local/lib/python3.8/site-packages/pybind11/include/pybind11/pybind11.h: In instantiation of ‘void pybind11::cpp_function::initialize(Func&&, Return (*)(Args ...), const Extra& ...) [with Func = pybind11::cpp_function::cpp_function(Return (Class::*)(Arg ...), const Extra& ...) [with Return = void; Class = lbcrypto::CryptoContextImpl<lbcrypto::DCRTPolyImpl<bigintdyn::mubintvec<bigintdyn::ubint<long unsigned int> > > >; Arg = {std::vector<unsigned int, std::allocator<unsigned int> >, std::vector<unsigned int, std::allocator<unsigned int> >, unsigned int, unsigned int, bool}; Extra = {pybind11::name, pybind11::is_method, pybind11::sibling, const char*, pybind11::arg_v, pybind11::arg_v, pybind11::arg_v, pybind11::arg_v}]::<lambda(lbcrypto::CryptoContextImpl<lbcrypto::DCRTPolyImpl<bigintdyn::mubintvec<bigintdyn::ubint<long unsigned int> > > >*, std::vector<unsigned int>, std::vector<unsigned int>, unsigned int, unsigned int, bool)>; Return = void; Args = {lbcrypto::CryptoContextImpl<lbcrypto::DCRTPolyImpl<bigintdyn::mubintvec<bigintdyn::ubint<long unsigned int> > > >*, std::vector<unsigned int, std::allocator<unsigned int> >, std::vector<unsigned int, std::allocator<unsigned int> >, unsigned int, unsigned int, bool}; Extra = {pybind11::name, pybind11::is_method, pybind11::sibling, const char*, pybind11::arg_v, pybind11::arg_v, pybind11::arg_v, pybind11::arg_v}]’:
/home/pavanr/.local/lib/python3.8/site-packages/pybind11/include/pybind11/pybind11.h:110:9:   required from ‘pybind11::cpp_function::cpp_function(Return (Class::*)(Arg ...), const Extra& ...) [with Return = void; Class = lbcrypto::CryptoContextImpl<lbcrypto::DCRTPolyImpl<bigintdyn::mubintvec<bigintdyn::ubint<long unsigned int> > > >; Arg = {std::vector<unsigned int, std::allocator<unsigned int> >, std::vector<unsigned int, std::allocator<unsigned int> >, unsigned int, unsigned int, bool}; Extra = {pybind11::name, pybind11::is_method, pybind11::sibling, const char*, pybind11::arg_v, pybind11::arg_v, pybind11::arg_v, pybind11::arg_v}]’
/home/pavanr/.local/lib/python3.8/site-packages/pybind11/include/pybind11/pybind11.h:1575:22:   required from ‘pybind11::class_<type_, options>& pybind11::class_<type_, options>::def(const char*, Func&&, const Extra& ...) [with Func = void (lbcrypto::CryptoContextImpl<lbcrypto::DCRTPolyImpl<bigintdyn::mubintvec<bigintdyn::ubint<long unsigned int> > > >::*)(std::vector<unsigned int>, std::vector<unsigned int>, unsigned int, unsigned int, bool); Extra = {const char*, pybind11::arg_v, pybind11::arg_v, pybind11::arg_v, pybind11::arg_v}; type_ = lbcrypto::CryptoContextImpl<lbcrypto::DCRTPolyImpl<bigintdyn::mubintvec<bigintdyn::ubint<long unsigned int> > > >; options = {std::shared_ptr<lbcrypto::CryptoContextImpl<lbcrypto::DCRTPolyImpl<bigintdyn::mubintvec<bigintdyn::ubint<long unsigned int> > > > >}]’
/home/pavanr/Downloads/openfhe-python/src/lib/bindings.cpp:587:45:   required from here
/home/pavanr/.local/lib/python3.8/site-packages/pybind11/include/pybind11/pybind11.h:219:40: error: static assertion failed: The number of argument annotations does not match the number of function arguments
  219 |             expected_num_args<Extra...>(
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~^
  220 |                 sizeof...(Args), cast_in::args_pos >= 0, cast_in::has_kwargs),
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/pavanr/.local/lib/python3.8/site-packages/pybind11/include/pybind11/attr.h:14,
                 from /home/pavanr/.local/lib/python3.8/site-packages/pybind11/include/pybind11/detail/class.h:12,
                 from /home/pavanr/.local/lib/python3.8/site-packages/pybind11/include/pybind11/pybind11.h:13,
                 from /home/pavanr/Downloads/openfhe-python/src/lib/bindings.cpp:1:
/home/pavanr/.local/lib/python3.8/site-packages/pybind11/include/pybind11/cast.h:1453:57: error: ‘std::enable_if_t<std::is_void<_Yp>::value, pybind11::detail::void_type> pybind11::detail::argument_loader<Args>::call(Func&&) && [with Return = void; Guard = pybind11::detail::void_type; Func = pybind11::cpp_function::cpp_function(Return (Class::*)(Arg ...), const Extra& ...) [with Return = void; Class = lbcrypto::CryptoContextImpl<lbcrypto::DCRTPolyImpl<bigintdyn::mubintvec<bigintdyn::ubint<long unsigned int> > > >; Arg = {std::vector<unsigned int, std::allocator<unsigned int> >, std::vector<unsigned int, std::allocator<unsigned int> >, unsigned int, unsigned int, bool}; Extra = {pybind11::name, pybind11::is_method, pybind11::sibling, const char*, pybind11::arg_v, pybind11::arg_v, pybind11::arg_v, pybind11::arg_v}]::<lambda(lbcrypto::CryptoContextImpl<lbcrypto::DCRTPolyImpl<bigintdyn::mubintvec<bigintdyn::ubint<long unsigned int> > > >*, std::vector<unsigned int>, std::vector<unsigned int>, unsigned int, unsigned int, bool)>&; Args = {lbcrypto::CryptoContextImpl<lbcrypto::DCRTPolyImpl<bigintdyn::mubintvec<bigintdyn::ubint<long unsigned int> > > >*, std::vector<unsigned int, std::allocator<unsigned int> >, std::vector<unsigned int, std::allocator<unsigned int> >, unsigned int, unsigned int, bool}; std::enable_if_t<std::is_void<_Yp>::value, pybind11::detail::void_type> = pybind11::detail::void_type]’, declared using local type ‘pybind11::cpp_function::cpp_function(Return (Class::*)(Arg ...), const Extra& ...) [with Return = void; Class = lbcrypto::CryptoContextImpl<lbcrypto::DCRTPolyImpl<bigintdyn::mubintvec<bigintdyn::ubint<long unsigned int> > > >; Arg = {std::vector<unsigned int, std::allocator<unsigned int> >, std::vector<unsigned int, std::allocator<unsigned int> >, unsigned int, unsigned int, bool}; Extra = {pybind11::name, pybind11::is_method, pybind11::sibling, const char*, pybind11::arg_v, pybind11::arg_v, pybind11::arg_v, pybind11::arg_v}]::<lambda(lbcrypto::CryptoContextImpl<lbcrypto::DCRTPolyImpl<bigintdyn::mubintvec<bigintdyn::ubint<long unsigned int> > > >*, std::vector<unsigned int>, std::vector<unsigned int>, unsigned int, unsigned int, bool)>’, is used but never defined [-fpermissive]
 1453 |     enable_if_t<std::is_void<Return>::value, void_type> call(Func &&f) && {
      |                                                         ^~~~
make[2]: *** [CMakeFiles/openfhe.dir/build.make:63: CMakeFiles/openfhe.dir/src/lib/bindings.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:76: CMakeFiles/openfhe.dir/all] Error 2
make: *** [Makefile:130: all] Error 2

Additional information

Distributor ID:	Ubuntu
Description:	Ubuntu 20.04.6 LTS
Release:	20.04
Codename:	focal

how to seralize openfhe binfhecontext

from openfhe import *
import pickle5 as pickle

Sample Program: Step 1: Set CryptoContext

cc = BinFHEContext()
file_name = 'std1.pkl'

Writing the student object to a file using pickle

with open(file_name, 'wb') as file:
pickle.dump(cc, file,protocol=pickle.HIGHEST_PROTOCOL)
print(f'Object successfully saved to "{file_name}"')

Missing EvalAdd functionality

EvalAdd doesn't work with ciphertext and plaintext as input. This is something mapped out in the main library but not in Python version.

Serialization not working in macOS

While running openfhe-python/examples/pke/simple-integers-serial.py

RuntimeError: Trying to save an unregistered polymorphic type (lbcrypto::CryptoContextImpl<lbcrypto::DCRTPolyImpl<bigintdyn::mubintvec<bigintdyn::ubint>>>).
Make sure your type is registered with CEREAL_REGISTER_TYPE and that the archive you are using was included (and registered with CEREAL_REGISTER_ARCHIVE) prior to calling CEREAL_REGISTER_TYPE.
If your type is already registered and you still see this error, you may need to use CEREAL_REGISTER_DYNAMIC_INIT.

Environment: Prepared a Conda environment on Apple M2 Pro, and able to run other examples.

However, it worked for me, in Linux environment.

Pre-release changes

  1. Update README.md to better describe the installation process
  2. Move py. examples to the root, i.e.., use examples/pke and examples/binfhe.
  3. Make sure all py examples work
  4. Move include inside src. Use src/include for header files and src/lib for cpp files.

Suggestions on how to install using Conda

conda develop lib command doesn't work for me after struggling for a long time.
Bugs as follows:

Channels:

 - defaults
 - conda-forge
Platform: linux-64
Collecting package metadata (repodata.json): done
Solving environment: failed
PackagesNotFoundError: The following packages are not available from current channels:
  - lib
Current channels:
  - defaults
  - https://conda.anaconda.org/conda-forge/linux-64
  - https://conda.anaconda.org/conda-forge/noarch
To search for alternate channels that may provide the conda package you're
looking for, navigate to
    https://anaconda.org
and use the search bar at the top of the page.

Found out using pip install -e . helps!

Segmentation Fault on GenerateLUTViaFunction

When trying to run FuncViaSchemeSwitching function from scheme-swithing.py example, the code apparently runs fine, but it throws a segmentation fault at the end.
image

By debugging it, the cause of the problem is at the line:

lut = ccLWE.GenerateLUTviaFunction(fp, pLWE)

if i comment the rest of the code after it, segmentation fault still occurs. But if I comment also the above line, no error occurrs!

HEXL support: Conda Installation Failure at make

Hello,

I'm getting the error below when trying to build the python binding. I have OpenFHE installed with HEXL enabled. That works with the c++ examples, but I can't build the python binding. Based on the error, I'm not sure where to start. Any insights?

(openfhe) dangerginger@homecompute ~/code/openfhe-python/build$ make                                                                                    ✹main 
Consolidate compiler generated dependencies of target openfhe
[ 16%] Building CXX object CMakeFiles/openfhe.dir/src/lib/bindings.cpp.o
In file included from /home/dangerginger/code/openfhe-python/src/lib/bindings.cpp:1:
/home/dangerginger/code/miniconda3/envs/openfhe/include/pybind11/pybind11.h: In instantiation of ‘void pybind11::cpp_function::initialize(Func&&, Return (*)(Args ...), const Extra& ...) [with Func = pybind11::cpp_function::cpp_function<void, lbcrypto::CryptoContextImpl<lbcrypto::DCRTPolyImpl<bigintdyn::mubintvec<bigintdyn::ubint<long unsigned int> > > >, std::vector<unsigned int, std::allocator<unsigned int> >, std::vector<unsigned int, std::allocator<unsigned int> >, unsigned int, unsigned int, pybind11::name, pybind11::is_method, pybind11::sibling, const char*, pybind11::arg_v, pybind11::arg_v, pybind11::arg_v, pybind11::arg_v, pybind11::arg_v>(void (lbcrypto::CryptoContextImpl<lbcrypto::DCRTPolyImpl<bigintdyn::mubintvec<bigintdyn::ubint<long unsigned int> > > >::*)(std::vector<unsigned int>, std::vector<unsigned int>, unsigned int, unsigned int), const pybind11::name&, const pybind11::is_method&, const pybind11::sibling&, const char* const&, const pybind11::arg_v&, const pybind11::arg_v&, const pybind11::arg_v&, const pybind11::arg_v&, const pybind11::arg_v&)::<lambda(lbcrypto::CryptoContextImpl<lbcrypto::DCRTPolyImpl<bigintdyn::mubintvec<bigintdyn::ubint<long unsigned int> > > >*, std::vector<unsigned int>, std::vector<unsigned int>, unsigned int, unsigned int)>; Return = void; Args = {lbcrypto::CryptoContextImpl<lbcrypto::DCRTPolyImpl<bigintdyn::mubintvec<bigintdyn::ubint<long unsigned int> > > >*, std::vector<unsigned int, std::allocator<unsigned int> >, std::vector<unsigned int, std::allocator<unsigned int> >, unsigned int, unsigned int}; Extra = {pybind11::name, pybind11::is_method, pybind11::sibling, const char*, pybind11::arg_v, pybind11::arg_v, pybind11::arg_v, pybind11::arg_v, pybind11::arg_v}]’:
/home/dangerginger/code/miniconda3/envs/openfhe/include/pybind11/pybind11.h:110:19:   required from ‘pybind11::cpp_function::cpp_function(Return (Class::*)(Arg ...), const Extra& ...) [with Return = void; Class = lbcrypto::CryptoContextImpl<lbcrypto::DCRTPolyImpl<bigintdyn::mubintvec<bigintdyn::ubint<long unsigned int> > > >; Arg = {std::vector<unsigned int, std::allocator<unsigned int> >, std::vector<unsigned int, std::allocator<unsigned int> >, unsigned int, unsigned int}; Extra = {pybind11::name, pybind11::is_method, pybind11::sibling, const char*, pybind11::arg_v, pybind11::arg_v, pybind11::arg_v, pybind11::arg_v, pybind11::arg_v}]’
/home/dangerginger/code/miniconda3/envs/openfhe/include/pybind11/pybind11.h:1575:22:   required from ‘pybind11::class_<type_, options>& pybind11::class_<type_, options>::def(const char*, Func&&, const Extra& ...) [with Func = void (lbcrypto::CryptoContextImpl<lbcrypto::DCRTPolyImpl<bigintdyn::mubintvec<bigintdyn::ubint<long unsigned int> > > >::*)(std::vector<unsigned int>, std::vector<unsigned int>, unsigned int, unsigned int); Extra = {const char*, pybind11::arg_v, pybind11::arg_v, pybind11::arg_v, pybind11::arg_v, pybind11::arg_v}; type_ = lbcrypto::CryptoContextImpl<lbcrypto::DCRTPolyImpl<bigintdyn::mubintvec<bigintdyn::ubint<long unsigned int> > > >; options = {std::shared_ptr<lbcrypto::CryptoContextImpl<lbcrypto::DCRTPolyImpl<bigintdyn::mubintvec<bigintdyn::ubint<long unsigned int> > > > >}]’
/home/dangerginger/code/openfhe-python/src/lib/bindings.cpp:582:13:   required from here
/home/dangerginger/code/miniconda3/envs/openfhe/include/pybind11/pybind11.h:219:40: error: static assertion failed: The number of argument annotations does not match the number of function arguments
  219 |             expected_num_args<Extra...>(
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~^
  220 |                 sizeof...(Args), cast_in::args_pos >= 0, cast_in::has_kwargs),
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/dangerginger/code/miniconda3/envs/openfhe/include/pybind11/pybind11.h:219:40: note: ‘pybind11::detail::expected_num_args<pybind11::name, pybind11::is_method, pybind11::sibling, const char*, pybind11::arg_v, pybind11::arg_v, pybind11::arg_v, pybind11::arg_v, pybind11::arg_v>(5, (((int)pybind11::detail::argument_loader<lbcrypto::CryptoContextImpl<lbcrypto::DCRTPolyImpl<bigintdyn::mubintvec<bigintdyn::ubint<long unsigned int> > > >*, std::vector<unsigned int, std::allocator<unsigned int> >, std::vector<unsigned int, std::allocator<unsigned int> >, unsigned int, unsigned int>::args_pos) >= 0), ((int)((bool)pybind11::detail::argument_loader<lbcrypto::CryptoContextImpl<lbcrypto::DCRTPolyImpl<bigintdyn::mubintvec<bigintdyn::ubint<long unsigned int> > > >*, std::vector<unsigned int, std::allocator<unsigned int> >, std::vector<unsigned int, std::allocator<unsigned int> >, unsigned int, unsigned int>::has_kwargs)))’ evaluates to false
cc1plus: note: unrecognized command-line option ‘-Wno-unknown-warning-option’ may have been intended to silence earlier diagnostics
cc1plus: note: unrecognized command-line option ‘-Wno-unknown-warning’ may have been intended to silence earlier diagnostics
make[2]: *** [CMakeFiles/openfhe.dir/build.make:76: CMakeFiles/openfhe.dir/src/lib/bindings.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:83: CMakeFiles/openfhe.dir/all] Error 2
make: *** [Makefile:136: all] Error 2

Failed when building openfhe-python

I have got some errors when building openfhe-python.
My environments:

  • OS: Ubuntu 20.04
  • CMake 3.16.3
  • OpenFHE v1.0.4
  • pybind11 2.11.1

The error I got is shown as follow:

spinal@f4a34a602339:~/Software/openfhe-python/build$ make -j32
Scanning dependencies of target openfhe
[ 16%] Building CXX object CMakeFiles/openfhe.dir/src/lib/bindings.cpp.o
[ 33%] Building CXX object CMakeFiles/openfhe.dir/src/lib/binfhe_bindings.cpp.o
[ 50%] Building CXX object CMakeFiles/openfhe.dir/src/lib/binfhe/binfhecontext_wrapper.cpp.o
[ 66%] Building CXX object CMakeFiles/openfhe.dir/src/lib/pke/serialization.cpp.o
[ 83%] Building CXX object CMakeFiles/openfhe.dir/src/lib/pke/cryptocontext_wrapper.cpp.o
/home/spinal/Software/openfhe-python/src/lib/binfhe_bindings.cpp: In function ‘void bind_binfhe_enums(pybind11::module&)’:
/home/spinal/Software/openfhe-python/src/lib/binfhe_bindings.cpp:45:51: error: ‘STD128_LMKCDEY’ is not a member of ‘lbcrypto::BINFHE_PARAMSET’
   45 |         .value("STD128_LMKCDEY", BINFHE_PARAMSET::STD128_LMKCDEY)
      |                                                   ^~~~~~~~~~~~~~
/home/spinal/Software/openfhe-python/src/lib/binfhe_bindings.cpp:51:52: error: ‘STD128Q_LMKCDEY’ is not a member of ‘lbcrypto::BINFHE_PARAMSET’
   51 |         .value("STD128Q_LMKCDEY", BINFHE_PARAMSET::STD128Q_LMKCDEY)
      |                                                    ^~~~~~~~~~~~~~~
/home/spinal/Software/openfhe-python/src/lib/binfhe_bindings.cpp:54:45: error: ‘STD128_3’ is not a member of ‘lbcrypto::BINFHE_PARAMSET’
   54 |         .value("STD128_3", BINFHE_PARAMSET::STD128_3)
      |                                             ^~~~~~~~
/home/spinal/Software/openfhe-python/src/lib/binfhe_bindings.cpp:55:53: error: ‘STD128_3_LMKCDEY’ is not a member of ‘lbcrypto::BINFHE_PARAMSET’
   55 |         .value("STD128_3_LMKCDEY", BINFHE_PARAMSET::STD128_3_LMKCDEY)
      |                                                     ^~~~~~~~~~~~~~~~
/home/spinal/Software/openfhe-python/src/lib/binfhe_bindings.cpp:56:46: error: ‘STD128Q_3’ is not a member of ‘lbcrypto::BINFHE_PARAMSET’
   56 |         .value("STD128Q_3", BINFHE_PARAMSET::STD128Q_3)
      |                                              ^~~~~~~~~
/home/spinal/Software/openfhe-python/src/lib/binfhe_bindings.cpp:57:54: error: ‘STD128Q_3_LMKCDEY’ is not a member of ‘lbcrypto::BINFHE_PARAMSET’
   57 |         .value("STD128Q_3_LMKCDEY", BINFHE_PARAMSET::STD128Q_3_LMKCDEY)
      |                                                      ^~~~~~~~~~~~~~~~~
/home/spinal/Software/openfhe-python/src/lib/binfhe_bindings.cpp:58:46: error: ‘STD192Q_3’ is not a member of ‘lbcrypto::BINFHE_PARAMSET’
   58 |         .value("STD192Q_3", BINFHE_PARAMSET::STD192Q_3)
      |                                              ^~~~~~~~~
/home/spinal/Software/openfhe-python/src/lib/binfhe_bindings.cpp:59:46: error: ‘STD256Q_3’ is not a member of ‘lbcrypto::BINFHE_PARAMSET’
   59 |         .value("STD256Q_3", BINFHE_PARAMSET::STD256Q_3)
      |                                              ^~~~~~~~~
/home/spinal/Software/openfhe-python/src/lib/binfhe_bindings.cpp:60:45: error: ‘STD128_4’ is not a member of ‘lbcrypto::BINFHE_PARAMSET’
   60 |         .value("STD128_4", BINFHE_PARAMSET::STD128_4)
      |                                             ^~~~~~~~
/home/spinal/Software/openfhe-python/src/lib/binfhe_bindings.cpp:61:53: error: ‘STD128_4_LMKCDEY’ is not a member of ‘lbcrypto::BINFHE_PARAMSET’
   61 |         .value("STD128_4_LMKCDEY", BINFHE_PARAMSET::STD128_4_LMKCDEY)
      |                                                     ^~~~~~~~~~~~~~~~
/home/spinal/Software/openfhe-python/src/lib/binfhe_bindings.cpp:62:46: error: ‘STD128Q_4’ is not a member of ‘lbcrypto::BINFHE_PARAMSET’
   62 |         .value("STD128Q_4", BINFHE_PARAMSET::STD128Q_4)
      |                                              ^~~~~~~~~
/home/spinal/Software/openfhe-python/src/lib/binfhe_bindings.cpp:63:54: error: ‘STD128Q_4_LMKCDEY’ is not a member of ‘lbcrypto::BINFHE_PARAMSET’
   63 |         .value("STD128Q_4_LMKCDEY", BINFHE_PARAMSET::STD128Q_4_LMKCDEY)
      |                                                      ^~~~~~~~~~~~~~~~~
/home/spinal/Software/openfhe-python/src/lib/binfhe_bindings.cpp:64:46: error: ‘STD192Q_4’ is not a member of ‘lbcrypto::BINFHE_PARAMSET’
   64 |         .value("STD192Q_4", BINFHE_PARAMSET::STD192Q_4)
      |                                              ^~~~~~~~~
/home/spinal/Software/openfhe-python/src/lib/binfhe_bindings.cpp:65:46: error: ‘STD256Q_4’ is not a member of ‘lbcrypto::BINFHE_PARAMSET’
   65 |         .value("STD256Q_4", BINFHE_PARAMSET::STD256Q_4)
      |                                              ^~~~~~~~~
/home/spinal/Software/openfhe-python/src/lib/binfhe_bindings.cpp:69:58: error: ‘STD128_LMKCDEY’ is not a member of ‘lbcrypto::BINFHE_PARAMSET’
   69 |     m.attr("STD128_LMKCDEY") = py::cast(BINFHE_PARAMSET::STD128_LMKCDEY);
      |                                                          ^~~~~~~~~~~~~~
/home/spinal/Software/openfhe-python/src/lib/binfhe_bindings.cpp:75:59: error: ‘STD128Q_LMKCDEY’ is not a member of ‘lbcrypto::BINFHE_PARAMSET’
   75 |     m.attr("STD128Q_LMKCDEY") = py::cast(BINFHE_PARAMSET::STD128Q_LMKCDEY);
      |                                                           ^~~~~~~~~~~~~~~
/home/spinal/Software/openfhe-python/src/lib/binfhe_bindings.cpp:78:52: error: ‘STD128_3’ is not a member of ‘lbcrypto::BINFHE_PARAMSET’
   78 |     m.attr("STD128_3") = py::cast(BINFHE_PARAMSET::STD128_3);
      |                                                    ^~~~~~~~
/home/spinal/Software/openfhe-python/src/lib/binfhe_bindings.cpp:79:60: error: ‘STD128_3_LMKCDEY’ is not a member of ‘lbcrypto::BINFHE_PARAMSET’
   79 |     m.attr("STD128_3_LMKCDEY") = py::cast(BINFHE_PARAMSET::STD128_3_LMKCDEY);
      |                                                            ^~~~~~~~~~~~~~~~
/home/spinal/Software/openfhe-python/src/lib/binfhe_bindings.cpp:80:53: error: ‘STD128Q_3’ is not a member of ‘lbcrypto::BINFHE_PARAMSET’
   80 |     m.attr("STD128Q_3") = py::cast(BINFHE_PARAMSET::STD128Q_3);
      |                                                     ^~~~~~~~~
/home/spinal/Software/openfhe-python/src/lib/binfhe_bindings.cpp:81:61: error: ‘STD128Q_3_LMKCDEY’ is not a member of ‘lbcrypto::BINFHE_PARAMSET’
   81 |     m.attr("STD128Q_3_LMKCDEY") = py::cast(BINFHE_PARAMSET::STD128Q_3_LMKCDEY);
      |                                                             ^~~~~~~~~~~~~~~~~
/home/spinal/Software/openfhe-python/src/lib/binfhe_bindings.cpp:82:53: error: ‘STD192Q_3’ is not a member of ‘lbcrypto::BINFHE_PARAMSET’
   82 |     m.attr("STD192Q_3") = py::cast(BINFHE_PARAMSET::STD192Q_3);
      |                                                     ^~~~~~~~~
/home/spinal/Software/openfhe-python/src/lib/binfhe_bindings.cpp:83:53: error: ‘STD256Q_3’ is not a member of ‘lbcrypto::BINFHE_PARAMSET’
   83 |     m.attr("STD256Q_3") = py::cast(BINFHE_PARAMSET::STD256Q_3);
      |                                                     ^~~~~~~~~
/home/spinal/Software/openfhe-python/src/lib/binfhe_bindings.cpp:84:52: error: ‘STD128_4’ is not a member of ‘lbcrypto::BINFHE_PARAMSET’
   84 |     m.attr("STD128_4") = py::cast(BINFHE_PARAMSET::STD128_4);
      |                                                    ^~~~~~~~
/home/spinal/Software/openfhe-python/src/lib/binfhe_bindings.cpp:85:60: error: ‘STD128_4_LMKCDEY’ is not a member of ‘lbcrypto::BINFHE_PARAMSET’
   85 |     m.attr("STD128_4_LMKCDEY") = py::cast(BINFHE_PARAMSET::STD128_4_LMKCDEY);
      |                                                            ^~~~~~~~~~~~~~~~
/home/spinal/Software/openfhe-python/src/lib/binfhe_bindings.cpp:86:53: error: ‘STD128Q_4’ is not a member of ‘lbcrypto::BINFHE_PARAMSET’
   86 |     m.attr("STD128Q_4") = py::cast(BINFHE_PARAMSET::STD128Q_4);
      |                                                     ^~~~~~~~~
/home/spinal/Software/openfhe-python/src/lib/binfhe_bindings.cpp:87:61: error: ‘STD128Q_4_LMKCDEY’ is not a member of ‘lbcrypto::BINFHE_PARAMSET’
   87 |     m.attr("STD128Q_4_LMKCDEY") = py::cast(BINFHE_PARAMSET::STD128Q_4_LMKCDEY);
      |                                                             ^~~~~~~~~~~~~~~~~
/home/spinal/Software/openfhe-python/src/lib/binfhe_bindings.cpp:88:53: error: ‘STD192Q_4’ is not a member of ‘lbcrypto::BINFHE_PARAMSET’
   88 |     m.attr("STD192Q_4") = py::cast(BINFHE_PARAMSET::STD192Q_4);
      |                                                     ^~~~~~~~~
/home/spinal/Software/openfhe-python/src/lib/binfhe_bindings.cpp:89:53: error: ‘STD256Q_4’ is not a member of ‘lbcrypto::BINFHE_PARAMSET’
   89 |     m.attr("STD256Q_4") = py::cast(BINFHE_PARAMSET::STD256Q_4);
      |                                                     ^~~~~~~~~
/home/spinal/Software/openfhe-python/src/lib/binfhe_bindings.cpp:100:15: error: ‘KEYGEN_MODE’ was not declared in this scope
  100 |     py::enum_<KEYGEN_MODE>(m, "KEYGEN_MODE")
      |               ^~~~~~~~~~~
/home/spinal/Software/openfhe-python/src/lib/binfhe_bindings.cpp:100:26: error: template argument 1 is invalid
  100 |     py::enum_<KEYGEN_MODE>(m, "KEYGEN_MODE")
      |                          ^
/home/spinal/Software/openfhe-python/src/lib/binfhe_bindings.cpp:101:31: error: ‘KEYGEN_MODE’ is not a class, namespace, or enumeration
  101 |         .value("SYM_ENCRYPT", KEYGEN_MODE::SYM_ENCRYPT)
      |                               ^~~~~~~~~~~
/home/spinal/Software/openfhe-python/src/lib/binfhe_bindings.cpp:102:31: error: ‘KEYGEN_MODE’ is not a class, namespace, or enumeration
  102 |         .value("PUB_ENCRYPT", KEYGEN_MODE::PUB_ENCRYPT);
      |                               ^~~~~~~~~~~
/home/spinal/Software/openfhe-python/src/lib/binfhe_bindings.cpp:103:38: error: ‘KEYGEN_MODE’ is not a class, namespace, or enumeration
  103 |     m.attr("SYM_ENCRYPT") = py::cast(KEYGEN_MODE::SYM_ENCRYPT);
      |                                      ^~~~~~~~~~~
/home/spinal/Software/openfhe-python/src/lib/binfhe_bindings.cpp:104:38: error: ‘KEYGEN_MODE’ is not a class, namespace, or enumeration
  104 |     m.attr("PUB_ENCRYPT") = py::cast(KEYGEN_MODE::PUB_ENCRYPT);
      |                                      ^~~~~~~~~~~
/home/spinal/Software/openfhe-python/src/lib/binfhe_bindings.cpp: In function ‘void bind_binfhe_context(pybind11::module&)’:
/home/spinal/Software/openfhe-python/src/lib/binfhe_bindings.cpp:164:38: error: ‘SYM_ENCRYPT’ was not declared in this scope
  164 |              py::arg("keygenMode") = SYM_ENCRYPT)
      |                                      ^~~~~~~~~~~
/home/spinal/Software/openfhe-python/src/lib/binfhe_bindings.cpp:178:141: error: invalid static_cast from type ‘lbcrypto::LWECiphertext (lbcrypto::BinFHEContext::*)(lbcrypto::BINGATE, ConstLWECiphertext, ConstLWECiphertext) const’ {aka ‘std::shared_ptr<lbcrypto::LWECiphertextImpl> (lbcrypto::BinFHEContext::*)(lbcrypto::BINGATE, std::shared_ptr<const lbcrypto::LWECiphertextImpl>, std::shared_ptr<const lbcrypto::LWECiphertextImpl>) const’} to type ‘lbcrypto::LWECiphertext (lbcrypto::BinFHEContext::*)(lbcrypto::BINGATE, lbcrypto::ConstLWECiphertext&, lbcrypto::ConstLWECiphertext&) const’ {aka ‘std::shared_ptr<lbcrypto::LWECiphertextImpl> (lbcrypto::BinFHEContext::*)(lbcrypto::BINGATE, const std::shared_ptr<const lbcrypto::LWECiphertextImpl>&, const std::shared_ptr<const lbcrypto::LWECiphertextImpl>&) const’}
  178 |         static_cast<LWECiphertext (BinFHEContext::*)(BINGATE, ConstLWECiphertext &, ConstLWECiphertext &) const>(&BinFHEContext::EvalBinGate),
      |                                                                                                                                             ^
make[2]: *** [CMakeFiles/openfhe.dir/build.make:76: CMakeFiles/openfhe.dir/src/lib/binfhe_bindings.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [CMakeFiles/Makefile2:76: CMakeFiles/openfhe.dir/all] Error 2
make: *** [Makefile:130: all] Error 2

'openfhe.h' file not found by building make

Hallo
i use wsl Ubuntu 22.04
i build openfhe-development and want to build make python wrapper
my structure is:
/home/andre/openfhe-development
/home/andre/openfhe-python

i do these steps by installing:
cmake .. -Dpybind11_DIR=/home/andre/.local/lib/python3.10/site-packages/pybind11/share/cmake/pybind11
mkdir build
cd build
cmake .. -DOpenFHE_DIR=/home/andre/openfhe-development
make

but i get Error:

/home/evgen/openfhe-python/src/lib/bindings.cpp:10:10: fatal error: 'openfhe.h' file not found
#include "openfhe.h"
^~~~~~~~~~~
1 error generated.
make[2]: *** [CMakeFiles/openfhe.dir/build.make:76: CMakeFiles/openfhe.dir/src/lib/bindings.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:83: CMakeFiles/openfhe.dir/all] Error 2
make: *** [Makefile:136: all] Error 2

What can i do?

Fatal Error

Please guide me to solve this problem. I have followed all the steps to install it but getting this error.
fatal error: openfhe.h: No such file or directory
10 | #include "openfhe.h"
| ^~~~~~~~~~~
compilation terminated.
make[2]: *** [CMakeFiles/openfhe.dir/build.make:63: CMakeFiles/openfhe.dir/src/lib/bindings.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:76: CMakeFiles/openfhe.dir/all] Error 2
make: *** [Makefile:130: all] Error 2

EvalKey serialization and deserialization

Our federated machine learning project involves Proxy Re-Encryption. In order to support multiple data owners and proxies, we need a way to serialize the EvalKeys, so that they can be stored and accessed by the parties involved. We also need a way to deserialize the EvalKeys from files and load them into memory, so that they can be used for re-encryption.

Install issue on Linux Ubuntu

Hi all! These are the exact commands I'm running:

Installation

Installing Openfhe-dev

git clone [email protected]:openfheorg/openfhe-development.git
cd openfhe-development
mkdir build
cd build
make -j N  # number of processors - 26 in my case
sudo make install

I then verify that it is installed by running

cd bin/examples/pke
./simple-real-numbers

Installing OpenFHE-python (within a conda env)

git clone [email protected]:openfheorg/openfhe-python.git
cd openfhe-python
mkdir build
cd build
cmake .. -DPYTHON_EXECUTABLE_PATH=$CONDA_PREFIX/bin/python
make -j 26
sudo make install

then, within build, I run

mkdir lib
mv *.so lib
conda develop lib

I have verified that Openfhe-python's SO files have been "linked"

import sys
for p in sys.path:
    print(p)

which outputs

/home/iq/anaconda3/lib/python311.zip
/home/iq/anaconda3/lib/python3.11
/home/iq/anaconda3/lib/python3.11/lib-dynload
/home/iq/anaconda3/lib/python3.11/site-packages
/home/iq/openfhe-python/build/lib

The issue

When I run something like python function-evaluation.py I see

File "/home/iq/openfhe-python/examples/pke/function-evaluation.py", line 1, in <module>
    from openfhe import *
ImportError: libOPENFHEpke.so.1: cannot open shared object file: No such file or directory

It's not clear to me what the issue is and if it is an issue on the OpenFHE-dev end. I don't think it is, just because I managed to run an example specifically a PKE example


Additional Information

Distributor ID: Ubuntu
Description:    Ubuntu 22.04.3 LTS
Release:        22.04
Codename:       jammy

Python cannot find .so after using pip install

To recreate this problem:

  1. Checkout openfhe-python source code and its dependencies.
  2. Make a new virtual environment in another directory.
  3. pip install directory-of/openfhe-python
  4. python -c "import('openfhe')"

Cause of the problem:

The openfhe-python library uses an init.py file that has a local import statement. When you run that local import from a different location on disk, it looks in a place relative to that different location, so it doesn't find the .so.

The relative import that is currently there:

from .openfhe import *

Suggested fix:

Use an absolute import statement, so that it is relative to the base of the library, not the current directory.

from openfhe.openfhe import *

Pycharm IDE autocompletion

I tried installing openfhe-python both on system-level linux and in Conda environment, then setting the pycharm workspace with that interpreter. The files run without errors, however pycharm doesn't recognize the library, hence autocompletion doesn't work properly.
image

openfhe-python in colab

@reneroliveira There is only Linux install in the repo. Can’t we use openfhe-python wrapper on windows?What should I do to use openfhe-python as windows user?

cmake issue

Hi,
Following:
image

I have below error, any ideas?

vboxuser@ubuntu18:~/openfhe-python/build$ cmake ..
-- The C compiler identification is Clang 11.1.0
-- The CXX compiler identification is Clang 11.1.0
-- Check for working C compiler: /usr/bin/clang-11
-- Check for working C compiler: /usr/bin/clang-11 -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/clang++-11
-- Check for working CXX compiler: /usr/bin/clang++-11 -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found PythonInterp: /usr/bin/python3.6 (found suitable version "3.6.9", minimum required is "3.6")
-- Found PythonLibs: /usr/lib/x86_64-linux-gnu/libpython3.6m.so
-- Performing Test HAS_FLTO
-- Performing Test HAS_FLTO - Success
-- Performing Test HAS_FLTO_THIN
-- Performing Test HAS_FLTO_THIN - Success
-- Found pybind11: /home/vboxuser/.local/include (found version "2.11.1")
CMake Error at CMakeLists.txt:57 (find_package):
By not providing "FindPython.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "Python", but
CMake did not find one.

Could not find a package configuration file provided by "Python" with any
of the following names:

PythonConfig.cmake
python-config.cmake

Add the installation prefix of "Python" to CMAKE_PREFIX_PATH or set
"Python_DIR" to a directory containing one of the above files. If "Python"
provides a separate development package or SDK, be sure it has been
installed.

-- Configuring incomplete, errors occurred!
See also "/home/vboxuser/openfhe-python/build/CMakeFiles/CMakeOutput.log".

BR

windows issue

Hi,

Can openfhe and openfhe-python be installed on windows like Win10?

BR

cmake error by CMakeList.txt

When I try to cmake the project, I met these problem,how can I solve it?
I use conda envs, and I have installed the pybind-global.

CMake Warning at CMakeLists.txt:14 (find_package):
  By not providing "FindOpenFHE.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "OpenFHE", but
  CMake did not find one.

  Could not find a package configuration file provided by "OpenFHE" with any
  of the following names:

    OpenFHEConfig.cmake
    openfhe-config.cmake

  Add the installation prefix of "OpenFHE" to CMAKE_PREFIX_PATH or set
  "OpenFHE_DIR" to a directory containing one of the above files.  If
  "OpenFHE" provides a separate development package or SDK, be sure it has
  been installed.


-- Found pybind11: /home/zhouchengxin/anaconda3/envs/openFHE/include (found version "2.11.1")
CMake Error at CMakeLists.txt:65 (find_package):
  By not providing "FindPython.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "Python", but
  CMake did not find one.

  Could not find a package configuration file provided by "Python" with any
  of the following names:

    PythonConfig.cmake
    python-config.cmake

  Add the installation prefix of "Python" to CMAKE_PREFIX_PATH or set
  "Python_DIR" to a directory containing one of the above files.  If "Python"
  provides a separate development package or SDK, be sure it has been
  installed.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.