Install PyMongo 4.0.1

ActiveState has made it easy to install the latest version of PyMongo. Copy and paste the snippet below into your terminal to install a verified, built-from-source version of PyMongo from ActiveState's free repository. We've taken care of all the dependencies so you don't have to.

PyMongo Logo

Run the following command in your terminal

pip3 install --index-url PyMongo==4.0.1

The --index-url parameter tells pip to install the package from ActiveState's repository.

Built for

  • OSX
  • Linux
  • Windows

Compatible with

Compatible with 3.7, 3.8 & 3.9

Why install Python packages from ActiveState?

/ conda

Built from source code

We build all packages from known and vetted source code. The source code is stored indefinitely on our secure supply chain. This reduces the likelihood of specific types of exploits while eliminating typosquatting.


Support for OS-level dependencies

Artifact dependencies extend to the operating-system level. For example, when building XML libraries for Python, we also build Expat from its C source files.

Vetted new source releases

Source is updated as new versions are released, but after a manual and automatic review process and at 24-48 hour delay compared to the main public repository.


Artifacts built for Linux, MacOS, Windows

Isolated and ephemeral build environments

Build stages are conducted in single-use build environments that are discarded after the build is complete. Builds are run automatically based on known and version-controlled configurations.


Revision-controlled build history

The ActiveState Platform maintains a catalog of all source code used to build artifacts, along with all available metadata. This information is revision-controlled and immutable (except when a change is essential for security or privacy reasons).


Machine-readable SBOM

We store all provenance metadata available for all artifacts, exposing it as machine-readable SBOM files.

Supply chain levels for Software Artifacts (SLSA) Level 4

SLSA is led by an initial cross-organization, vendor-neutral steering group committed to improving the security ecosystem for everyone. SLSA Level 4 requires two-person review of all changes and a hermetic, reproducible build process.

Get these features and more with the ActiveState Platform.

Our enterprise-grade platform can help streamline your Python, Perl & Tcl workflows.

Create a free account

97% of the Fortune 1000 companies use ActiveState

For more than 20 years, ActiveState has been making open source easier, more secure, and less risky.

Cisco Logo
Tesco Logo
Verizon Logo
Texas Instruments Logo
Toyota Logo
Capital One Logo
Siemens Logo

Frequently Asked Questions

What is PyMongo?

PyMongo is a Python distribution containing tools (mongoclient, Python driver, etc) for working with MongoDB from the command line, and is the recommended way to work with MongoDB using Python.

Which Python versions are compatible with PyMongo?

PyMongo is compatible with Python 3.6 and later versions of Python.

Where does PyMongo install to?

As with all Python packages installed with pip, PyMongo will be installed to %PYTHONHOME%/site-packages. This will always be true for global installations of PyMongo. If you’re using a virtual environment (like virtualenv), PyMongo will be installed differently, depending (for example) on where you created the directory for your virtual environment.

Note that you will have to install mongodb database separately either on localhost or else remotely, such as in AWS.

Does PyMongo work on Windows, Linux and Mac?

Yes, PyMongo will work Windows, Mac (OSX), and Linux (Ubuntu, CentOS, RHEL, etc.).

How is PyMongo commonly used?

PyMongo allows you to work with MongoDB, which in turns lets you perform:

  • Ad Hoc Queries – MongoDB supports searching by field, range queries, and regular expression searches. Queries can be made to return specific fields within documents.
  • Indexing – Indexes can be created to improve the performance of searches within MongoDB. Any field in a MongoDB document can be indexed.
  • Replication – MongoDB can provide high availability with replica sets. A replica set consists of two or more MongoDB instances. Each replica set member may act in the role of the primary or secondary replica at any time. The primary replica is the main server which interacts with the client and performs all the read/write operations. The secondary replicas maintain a copy of the data of the primary using built-in replication. When a primary replica fails, the replica set automatically switches over to the secondary set, which then becomes the primary server.
  • Load Balancing – MongoDB uses the concept of sharding to scale horizontally by splitting data across multiple MongoDB instances. MongoDB can run over multiple servers, balancing the load and/or duplicating data to keep the system up and running in case of hardware failure.

Read the docs or the Readme on

How do I manually install PyMongo?

The manual way to install PyMongo package is to use pip package manager to download from PyPI and install in one step. You can also install it by following the directions on the repository.