How to Install rsa in Python

v4.9.1 General Purpose Python <4,>=3.6 Apache-2.0

Pure-Python RSA implementation

Install pip install rsa

What is rsa?

Pure-Python RSA implementation

I'm Sybren, one of the original authors and the maintainer of this project. Unfortunately I don't have the time and brain space left to properly maintain Python-RSA. As you can see from the lack of activity on the open issues, and the lack of commits, that has been the case for a while now.

As Python-RSA is included as a dependency in quite a few high-profile projects, I don't feel comfortable handing over the project to someone else. It's just too big of a risk.

Thanks for having used this little library for so long, and in so many projects. I truely didn't expect that when I started working on it. Also big thanks to all the people helping out and improving the project.

Quick Start

Minimal example to get started with rsa:

import rsa

print(rsa.__version__)

Installation

pip (standard)

pip install rsa

Virtual environment (recommended)

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

pip3

pip3 install rsa

conda

conda install -c conda-forge rsa

Poetry

poetry add rsa

Dependencies

Installing rsa will also install these packages:

Verify the Installation

After installing, confirm the package is available:

python -c "import rsa; print(rsa.__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 rsa with pip.

ModuleNotFoundError: No module named 'rsa'

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

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

ModuleNotFoundError: No module named 'rsa' (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 rsa to install into the interpreter you are running.

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

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

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

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 rsa. 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 rsa

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 rsa

Recent Releases

VersionReleased
4.9.1 latest 2025-04-16
4.9 2022-07-20
4.8 2021-11-24
4.7.2 2021-02-24
4.7.1 2021-02-15

Full release history on PyPI →

Manage rsa

Upgrade to latest version

pip install --upgrade rsa

Install a specific version

pip install rsa==4.9.1

Uninstall

pip uninstall rsa

Check what is installed

pip show rsa

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