How to Install Mahotas Library in Python?

Mahotas Library in Python:

Mahotas is a Python library for computer vision, image processing, and manipulation. A library is a set of functions and methods that allow you to do a variety of tasks without writing hundreds of lines of code. Mahotas incorporates several array-based algorithms. Mahotas now has over 100 functions for image processing and computer vision and is constantly expanding.

Mahotas is a good tool for discovering patterns in images. For example, the “Where’s Wally Problem” can be simply performed with Mahotas.

It also contains plenty of algorithms for working with numpy arrays. Thresholding, Convolution, Watershed, Spline interpolation, and so on are examples.

The Python’s pip package manager can be used to install the Mahotas library on both Windows and Linux platforms.

Installation of  Mahotas Library in windows

Open the command prompt and type the below command for the installation of the Mahotas library

pip install mahotas

Output:

Collecting mahotas
Downloading mahotas-1.4.12-cp37-cp37m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (5.7 MB)
|████████████████████████████████| 5.7 MB 3.9 MB/s 
Requirement already satisfied: numpy in /usr/local/lib/python3.7/dist-packages
(from mahotas) (1.21.5)
Installing collected packages: mahotas
Successfully installed mahotas-1.4.12

Another Way to Install Mahotas Library in Windows

We can install the mahotas package using the pip package manager; however, if the above technique fails to install the package, we may still install the package manually from the official website on Windows.

Steps to be followed:

  1. To install the Mahotas package, go to the official website (https://pypi.org/project/mahotas/)
  2. Navigate to the Download Files option and click on the mahotas-x.x.x-win amd64.whl link to download the package. (The version number of the package is denoted by x.x.x here)
  3. Downloading mahotas package from official website
  4. Open the command prompt(CMD )console and change the working directory to the Downloads directory.
  5. Install the .whl Mahotas package file that we downloaded from the website just a little time ago using the pip command.
  6. pip install mahotas-1.4.12-cp310-cp310-win_amd64.whl

We successfully installed the mahotas package on our Windows PC using this way.

Installing Mahotas from web

Installation of  Mahotas Library in Linux

We may also use the pip package manager to install the Mahotas package on a Linux system.

Steps to be followed:

  • Open the Linux terminal using Ctrl+Alt+T 
  • Type the below pip command for the installation of the Mahotas library.
sudo pip install mahotas

The package was successfully installed on the Linux system.

Installation of  Mahotas Library using conda

Use any of the below commands:

conda install -c conda-forge mahotas
conda install -c conda-forge/label/gcc7 mahotas