Last modified: Jun 04, 2025 By Alexander Williams
Install umap-learn in Python
UMAP (Uniform Manifold Approximation and Projection) is a powerful tool for dimensionality reduction. It is similar to t-SNE but often faster. This guide will help you install umap-learn in Python.
Table Of Contents
Prerequisites
Before installing umap-learn, ensure you have Python 3.6 or later. You also need pip, Python's package installer. Check your Python version:
import sys
print(sys.version)
# Output: Python 3.8.5 (default, Jan 27 2021, 15:41:15)
Install umap-learn via pip
The easiest way to install umap-learn is using pip
. Run the following command in your terminal:
pip install umap-learn
This will download and install the latest stable version of umap-learn along with its dependencies.
Verify Installation
After installation, verify it works by importing it in Python:
import umap
print("UMAP version:", umap.__version__)
# Output: UMAP version: 0.5.3
Install with Conda
If you use Anaconda, install umap-learn via conda-forge:
conda install -c conda-forge umap-learn
This ensures compatibility with other scientific libraries like NumPy and SciPy.
Common Issues
If you encounter errors, ensure your build tools are up-to-date. For Windows, install Microsoft Visual C++ tools. For macOS, install Xcode.
If you face dependency issues, check our guide on installing Python-Levenshtein for similar troubleshooting steps.
Basic Usage Example
Here’s a simple example of using umap-learn for dimensionality reduction:
import umap
from sklearn.datasets import load_digits
digits = load_digits()
embedding = umap.UMAP().fit_transform(digits.data)
print(embedding.shape) # Reduces 64D data to 2D
# Output: (1797, 2)
Conclusion
Installing umap-learn in Python is straightforward with pip or conda. It is a powerful library for dimensionality reduction tasks. For more advanced setups, check our guides on installing HDBSCAN or CatBoost.