tenseal
A Library for Homomorphic Encryption Operations on Tensors
Decision gist · record as of 2026-08-14
Yes, if you need to perform computations on encrypted tensors for privacy-preserving machine learning. The library is actively maintained, has no known vulnerabilities, and provides prebuilt wheels for common platforms. Install friction is moderate due to C++ compilation requirements, but wheels eliminate build overhead for standard Python versions (3.11–3.14). The Apache-2.0 license is permissive. Not worth installing if you do not require homomorphic encryption or if your platform is not covered by prebuilt distributions.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python ≥3.11.
- Building from source requires a C++ compiler (GNU G++ ≥6.0, Clang++ ≥5.0, or MSVC ≥2010 SP1), CMake ≥3.14, and Protocol Buffers compiler.
- Prebuilt wheels are available for Python 3.11–3.14 on macOS ARM64, Linux manylinux, and Windows x64.
License · maintenance · safety
Apache-2.0 (permissive) — Licensed under Apache-2.0 (permissive). You may use, modify, and distribute TenSEAL and derivative works freely, provided you include a copy of the license and state significant changes. No patent grant is provided.
last release 2026-08-04 (10 days) · last repo commit 2026-08-04 · 1,033 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 81,846 downloads/mo, #14,196 on PyPI
Alternatives
Verify before relying
pip install tenseal
import tenseal as ts
import numpy as np
context = ts.context(ts.SCHEME_TYPE.CKKS, poly_modulus_degree=8192, coeff_mod_bit_sizes=[60, 40, 40, 60])
context.generate_galois_keys()
context.global_scale = 2**40
v1 = [0, 1, 2, 3, 4]
enc_v1 = ts.ckks_vector(context, v1)
enc_v2 = ts.ckks_vector(context, [4, 3, 2, 1, 0])
result = enc_v1 + enc_v2
print(result.decrypt()) # ~ [4, 4, 4, 4, 4]- Whether prebuilt wheels cover all target platforms and architectures for your deployment environment.
- Performance characteristics and throughput for large-scale tensor operations compared to unencrypted alternatives.
- Compatibility with specific versions of numpy beyond the runtime dependency declaration.
What it is and what it does
TenSEAL is a Python library that wraps Microsoft SEAL to perform arithmetic operations directly on homomorphically encrypted tensors. It supports two encryption schemes: BFV for integer vectors and CKKS for real-number vectors. The library exposes element-wise addition, subtraction, and multiplication on encrypted-encrypted and encrypted-plain vector pairs, as well as dot products and matrix multiplication, all without decrypting the data.
The implementation prioritizes efficiency by delegating most operations to C++ while maintaining a Python API for ease of use. It is built on top of numpy for its single runtime dependency. TenSEAL is designed for privacy-preserving machine learning workflows where sensitive data must remain encrypted during computation—for example, training logistic regression models or performing convolutions on encrypted data. The library also exposes the complete SEAL API under `tenseal.sealapi` for advanced use cases.
Use it for
- Train machine learning models on encrypted data without exposing raw inputs to the server.
- Perform encrypted inference on sensitive data in cloud environments where the service provider cannot see plaintext.
- Compute dot products and matrix operations on encrypted vectors for privacy-preserving analytics.
- Implement encrypted convolution operations for image processing on confidential datasets.
- Build secure multi-party computation workflows where encrypted tensors are processed without intermediate decryption.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you need to perform computations on encrypted tensors for privacy-preserving machine learning.
The library is actively maintained, has no known vulnerabilities, and provides prebuilt wheels for common platforms. Install friction is moderate due to C++ compilation requirements, but wheels eliminate build overhead for standard Python versions (3.11–3.14). The Apache-2.0 license is permissive. Not worth installing if you do not require homomorphic encryption or if your platform is not covered by prebuilt distributions.
Install
tenseal on PyPI
Before you install
Medium friction due to compiled C++ components. Prebuilt wheels are available for Python 3.11–3.14 on macOS (ARM64), Linux (manylinux 2.27/2.28), and Windows (x64). Building from source requires a modern C++ compiler, CMake 3.14+, Protocol Buffers compiler, and platform-specific toolchains (GNU G++ ≥6.0 on Linux, Xcode ≥9.3 on macOS, Visual Studio ≥2010 SP1 on Windows). Last release 10 days ago; repository is active with 1033 stars.
Requires Python ≥3.11. Building from source requires a C++ compiler (GNU G++ ≥6.0, Clang++ ≥5.0, or MSVC ≥2010 SP1), CMake ≥3.14, and Protocol Buffers compiler. Prebuilt wheels are available for Python 3.11–3.14 on macOS ARM64, Linux manylinux, and Windows x64.
License in practice
Licensed under Apache-2.0 (permissive). You may use, modify, and distribute TenSEAL and derivative works freely, provided you include a copy of the license and state significant changes. No patent grant is provided.
Quickstart
pip install tenseal
import tenseal as ts
import numpy as np
context = ts.context(ts.SCHEME_TYPE.CKKS, poly_modulus_degree=8192, coeff_mod_bit_sizes=[60, 40, 40, 60])
context.generate_galois_keys()
context.global_scale = 2**40
v1 = [0, 1, 2, 3, 4]
enc_v1 = ts.ckks_vector(context, v1)
enc_v2 = ts.ckks_vector(context, [4, 3, 2, 1, 0])
result = enc_v1 + enc_v2
print(result.decrypt()) # ~ [4, 4, 4, 4, 4]
Verify before relying
- Whether prebuilt wheels cover all target platforms and architectures for your deployment environment.
- Performance characteristics and throughput for large-scale tensor operations compared to unencrypted alternatives.
- Compatibility with specific versions of numpy beyond the runtime dependency declaration.
Package facts
| License | Apache-2.0 permissive |
| Python support | Supports the current Python release >=3.11 |
| Install friction | Medium. Platform-specific wheel |
| Runtime dependencies | 1 packagenumpy |
| Maintenance | Actively maintained 10 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 81,846 / month, #14,196 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Operating System :: OS IndependentProgramming Language :: C++Programming Language :: Python :: 3Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Topic :: Security :: Cryptography |
Evidence: tenseal-0.3.17-cp311-cp311-macosx_14_0_arm64.whl; tenseal-0.3.17-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl; tenseal-0.3.17-cp311-cp311-win_amd64.whl; tenseal-0.3.17-cp312-cp312-macosx_14_0_arm64.whl; tenseal-0.3.17-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl; tenseal-0.3.17-cp312-cp312-win_amd64.whl; tenseal-0.3.17-cp313-cp313-macosx_14_0_arm64.whl; tenseal-0.3.17-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl; tenseal-0.3.17-cp313-cp313-win_amd64.whl; tenseal-0.3.17-cp314-cp314-macosx_14_0_arm64.whl; tenseal-0.3.17-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl; tenseal-0.3.17-cp314-cp314-win_amd64.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “homomorphic encryption tensors”
- tensealTenSEAL performs homomorphic encryption operations on tensors,…
- lightpheLightPHE provides a Python library implementing partially and…
- torchcodecTorchCodec decodes and encodes videos, audio, and images to and from…
Give your agent the search over MCP, or paste the wish link into any chat.
More Cryptography packages
Certifi provides Mozilla's curated collection of root SSL certificates for Python applications to validate TLS hosts and verify certificate trustworthiness.
cryptography provides cryptographic recipes and low-level primitives for symmetric encryption, message digests, key derivation, and other common cryptographic algorithms in Python.
Pure-Python RSA encryption, decryption, signing, and key generation following PKCS#1 v1.5, with command-line and library interfaces.
pyOpenSSL wraps OpenSSL's SSL/TLS functionality for Python, providing high-level connection objects and certificate handling through a Python-friendly interface around OpenSSL's cryptographic operations.
Provides Microsoft Entra ID token-based authentication for Azure SDK clients through a set of TokenCredential implementations that handle OAuth flows and managed identity support.
PyNaCl provides Python bindings to libsodium for digital signatures, secret-key and public-key encryption, hashing, message authentication, and password-based key derivation.
See also lightphe · django-encrypted-model-fields · django-fernet-fields-v2 · django-cryptography-5 · django-cryptography-django5 · djfernet · ansible-vault · ff3 · bittensor-drand · safetensors