How to Install pyasn1-modules in Python
A collection of ASN.1-based protocols modules
pip install pyasn1-modules
What is pyasn1-modules?
A collection of ASN.1-based protocols modules
The package contains a collection of ASN.1 data structures expressed as Python classes based on pyasn1 data model.
If ASN.1 module you need is not present in this collection, try using Asn1ate tool that compiles ASN.1 documents into pyasn1 code.
NOTE: The package is now maintained by Christian Heimes and Simon Pichugin in project
Quick Start
Minimal example to get started with pyasn1-modules:
import pyasn1_modules
print(pyasn1_modules.__version__)
Installation
pip (standard)
pip install pyasn1-modules
Virtual environment (recommended)
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
pip install pyasn1-modules
pip3
pip3 install pyasn1-modules
conda
conda install -c conda-forge pyasn1-modules
Poetry
poetry add pyasn1-modules
Dependencies
Installing pyasn1-modules will also install these packages:
Verify the Installation
After installing, confirm the package is available:
python -c "import pyasn1_modules; print(pyasn1_modules.__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 pyasn1-modules with pip.
ModuleNotFoundError: No module named 'pyasn1_modules'
Cause: The package is not installed in the current Python environment.
Fix: Run pip install pyasn1-modules. If using a virtual environment, ensure it is activated first.
ModuleNotFoundError: No module named 'pyasn1_modules' (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 pyasn1-modules to install into the interpreter you are running.
ImportError: cannot import name 'X' from 'pyasn1_modules'
Cause: The function or class does not exist in the installed version.
Fix: Check the version with pip show pyasn1-modules and upgrade with pip install --upgrade pyasn1-modules.
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 pyasn1-modules. 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 pyasn1-modules
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 pyasn1-modules
Recent Releases
| Version | Released |
|---|---|
0.4.2 latest |
2025-03-28 |
0.4.1 |
2024-09-10 |
0.4.0 |
2024-03-26 |
0.3.0 |
2023-04-20 |
0.2.8 |
2020-01-09 |
Manage pyasn1-modules
Upgrade to latest version
pip install --upgrade pyasn1-modules
Install a specific version
pip install pyasn1-modules==0.4.2
Uninstall
pip uninstall pyasn1-modules
Check what is installed
pip show pyasn1-modules