{"id":10011,"library":"openmined-psi","title":"OpenMined Private Set Intersection (PSI)","description":"OpenMined PSI (Private Set Intersection) is a cryptographic library that allows two parties to compute the intersection of their private datasets without revealing non-intersecting elements. It focuses on securely computing the *size* of the intersection. The library is currently at version 2.0.6 and is actively maintained with frequent minor updates for dependency bumps and Python version support.","status":"active","version":"2.0.6","language":"en","source_language":"en","source_url":"https://github.com/OpenMined/PSI","tags":["privacy","cryptography","private set intersection","psi","homomorphic encryption"],"install":[{"cmd":"pip install openmined-psi","lang":"bash","label":"Install stable version"}],"dependencies":[{"reason":"Requires Python 3.9 or higher for compatibility.","package":"python","optional":false}],"imports":[{"note":"The package was renamed from 'psi' to 'openmined_psi' in v2.0.3.","wrong":"from psi import client","symbol":"client","correct":"from openmined_psi import client"},{"note":"The package was renamed from 'psi' to 'openmined_psi' in v2.0.3.","wrong":"from psi import server","symbol":"server","correct":"from openmined_psi import server"}],"quickstart":{"code":"from openmined_psi import client, server\n\n# Setup common inputs\nclient_inputs = [\"client@example.com\", \"client2@example.com\", \"test@example.com\"]\nserver_inputs = [\"client@example.com\", \"server@example.com\", \"test@example.com\"]\n\n# --- Server side ---\n# Create a server instance (e.g., with a new key)\nserver_psi = server.CreateWithNewKey(False) # 'False' means not to reveal the server's key\n\n# Create a setup message. The first parameter is the FPR (False Positive Rate),\n# the second is the number of elements in the server's set.\nsetup_message = server_psi.CreateSetupMessage(0.001, len(server_inputs), server_inputs)\n\n# --- Client side ---\n# Create a client instance\nclient_psi = client.CreateWithNewKey(False) # 'False' means not to reveal the client's key\n\n# Create a request message from the client's inputs\nrequest = client_psi.CreateRequest(client_inputs)\n\n# --- Server side (handling request) ---\n# Server handles the client's request\nresponse = server_psi.HandleRequest(request)\n\n# --- Client side (getting intersection size) ---\n# Client processes the server's response to get the intersection size.\n# Note: openmined-psi only provides the intersection *size* for privacy reasons,\n# not the actual elements themselves.\nintersection_size = client_psi.GetIntersectionSize(response)\n\nprint(f\"Intersection size: {intersection_size}\") # Expected: 2 (client@example.com, test@example.com)","lang":"python","description":"This example demonstrates how two parties (client and server) can compute the size of their set intersection using `openmined-psi` without revealing their full sets. The output will be the size of the intersection."},"warnings":[{"fix":"Update all import statements from `import psi` or `from psi import ...` to `import openmined_psi` or `from openmined_psi import ...`.","message":"The Python package was renamed from `psi` to `openmined_psi` in version 2.0.3. Older import statements will fail.","severity":"breaking","affected_versions":"<2.0.3"},{"fix":"Understand that the library's privacy model is based on revealing only the intersection size. If you need the actual elements, `openmined-psi` is not the right tool for your use case.","message":"The `openmined-psi` library is designed for privacy-preserving computation and will only return the *size* of the intersection, not the intersecting elements themselves. Attempting to retrieve the actual elements will result in an error or unexpected behavior.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Ensure your Python environment is 3.9 or newer. Consider using a virtual environment to manage Python versions (`python3.9 -m venv .venv`).","message":"The library requires Python 3.9 or higher. Installing or running `openmined-psi` on older Python versions (e.g., 3.8) will lead to installation failures or runtime errors.","severity":"gotcha","affected_versions":"<2.0.0 (and versions before specific 3.11/3.12/3.13 support patches)"}],"env_vars":null,"last_verified":"2026-04-17T00:00:00.000Z","next_check":"2026-07-16T00:00:00.000Z","problems":[{"fix":"Change your import statements from `import psi` or `from psi import ...` to `import openmined_psi` or `from openmined_psi import ...`.","cause":"The Python package name was changed from `psi` to `openmined_psi` in version 2.0.3.","error":"ModuleNotFoundError: No module named 'psi'"},{"fix":"Use `client_psi.GetIntersectionSize(response)` to obtain the size of the intersection. If you require the actual elements, this library is not suitable.","cause":"The `openmined-psi` library only provides the `GetIntersectionSize` method for privacy reasons, not methods to retrieve the actual intersecting elements.","error":"AttributeError: module 'openmined_psi.client' has no attribute 'GetIntersection'"}]}