Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pytest issues with get_native_int #177

Open
anithag opened this issue Oct 7, 2024 · 2 comments
Open

pytest issues with get_native_int #177

anithag opened this issue Oct 7, 2024 · 2 comments

Comments

@anithag
Copy link

anithag commented Oct 7, 2024

After installing openfhe-python, I am trying to run pytest in the project root directory. I get the following errors. It must be something simple. Can you help fix? I am using Mac OSX Sonoma (Apple M2).

============================================================= ERRORS =============================================================
_______________________________________________ ERROR collecting tests/test_bgv.py _______________________________________________
tests/test_bgv.py:7: in <module>
    pytestmark = pytest.mark.skipif(fhe.get_native_int() == 32, reason="Doesn't work for NATIVE_INT=32")
E   AttributeError: module 'openfhe' has no attribute 'get_native_int'
______________________________________________ ERROR collecting tests/test_ckks.py _______________________________________________
tests/test_ckks.py:6: in <module>
    pytestmark = pytest.mark.skipif(fhe.get_native_int() == 32, reason="Doesn't work for NATIVE_INT=32")
E   AttributeError: module 'openfhe' has no attribute 'get_native_int'
__________________________________________ ERROR collecting tests/test_cryptocontext.py __________________________________________
tests/test_cryptocontext.py:4: in <module>
    pytestmark = pytest.mark.skipif(fhe.get_native_int() != 128, reason="Only for NATIVE_INT=128")
E   AttributeError: module 'openfhe' has no attribute 'get_native_int'
____________________________________________ ERROR collecting tests/test_examples.py _____________________________________________
tests/test_examples.py:10: in <module>
    pytestmark = pytest.mark.skipif(fhe.get_native_int() == 32, reason="Doesn't work for NATIVE_INT=32")
E   AttributeError: module 'openfhe' has no attribute 'get_native_int'
____________________________________________ ERROR collecting tests/test_serial_cc.py ____________________________________________
tests/test_serial_cc.py:6: in <module>
    pytestmark = pytest.mark.skipif(fhe.get_native_int() == 32, reason="Doesn't work for NATIVE_INT=32")
E   AttributeError: module 'openfhe' has no attribute 'get_native_int'
==================================================== short test summary info =====================================================
ERROR tests/test_bgv.py - AttributeError: module 'openfhe' has no attribute 'get_native_int'
ERROR tests/test_ckks.py - AttributeError: module 'openfhe' has no attribute 'get_native_int'
ERROR tests/test_cryptocontext.py - AttributeError: module 'openfhe' has no attribute 'get_native_int'
ERROR tests/test_examples.py - AttributeError: module 'openfhe' has no attribute 'get_native_int'
ERROR tests/test_serial_cc.py - AttributeError: module 'openfhe' has no attribute 'get_native_int'
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 5 errors during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

@anithag
Copy link
Author

anithag commented Oct 7, 2024

I want to provide a bit more info to see if this is an installation issue. openfhe is installed in my home directory. After build and install of openfhe-python, I have set PYTHONPATH and LD_LIBRARY_PATH to include openfhe dynamically shared libraries. So far it seemed reasonable without any issues.

Later, when I run pytest, I got the error:

Traceback:
/opt/homebrew/Cellar/[email protected]/3.11.7_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/importlib/__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
tests/test_serial_cc.py:4: in <module>
    import openfhe as fhe
openfhe/__init__.py:1: in <module>
    from openfhe.openfhe import *
E   ModuleNotFoundError: No module named 'openfhe.openfhe'

What should my PYTHONPATH include at this point? Note that if it includes only $HOME//Users/anitha_gollamudi/openfhe-development/install/lib I get No module named openfhe.openfhe error.

@anithag
Copy link
Author

anithag commented Oct 7, 2024

setting export PYTHONPATH=openfhe-python/build:$PYTHONPATH solved the issue. This is not mentioned in the documentation; only OpenFHE libraries were mentioned, and I assumed that they referred to libraries from openfhe-development.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant