PyMilvus 版本需与 Milvus 服务端版本对应,装错大版本可能不兼容;zsh 下安装 pymilvus[model] 需加引号写成 pip install "pymilvus[model]";从源码开发需先 git submodule update --init 拉取 proto 子模块,且本地开发命令依赖 uv
pymilvus
milvus-ioApache-2.0活跃维护Milvus 向量数据库的官方 Python SDK,让 Python 开发者能直接建集合、写入向量并做相似度检索,是搭建 RAG 和向量搜索应用的基础客户端。
Python SDK for Milvus Vector Database
pip3 install pymilvusREADME 未说明;本包是客户端 SDK,需另行部署 Milvus 服务端,硬件要求取决于服务端
Milvus 向量数据库的官方 Python SDK,用来在 Python 里建集合、写入和检索向量
Milvus 向量数据库的官方 Python SDK,让 Python 开发者能直接建集合、写入向量并做相似度检索,是搭建 RAG 和向量搜索应用的基础客户端。
核心能力
- 提供 pip 安装的 Python 客户端,连接 Milvus 服务端
- 按 Milvus 版本匹配对应 PyMilvus 版本,如 2.6.* 对应 2.6.X
- 可选 model 扩展,安装 pymilvus[model] 获得 milvus-model
- 可选 bulk_writer 扩展,安装 pymilvus[bulk_writer] 支持批量写入
- 支持从 milvus-proto 生成 Python 协议文件
容易踩的坑
- v2.6.18PyMilvus v2.6.18 Release Notes最新正式版2026-11-06 · 2026-11-06 08:23 UTC
PyMilvus 2.6.18 targets the Milvus 2.6 series and requires Python 3.8 or later.
What's Changed
Features and enhancements
- Add row-level security (RLS) policy and principal-tag management to
MilvusClientandAsyncMilvusClient. Supported read and write operations acceptrls_principalfor server-side enforcement. These APIs require a deployment with RLS support. #3853 - Add configurable Volume upload policies, with paginated listings and bounded concurrency for large batches.
VolumeFileManager.upload_file_to_volume()now skips an existing object by default when its key and byte size match. Setupload_policy=UploadPolicy.OVERWRITEto replace matching objects. #3805 - Accept custom HTTP headers in
bulk_import(),get_import_progress(), andlist_import_jobs(). The SDK also exportsIDEMPOTENCY_KEY_HEADERfor use with servers that support idempotent bulk imports. #3808
Performance and bug fixes
- Restore linear-time decoding of nullable scalar output fields such as
VARCHARin search results. #3724 - Implement the async RPC handlers for
AsyncMilvusClient.flush_all(),get_compaction_plans(), andupdate_replicate_configuration(). #3891 - Preserve existing application log handlers when importing PyMilvus and scope BulkWriter logging to the
pymilvus.bulk_writerlogger tree. #3847 · #3849 - Return
NoneinQueryIterator.get_cursor().str_pkbefore the first page when the primary key isVARCHAR. #3860 - Raise
ParamErrorfor empty binary-vector lists in batch writes and reject out-of-range ports during connection validation. #3697 · #3833
Documentation, tests, and CI
- Add row-level security (RLS) policy and principal-tag management to
- v3.0.2PyMilvus v3.0.2 Release Notes2026-09-18 · 2026-09-18 08:53 UTC
查看更新说明
What's Changed
- Use Google-style docstrings for non-ORM APIs by @pymilvus-bot in https://github.com/milvus-io/pymilvus/pull/3749
- Add Bloom filter and Roaring bitmap builders for membership filtering by @xiaofan-luan in https://github.com/milvus-io/pymilvus/pull/3765
- Update milvus-proto for compaction observability by @MrPresent-Han in https://github.com/milvus-io/pymilvus/pull/3799
- Add compaction lifecycle observability APIs by @MrPresent-Han in https://github.com/milvus-io/pymilvus/pull/3800
- Add scalable Volume upload policies by @lentitude2tk in https://github.com/milvus-io/pymilvus/pull/3804
- Align membership filter documentation with
membership_matchsyntax by @xiaofan-luan in https://github.com/milvus-io/pymilvus/pull/3802
Full Changelog: https://github.com/milvus-io/pymilvus/compare/v3.0.1...v3.0.2
- v3.0.1PyMilvus v3.0.1 Release Notes2026-07-29 · 2026-07-29 14:55 UTC
查看更新说明
PyMilvus v3.0.1 Release Notes
PyMilvus 3.0.1 is the recommended Python SDK release for Milvus 3.0.
Compatibility: PyMilvus 3.0.1 requires Python 3.9 or later. Python 3.8 is no longer supported.
What's Changed
New APIs and capabilities
- Add
DataType.TEXThandling across schema validation, result decoding, and BulkWriter paths (#3473). - Add
get_replicate_info()toMilvusClientandAsyncMilvusClient(#3516). - Add sync and async
dump_messages()support for data-salvage workflows (#3575). - Add role and user descriptions, including
alter_role()and role-description output fromdescribe_role()(#3608). - Add search aggregation and correctly forward
group_by_fields(#3647). - Add FunctionChain APIs, forward every specified stage during search, and add the XGBoost expression helper (#3652, #3662, #3685).
Schema evolution and function fields
- Add
alter_collection_schema()and support dynamically adding struct fields (#3504, #3569). - Route collection-schema mutations through
AlterCollectionSchema, retain a legacyAddCollectionFieldfallback only for servers returningUNIMPLEMENTED, and keep drop-function RPC behavior compatible (#3572, #3706). - Support external field mappings and add-field fallback for external collections (#3584, #3728).
- Add
drop_function_field(), support MinHash function fields, and require bound index parameters when adding a function field (#3600, #3630, #3672). - Keep primary-key, partition-key, and clustering-key metadata synchronized when fields are added (#3667).
Iterators, search results, and type handling
- Move query, Search Iterator V1, and Search Iterator V2 implementations to the client layer while preserving ORM compatibility and aligning ORM deprecation warnings (#3707, #3709, #3714, #3718).
- Preserve external filtering when creating search iterators (#3730).
- Add shared field-data and nested-value decoders, remove the dead V1 row extractor, and avoid quadratic nullable-scalar result decoding (#3552, #3555, #3562, #3605, #3713, #3725).
- Consolidate logical type metadata across search, insert, array, row, and vector paths to remove inconsistent type-specific behavior (#3474, #3481, #3499, #3539, [#3548](https://github.com/milvus-io/pymil
- Add
- v2.6.17PyMilvus v2.6.17 Release Notes2026-07-17 · 2026-07-17 06:23 UTC
查看更新说明
What's Changed
Protocol and compatibility
- Sync
milvus-protowith Milvus v2.6.20 and regenerate Python protobuf bindings, including support for the inclusiveDumpMessagesstart option (#3687).
Bug fixes
- Materialize array query results as standard Python lists (source #3653; 2.6 #3654).
- Preserve struct-array fields when rebuilding schemas from dictionaries, and support partial updates for struct-array fields (sources #3651 and #3671; 2.6 #3656 and #3675).
- Support struct vector fields in BulkWriter and preserve remote upload path prefixes on Windows (sources #3631 and #3658; 2.6 #3669).
- Keep primary-key, partition-key, and clustering-key metadata synchronized when fields are added to a schema (source #3649; 2.6 #3668).
- Allow null values in an
auto_idprimary-key DataFrame column during insert (source #3673; 2.6 #3677). - Correctly unpack async schema results before running collection optimization (source #3681; 2.6 #3682).
- Reject boolean values used as sparse-vector indices (source #3638; 2.6 #3664; fixes #3622).
- Require
target_sizeincompact()to be a positive integer (source #3642; 2.6 #3643; fixes #3169).
Build and release tooling
- Isolate protobuf generation dependencies from normal development dependencies (source #3689; 2.6 #3691).
- Keep 2.6 development-version generation on
vcs-versioning<2semantics (source #3633; 2.6 #3635).
Full Changelog: https://github.com/milvus-io/pymilvus/compare/v2.6.16...v2.6.17
- Sync
- v2.6.16PyMilvus v2.6.16 Release Notes2026-06-25 · 2026-06-25 02:10 UTC
查看更新说明
What's Changed
Features and enhancements
- Add element-level search support (source #3208; 2.6 #3491).
- Add
dump_messagessupport for data salvage (source #3573; 2.6 #3574). - Add role and user description support in auth APIs (sources #3601 and #3602; 2.6 #3609).
- Improve volume upload interaction, including concurrency and progress behavior (source #3619; 2.6 #3628).
Bug fixes
- Harden sync and async connection recovery by protecting reconnect channel swaps and validating channel reclamation (sources #3542, #3564, and #3579; 2.6 #3566, #3571, and #3582).
- Preserve connection timeout settings during recovery (source #3610; 2.6 #3614).
- Map only connection-setup RPC failures to
CONNECT_FAILED(source #3589; 2.6 #3591). - Reject boolean values in sparse vector validation and improve the related error message (source #3624; 2.6 #3625).
Type handling and client internals
- Continue the logical type model migration across array helpers, row insert and extraction, field-data result and nested decoders, vector predicates, and vector-array dtype facts (sources #3518, #3501, #3536, #3537, #3554, #3604, and #3606; 2.6 #3549, #3551, #3553, #3556, #3558, #3607, and #3612).
- Remove the dead V1 row extractor (source #3561; 2.6 #3563).
Documentation and tests
- Update async client examples (source #3597; 2.6 #3598).
- Classify maintained test suites (source #3592; 2.6 #3596).
Full Changelog: https://github.com/milvus-io/pymilvus/compare/v2.6.15...v2.6.16
用户点评
登录用户的真实使用记录,可按版本和硬件筛选还没有人点评。第一个说出真实体验的人最有价值。
Milvus Python SDK
Python SDK for Milvus. To contribute code to this project, please read our contribution guidelines first. If you have some ideas or encounter a problem, you can find us in the Slack channel #py-milvus.
Compatibility
The following collection shows Milvus versions and recommended PyMilvus versions:
| Milvus version | Recommended PyMilvus version |
|---|---|
| 1.0.* | 1.0.1 |
| 1.1.* | 1.1.2 |
| 2.0.* | 2.0.2 |
| 2.1.* | 2.1.3 |
| 2.2.* | 2.2.15 |
| 2.3.* | 2.3.7 |
| 2.4.* | 2.4.X |
| 2.5.* | 2.5.X |
| 2.6.* | 2.6.X |
| 3.0.* | 3.0.X |
Installation
You can install PyMilvus via pip or pip3 for Python 3.9+:
$ pip3 install pymilvus
$ pip3 install pymilvus[model] # for milvus-model
$ pip3 install pymilvus[bulk_writer] # for bulk_writer
You can install a specific version of PyMilvus by:
$ pip3 install pymilvus==2.4.10
You can upgrade PyMilvus to the latest version by:
$ pip3 install --upgrade pymilvus
FAQ
Local development commands use uv. Install uv before running the
make targets below.
Q1. How to get submodules?
A1. The following command will get the protos matching to the generated files, for protos of certain version, see milvus-proto for details.
$ git submodule update --init
Q2. How to generate python files from milvus-proto?
A2.
$ make gen_proto
Q3. How to use the local PyMilvus repository for Milvus server?
A3.
$ make install
Q4. How to check and auto-fix the coding styles?
A4.
make lint
make format
Q5. How to set up pre-commit hooks to automatically check and fix the coding styles?
Once installed, the hooks will automatically run make format and make lint before each commit. If the checks fail, the commit will be aborted, and you'll need to fix the issues before committing again.
A5. Pre-commit hooks help ensure code quality by automatically running linting and formatting checks before each commit.
# Install pre-commit (if not already installed)
$ uv tool install pre-commit
# Install the git hook scripts
$ pre-commit install
Q7. How to run the maintained test suites?
A7
$ uv sync --group dev
$ make unittest
$ make integration-lite
Q8. zsh: no matches found: pymilvus[model], how do I solve this?
A8
$ pip install "pymilvus[model]"
Documentation
Documentation is available online: https://milvus.io/api-reference/pymilvus/v2.6.x/About.md
Developing package releases
The commits on the development branch of each version will be packaged and uploaded to Test PyPI.
The package name generated by the development branch is x.y.z.rc, where is the number of commits that differ from the most recent release.
-
For example, after the release of 2.3.4, two commits were submitted on the 2.3 branch. The version number of the latest commit of 2.3 branch is 2.3.5.rc2.
-
For example, after the release of 2.3.4, 10 commits were submitted on the master branch. The version number of the latest commit of master branch is 2.4.0.rc10.
To install the package on Test PyPi, you need to append --extra-index-url after pip, for example:
$ python3 -m pip install --extra-index-url https://test.pypi.org/simple/ pymilvus==2.1.0.dev66