Skip to content

Wrongful Assertion: CKKS scheme requires a list of prime sizes (qi_sizes) or primes (qi) to be set #268

@acklay4

Description

@acklay4

Trying to pickle.loads(my_pickled_ctxt_list) produces the error:

AssertionError: CKKS scheme requires a list of prime sizes (qi_sizes) or primes (qi) to be set

When checking beforehand, what the properties of my Pyfhel object are, it produces this:

<ckks Pyfhel obj at 0x7efcf24ff640, [pk:Y, sk:-, rtk:-, rlk:-, contx(n=32768, t=0, sec=128, qi=[60, 30, 30, 30, 30, 30, 30, 30, 60], scale=1073741824.0, )]>

which in itself seems to have qi_sizes defined.

The list gets loaded by:

z_list = pickle.loads(request.files['z_list'].read())

Error Message

[python-client-server]    | <ckks Pyfhel obj at 0x7efcf24ff640, [pk:Y, sk:-, rtk:-, rlk:-, contx(n=32768, t=0, sec=128, qi=[60, 30, 30, 30, 30, 30, 30, 30, 60], scale=1073741824.0, )]>
[python-client-server]    | [60, 30, 30, 30, 30, 30, 30, 30, 60]
[python-client-server]    | 127.0.0.1 - - [17/Sep/2025 14:23:10] "POST /zlist-vector HTTP/1.1" 500 -
[python-client-server]    | Traceback (most recent call last):
[python-client-server]    |   File "/ma/lib/python3.13/site-packages/flask/app.py", line 1536, in __call__
[python-client-server]    |     return self.wsgi_app(environ, start_response)
[python-client-server]    |            ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
[python-client-server]    |   File "/ma/lib/python3.13/site-packages/flask/app.py", line 1514, in wsgi_app
[python-client-server]    |     response = self.handle_exception(e)
[python-client-server]    |   File "/ma/lib/python3.13/site-packages/flask/app.py", line 1511, in wsgi_app
[python-client-server]    |     response = self.full_dispatch_request()
[python-client-server]    |   File "/ma/lib/python3.13/site-packages/flask/app.py", line 919, in full_dispatch_request
[python-client-server]    |     rv = self.handle_user_exception(e)
[python-client-server]    |   File "/ma/lib/python3.13/site-packages/flask/app.py", line 917, in full_dispatch_request
[python-client-server]    |     rv = self.dispatch_request()
[python-client-server]    |   File "/ma/lib/python3.13/site-packages/flask/app.py", line 902, in dispatch_request
[python-client-server]    |     return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)  # type: ignore[no-any-return]
[python-client-server]    |            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
[python-client-server]    |   File "/ma/server_cleantext/app.py", line 619, in zlist_api_vector
[python-client-server]    |     z_list = pickle.loads(request.files['z_list'].read())
[python-client-server]    |   File "Pyfhel/Pyfhel.pyx", line 89, in Pyfhel.Pyfhel.Pyfhel.__init__
[python-client-server]    |   File "Pyfhel/Pyfhel.pyx", line 194, in Pyfhel.Pyfhel.Pyfhel.contextGen
[python-client-server]    |   File "Pyfhel/Pyfhel.pyx", line 275, in Pyfhel.Pyfhel.Pyfhel.contextGen
[python-client-server]    | AssertionError: CKKS scheme requires a list of prime sizes (qi_sizes) or primes (qi) to be set

Expected behavior
The ability to load the list properly or, in case that's the wrong approach, to throw an error which is somewhat useful.

Setup:

  • OS: Debian Trixie
  • Python: 3.13
  • Pyfhel Version: 3.5

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions