Last modified: Jun 10, 2026
Install PyMilvus: A Simple Guide
PyMilvus is the Python SDK for Milvus. Milvus is a powerful vector database. You use it to store and search vector embeddings. This guide shows you how to install PyMilvus correctly. We cover prerequisites, installation steps, and common issues. Let's get started.
What is PyMilvus?
PyMilvus is a client library. It lets you interact with a Milvus server from Python. You can create collections, insert data, and run similarity searches. It is essential for building AI and machine learning applications. You need it to work with vector data efficiently.
Prerequisites
Before you install PyMilvus, check your system. You need Python 3.7 or higher. You also need pip, the Python package installer. A stable internet connection helps download packages. Optionally, use a virtual environment. This keeps your project dependencies clean.
Check Python Version
Open your terminal or command prompt. Run this command to check your Python version.
python --version
You should see something like Python 3.9.0. If you have an older version, upgrade Python first. Visit python.org for the latest version.
Check pip Version
Run this command to check if pip is installed.
pip --version
If pip is missing, install it. Use the official Python installer or run python -m ensurepip --upgrade.
Install PyMilvus via pip
The easiest way to install PyMilvus is with pip. It downloads the library and its dependencies automatically. Run this command in your terminal.
pip install pymilvus
This installs the latest stable version. The process takes a few seconds. You will see progress bars and a success message at the end.
Install a Specific Version
Sometimes you need a specific version. Maybe your project requires version 2.2.0. Use the == operator to pin the version.
pip install pymilvus==2.2.0
Check the PyMilvus release page for available versions. Using a specific version ensures compatibility with your Milvus server.
Install in a Virtual Environment
Virtual environments isolate your project dependencies. This prevents conflicts between projects. First, create a virtual environment.
python -m venv myenv
Activate it. On Windows, use myenv\Scripts\activate. On macOS/Linux, use source myenv/bin/activate. Your prompt changes to show the environment name.
Now install PyMilvus inside the environment.
pip install pymilvus
This keeps your global Python clean. You can delete the environment later without affecting other projects.
Verify the Installation
After installation, verify it works. Open a Python interpreter. Import PyMilvus and check its version.
import pymilvus
print(pymilvus.__version__)
You should see a version number like 2.3.0. If you see an error, check your installation.
Common Installation Issues
Permission Denied
On Linux or macOS, you might get a permission error. Use sudo to install globally, but it is not recommended. Instead, install in a virtual environment or use the --user flag.
pip install --user pymilvus
Network Timeout
Slow internet can cause timeouts. Use a mirror or increase the timeout.
pip install --timeout=100 pymilvus
Dependency Conflicts
PyMilvus depends on grpcio and protobuf. If you have conflicting versions, use a virtual environment. This isolates dependencies.
Test with a Simple Connection
Now test a connection to a Milvus server. If you don't have a server, start one locally using Docker. First, create a connection.
from pymilvus import connections
# Connect to local Milvus server
connections.connect(host='localhost', port='19530')
print("Connected successfully!")
If the connection succeeds, you see the message. If it fails, ensure your Milvus server is running. Check the host and port values.
Upgrading PyMilvus
To upgrade to the latest version, run this command.
pip install --upgrade pymilvus
This updates your library. It also upgrades dependencies if needed. Always check release notes for breaking changes.
Uninstalling PyMilvus
To remove PyMilvus, use pip uninstall.
pip uninstall pymilvus
This removes the library and its dependencies. If you used a virtual environment, just delete the environment folder.
Conclusion
Installing PyMilvus is straightforward. Use pip to install it. Use a virtual environment to avoid conflicts. Verify the installation with a quick import. Test a connection to your Milvus server. Now you are ready to build vector search applications. Start exploring the power of Milvus with PyMilvus today.