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

Failed to import snsql #608

Open
WCY-dt opened this issue Oct 25, 2024 · 2 comments · May be fixed by #609
Open

Failed to import snsql #608

WCY-dt opened this issue Oct 25, 2024 · 2 comments · May be fixed by #609

Comments

@WCY-dt
Copy link

WCY-dt commented Oct 25, 2024

I followed the instruction to use pip to install the package. But I failed to import the package:

>>> import snsql
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "E:\Python312\Lib\site-packages\snsql\__init__.py", line 1, in <module>
    from .connect import from_connection, from_df
  File "E:\Python312\Lib\site-packages\snsql\connect.py", line 1, in <module>
    from .sql.private_reader import PrivateReader
  File "E:\Python312\Lib\site-packages\snsql\sql\__init__.py", line 1, in <module>
    from .private_reader import PrivateReader
  File "E:\Python312\Lib\site-packages\snsql\sql\private_reader.py", line 6, in <module>
    from snsql.sql.odometer import OdometerHeterogeneous
  File "E:\Python312\Lib\site-packages\snsql\sql\odometer.py", line 2, in <module>
    from snsql.sql.privacy import Privacy
  File "E:\Python312\Lib\site-packages\snsql\sql\privacy.py", line 2, in <module>
    from ._mechanisms import *
  File "E:\Python312\Lib\site-packages\snsql\sql\_mechanisms\__init__.py", line 1, in <module>
    from .laplace import Laplace
  File "E:\Python312\Lib\site-packages\snsql\sql\_mechanisms\laplace.py", line 3, in <module>
    from opendp.transformations import make_sum, make_clamp
  File "E:\Python312\Lib\site-packages\opendp\__init__.py", line 1, in <module>
    from opendp.mod import Transformation, Measurement, OpenDPException, UnknownTypeException
  File "E:\Python312\Lib\site-packages\opendp\mod.py", line 13, in <module>
    from opendp._lib import AnyMeasurement, AnyTransformation, AnyDomain, AnyMetric, AnyMeasure, AnyFunction
  File "E:\Python312\Lib\site-packages\opendp\_lib.py", line 46, in <module>
    lib, lib_path = _load_library()
                    ^^^^^^^^^^^^^^^
  File "E:\Python312\Lib\site-packages\opendp\_lib.py", line 31, in _load_library
    raise Exception(f"Expected exactly one binary to be present. Got: {lib_dir_file_names}")
Exception: Expected exactly one binary to be present. Got: []

I have tried in both Python3.12 and Python3.9, but none of them succeed.

@WCY-dt
Copy link
Author

WCY-dt commented Oct 25, 2024

After I updated OpenDP to v0.11.1, the problem is solved.

@MinzhiYoyo
Copy link

I choose another way to solve this problem.
Change PYTHON_HOME/Lib/site-packages/opendp/_lib.py line 29 to lib_dir_file_names = [p for p in lib_dir.iterdir() if p.suffix in {".so", ".dylib", ".dll", ".pyd"}].
Because there may be a bug in this version of OpenDP.
I can find .so, .dylib, .dll in PYTHON_HOME\Lib\site-packages\opendp\lib, just find a .pyd.

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

Successfully merging a pull request may close this issue.

2 participants