The mtools collection is written in Python, and most of the tools only use the standard packages shipped with Python. The tools are currently tested with Python 3.6, 3.7, and 3.8.
Some of the tools have additional dependencies, which are listed under the specific tool’s section.
The mtools suite is only tested with actively supported (non End-of-Life) versions of the MongoDB server. As of January 2020, that includes MongoDB 3.6 or newer.
You need to have Python 3.6.x, 3.7.x, or 3.8.x installed in order to use mtools. Other versions of Python are not currently supported.
To check your Python version, run
python --versionon the command line.
Installation with pip3#
The easiest way to install mtools is via
pip3. From the command line, run:
pip3 install mtools
Some mtools scripts have additional dependencies. To install all optional dependencies use:
pip3 install mtools[all]
You need to have Python 3.6 or newer installed.
pip3 should be included as
part of the default install for supported versions of Python 3.
Depending on your user rights,
pip3 may complain about not having
permissions to install into the system directory.
In that case, you either need to add
sudo in front of the
to install into a system directory, or append
--user to install into your
Installation from source#
pip3 is not available and you want to install mtools from source, you can
get the source code by cloning the mtools github repository:
git clone git://github.com/rueckstiess/mtools.git
Or download the tarball from PyPI and extract it with:
tar xzvf mtools-<version>.tar.gz
cd into the mtools directory and run:
sudo python setup.py install
This will install mtools into your Python’s site-packages folder, create links to the scripts and set everything up. You should now be able to use all the scripts directly from the command line.
The full list of requirements (some of which are already included in the Python standard library) can be found in the requirements.txt file.
To install all dependencies for full feature support, run:
pip3 install mtools[all]
To install dependencies for a subset of mtools utilities, specify one or more script names as a comma-separated list:
pip3 install mtools[mlaunch,mloginfo]
required for mlaunch
psutil to manage starting, stopping, and finding MongoDB
required for mlaunch and mtransfer
pymongo is MongoDB’s official
mlaunch uses this to configure and query local MongoDB
required for mplotqueries
matplotlib is a python 2D plotting library which produces figures and graphs in a variety of formats and interactive environments across platforms.
required for matplotlib (in mplotqueries)
numpy is a Python module for scientific computing and numerical calculations.