{"id":65,"library":"pymilvus","title":"PyMilvus","description":"Official Python SDK for Milvus, the open-source vector database. Has two coexisting APIs: the modern MilvusClient (recommended, introduced in 2.3) and the legacy ORM API (connections.connect + Collection class). Both currently work but LLM-generated and tutorial code overwhelmingly uses the old ORM patterns. Milvus Lite (embedded SQLite-based local mode) is available via the milvus-lite extra on Linux/macOS only. Server version must be kept in sync with client minor version.","status":"active","version":"2.6.8","language":"python","source_language":"en","source_url":"https://milvus.io/docs","tags":["milvus","pymilvus","vector-database","rag","embeddings","grpc","similarity-search","milvus-lite"],"install":[{"cmd":"pip install pymilvus","lang":"bash","label":"Base SDK"},{"cmd":"pip install 'pymilvus[model]'","lang":"bash","label":"With embedding/reranker model support"},{"cmd":"pip install 'pymilvus[milvus-lite]'","lang":"bash","label":"With Milvus Lite (local embedded mode, Linux/macOS only)"}],"dependencies":[{"reason":"Required. All Milvus connections use gRPC. Port 19530 must be open to server.","package":"grpcio","optional":false},{"reason":"Optional. Embedded SQLite-backed local mode. Linux and macOS only — Windows not supported.","package":"milvus-lite","optional":true}],"imports":[{"note":"ORM API (connections.connect + Collection) is the legacy pattern. Still works but all new Milvus documentation uses MilvusClient. LLMs and old tutorials almost exclusively generate ORM-style code. The two APIs are not interoperable — collections created via ORM Collection() are not visible to MilvusClient.list_collections() in some Milvus versions and vice versa.","wrong":"from pymilvus import connections, Collection\nconnections.connect('default', host='localhost', port='19530')\ncol = Collection('my_collection')","symbol":"MilvusClient (recommended)","correct":"from pymilvus import MilvusClient\nclient = MilvusClient(uri='http://localhost:19530', token='root:Milvus')\n# Milvus Lite (local, no server):\n# client = MilvusClient('local.db')"},{"note":"MilvusClient constructor takes uri= not host=/port=. Passing http= (a common mistake) silently fails — the parameter is not recognized and the client attempts a .db file path resolution.","wrong":"client = MilvusClient(host='localhost', port=19530)","symbol":"MilvusClient uri (not host/port)","correct":"client = MilvusClient(uri='http://localhost:19530')"}],"quickstart":{"code":"from pymilvus import MilvusClient, DataType\n\n# Connect to running Milvus server\nclient = MilvusClient(uri='http://localhost:19530', token='root:Milvus')\n\n# Milvus Lite (embedded, no server, Linux/macOS only):\n# client = MilvusClient('my_data.db')\n\n# Create collection (simple API)\nclient.create_collection(\n    collection_name='docs',\n    dimension=768,\n)\n\n# Insert\ndata = [\n    {'id': 1, 'vector': [0.1] * 768, 'text': 'hello world'},\n]\nclient.insert(collection_name='docs', data=data)\n\n# Search\nresults = client.search(\n    collection_name='docs',\n    data=[[0.1] * 768],\n    limit=5,\n    output_fields=['text'],\n)\nprint(results)","lang":"python","description":"MilvusClient is the recommended API for all new code. Milvus Lite works for prototyping on Linux/macOS but is NOT available on Windows."},"warnings":[{"fix":"Always align client and server versions. Check compatibility table: milvus.io/docs/release_notes.md. When upgrading server, upgrade client simultaneously.","message":"PyMilvus client version must match Milvus server minor version. pymilvus 2.6.x requires Milvus server 2.6.x. Using pymilvus 2.6 against a Milvus 2.4 server causes gRPC proto mismatch errors and silent data corruption.","severity":"breaking","affected_versions":"all"},{"fix":"On Windows, run a Milvus server (Docker) and connect via uri=. There is no embedded mode for Windows.","message":"Milvus Lite (.db file mode) is not available on Windows. MilvusClient('local.db') on Windows raises ModuleNotFoundError: No module named 'milvus_lite'.","severity":"breaking","affected_versions":"all"},{"fix":"Use only one API style per codebase. Prefer MilvusClient for all new code. If migrating legacy ORM code, convert fully rather than mixing.","message":"ORM API (Collection class) and MilvusClient are not fully interoperable. Collections created via Collection() may not appear in client.list_collections() due to internal state management differences. Mixing the two APIs in the same codebase causes hard-to-debug visibility issues.","severity":"breaking","affected_versions":"all"},{"fix":"After connecting, explicitly call client.using_database('db_name') to ensure the correct database context is active.","message":"MilvusClient database= parameter does not reliably set the active database context in some versions (confirmed bug in 2.5.4). Collections may be created in the default database instead of the specified one.","severity":"gotcha","affected_versions":"~2.5.4"},{"fix":"Call client.load_collection('name') before searching. For async load: poll client.get_load_state('name') until state is LoadState.Loaded before issuing queries.","message":"Collections must be loaded into memory before search or query. client.search() on an unloaded collection returns empty results or raises a not-loaded error. Loading is asynchronous by default.","severity":"gotcha","affected_versions":"all"},{"fix":"Only install [model] extra if you need local embedding generation. For production, generate embeddings separately and pass float vectors directly to insert/search.","message":"pymilvus[model] installs heavyweight ML dependencies (torch, transformers, sentence-transformers). pip install pymilvus[model] in a lean environment adds 1–2GB of packages.","severity":"gotcha","affected_versions":"all"},{"fix":"Quote the package spec: pip install 'pymilvus[model]'","message":"zsh users: pip install pymilvus[model] fails with 'zsh: no matches found'. zsh treats square brackets as glob patterns.","severity":"gotcha","affected_versions":"all"},{"fix":"Ensure that build essential packages are installed in your environment. For Alpine Linux, run `apk add build-base g++`. For Debian/Ubuntu, use `apt-get install build-essential`. For CentOS/RHEL, use `yum install gcc-c++` or `dnf install gcc-c++`.","message":"Installing PyMilvus on minimal Linux distributions (e.g., Alpine) or via specific source builds for dependencies like `grpcio` can fail with `FileNotFoundError: [Errno 2] No such file or directory: 'c++'` or similar compiler errors. This indicates missing system-level build tools required to compile Python packages with C/C++ extensions.","severity":"breaking","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-12T06:27:43.128Z","next_check":"2026-05-28T00:00:00.000Z","problems":[{"fix":"Check both your `pymilvus` client version (`pip show pymilvus`) and your Milvus server version. Then, either upgrade your Milvus server or downgrade/upgrade your `pymilvus` client to a compatible version (e.g., `pip install pymilvus==2.6.8`).","cause":"The `pymilvus` client library version is not compatible with the running Milvus server version. Milvus requires that the client and server minor versions (e.g., 2.3.x client with 2.3.y server) must match.","error":"this version of sdk is incompatible with server, please downgrade your sdk or upgrade your server"},{"fix":"Ensure the Milvus server is running and accessible from where your Python script is executed. Verify the host and port in your connection string (e.g., `MilvusClient('localhost:19530')` or `connections.connect(host='localhost', port='19530')`) match your Milvus server's configuration. Check firewall settings and disable any interfering proxy settings if applicable.","cause":"The `pymilvus` client failed to establish a connection with the Milvus server. This often happens if the Milvus server is not running, is running on a different host/port, or network issues (like firewall or proxy) are preventing the connection.","error":"pymilvus.exceptions.MilvusException: <MilvusException: (code=2, message=Fail connecting to server on localhost:19530, illegal connection params or server unavailable)>"},{"fix":"Install `pymilvus` using pip: `pip install pymilvus`. If you are using a virtual environment, ensure it is activated before installation. If the error persists, check your `PYTHONPATH` or verify that the correct Python interpreter is being used.","cause":"The `pymilvus` library is not installed in the Python environment you are currently using, or the Python interpreter cannot find it.","error":"ModuleNotFoundError: No module named 'pymilvus'"},{"fix":"Consult the official `pymilvus` documentation for your installed version (2.6.8) to use the correct methods. For `MilvusClient`, `create_collection_with_schema` has been integrated into `create_collection` where schema can be passed as an argument. For example, instead of `client.create_collection_with_schema(...)`, use `client.create_collection(..., schema=your_schema)`.","cause":"You are attempting to use a method that either does not exist, has been renamed, or is part of a different API (e.g., the legacy ORM API vs. the modern `MilvusClient` API) in the `pymilvus` version you have installed. Specifically, `create_collection_with_schema` was an older method, replaced by `create_collection` with schema parameters.","error":"AttributeError: 'MilvusClient' object has no attribute 'create_collection_with_schema'"},{"fix":"After creating or getting a collection object, explicitly load it into memory before performing search or query operations. For the ORM API, call `collection.load()`. For `MilvusClient`, use `client.load_collection(collection_name='your_collection_name')`.","cause":"Operations like search or query require a Milvus collection to be loaded into memory. This error indicates that the collection you are trying to operate on has not been loaded or the loading process failed.","error":"collection not loaded"}],"ecosystem":"pypi","meta_description":null,"install_score":88,"install_tag":"verified","quickstart_score":0,"quickstart_tag":"stale","pypi_latest":null,"install_checks":{"last_tested":"2026-05-12","tag":"verified","tag_description":"installs cleanly on critical runtimes, fast import, recently tested","results":[{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"milvus-lite","exit_code":1,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"model","exit_code":1,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":2.48,"mem_mb":50,"disk_size":"193.9M"},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"milvus-lite","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":1.26,"mem_mb":42.3,"disk_size":"354M"},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"model","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":1.25,"mem_mb":42.3,"disk_size":"568M"},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":1.22,"mem_mb":42.3,"disk_size":"184M"},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"milvus-lite","exit_code":1,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"model","exit_code":1,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":3.29,"mem_mb":55.9,"disk_size":"208.2M"},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"milvus-lite","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":1.94,"mem_mb":48.4,"disk_size":"368M"},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"model","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":1.86,"mem_mb":48.4,"disk_size":"558M"},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":1.9,"mem_mb":48.3,"disk_size":"197M"},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"milvus-lite","exit_code":1,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"model","exit_code":1,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":3.1,"mem_mb":54.9,"disk_size":"202.0M"},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"milvus-lite","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":2.23,"mem_mb":47.5,"disk_size":"362M"},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"model","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":2.16,"mem_mb":47.5,"disk_size":"545M"},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":2.17,"mem_mb":47.5,"disk_size":"191M"},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"milvus-lite","exit_code":1,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"model","exit_code":1,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":2.91,"mem_mb":56,"disk_size":"200.9M"},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"milvus-lite","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":2.17,"mem_mb":48.4,"disk_size":"360M"},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"model","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":2.14,"mem_mb":48.5,"disk_size":"543M"},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":2.15,"mem_mb":48.4,"disk_size":"190M"},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"milvus-lite","exit_code":1,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"model","exit_code":1,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":2.36,"mem_mb":50.7,"disk_size":"201.5M"},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"milvus-lite","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":1.46,"mem_mb":43,"disk_size":"364M"},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"model","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":1.42,"mem_mb":43,"disk_size":"562M"},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":1.43,"mem_mb":43,"disk_size":"194M"}]},"quickstart_checks":{"last_tested":"2026-05-12","tag":"stale","tag_description":"widespread failures or data too old to trust","results":[{"runtime":"python:3.10-alpine","exit_code":-1},{"runtime":"python:3.10-slim","exit_code":-1},{"runtime":"python:3.11-alpine","exit_code":-1},{"runtime":"python:3.11-slim","exit_code":-1},{"runtime":"python:3.12-alpine","exit_code":-1},{"runtime":"python:3.12-slim","exit_code":-1},{"runtime":"python:3.13-alpine","exit_code":-1},{"runtime":"python:3.13-slim","exit_code":-1},{"runtime":"python:3.9-alpine","exit_code":-1},{"runtime":"python:3.9-slim","exit_code":-1}]}}