How to Install shapely in Python

v2.1.2 Data & Science Python >=3.10 BSD 3-Clause

Manipulation and analysis of geometric objects

Install pip install shapely

What is shapely?

Manipulation and analysis of geometric objects

Manipulation and analysis of geometric objects in the Cartesian plane.

Shapely is a BSD-licensed Python package for manipulation and analysis of planar geometric objects. It is using the widely deployed open-source geometry library (the engine of `PostGIS JTS `). Shapely wraps GEOS geometries and operations to provide both a feature rich interface for singular (scalar) geometries and higher-performance NumPy ufuncs for operations using arrays of geometries. Shapely is not primarily focused on data serialization formats or coordinate systems, but can be readily integrated with packages that are.

A universal function (or ufunc for short) is a function that operates on n-dimensional arrays on an element-by-element fashion and supports array broadcasting. The underlying `` loops are implemented in C to reduce the overhead of the Python interpreter.

Quick Start

Minimal example to get started with shapely:

import shapely

print(shapely.__version__)

Installation

pip (standard)

pip install shapely

Virtual environment (recommended)

python -m venv venv
source venv/bin/activate   # Windows: venv\Scripts\activate
pip install shapely

pip3

pip3 install shapely

conda

conda install -c conda-forge shapely

Poetry

poetry add shapely

Dependencies

Installing shapely will also install these packages:

Verify the Installation

After installing, confirm the package is available:

python -c "import shapely; print(shapely.__version__)"

If this prints a version number, installation succeeded. If you see a ModuleNotFoundError, see the errors section below.

Installation Errors

Common errors when installing shapely with pip.

ModuleNotFoundError: No module named 'shapely'

Cause: The package is not installed in the current Python environment.

Fix: Run pip install shapely. If using a virtual environment, ensure it is activated first.

ModuleNotFoundError: No module named 'shapely' (installed but still failing)

Cause: pip installed the package into a different Python than the one running your script.

Fix: Use python -m pip install shapely to install into the interpreter you are running.

ImportError: cannot import name 'X' from 'shapely'

Cause: The function or class does not exist in the installed version.

Fix: Check the version with pip show shapely and upgrade with pip install --upgrade shapely.

pip: command not found

Cause: pip is not in PATH or Python was not added to PATH during installation.

Fix: Try python -m pip install shapely. On macOS/Linux try pip3.

PermissionError: [Errno 13] Permission denied

Cause: No write access to the system Python package directory.

Fix: Use a virtual environment, or add --user: pip install --user shapely

SSL: CERTIFICATE_VERIFY_FAILED

Cause: pip cannot verify PyPI's SSL certificate — common behind corporate proxies.

Fix: Try: pip install --trusted-host pypi.org --trusted-host files.pythonhosted.org shapely

MemoryError when loading data

Cause: Dataset is too large to fit in RAM.

Fix: Read in chunks, filter columns on load, or consider Polars/Dask for out-of-core processing.

Recent Releases

VersionReleased
2.1.2 latest 2025-09-24
2.1.1 2025-05-19
2.1.0 2025-04-03
2.1.0rc1 2025-03-15
2.0.7 2025-01-31

Full release history on PyPI →

Manage shapely

Upgrade to latest version

pip install --upgrade shapely

Install a specific version

pip install shapely==2.1.2

Uninstall

pip uninstall shapely

Check what is installed

pip show shapely

Last updated: 2026-04-11 • Data from PyPI