Install & Compatibility
Where this runs
tested against v1.17 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.136s · 172.6MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 2.4s · import 0.126s · 173MB
171MB installed
● package 171MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
convert_text
✓ from pypandoc import convert_text
✗ import pypandoc; pypandoc.convert_text(...)
convert_file
✓ from pypandoc import convert_file
download_pandoc
✓ from pypandoc import download_pandoc
This quickstart demonstrates converting Markdown text to reStructuredText and converting a Markdown file to an HTML file using `pypandoc-binary`. The `pypandoc` module is used for all operations, and the bundled Pandoc executable is utilized automatically.
import pypandoc
import os
# pypandoc-binary includes the pandoc executable in its wheel.
# No manual download is typically needed unless you want a different version.
markdown_text = "# Hello, World!\n\nThis is some **Markdown** content."
# Convert Markdown text to reStructuredText
try:
rst_output = pypandoc.convert_text(markdown_text, 'rst', format='md')
print("Converted to reStructuredText:\n" + rst_output)
# Convert Markdown file to HTML file
with open('input.md', 'w') as f:
f.write(markdown_text)
pypandoc.convert_file('input.md', 'html', outputfile='output.html')
print("\nConverted input.md to output.html")
with open('output.html', 'r') as f:
print("\nContent of output.html:\n" + f.read()[:100] + '...') # Print first 100 chars
finally:
# Clean up created files
for f in ['input.md', 'output.html']:
if os.path.exists(f):
os.remove(f)
Debug
Known issues
breakingPython 2 support was officially dropped in `pypandoc` v1.8. Attempts to use it with Python 2.x will fail.fixUpgrade to Python 3.x (3.7+ is currently required).
affects: >=1.8
breakingSupport for Python 3.6 was removed in `pypandoc` v1.13. Users on older Python 3.x versions may encounter installation or runtime errors.fixUpgrade to Python 3.7 or newer. The current PyPI package requires >=3.7.
affects: >=1.13
gotcha`pypandoc-binary` bundles the Pandoc executable. However, `pypandoc` (the base package without `-binary`) requires Pandoc to be pre-installed on the system. Users sometimes confuse these or switch between them, leading to 'Pandoc not found' errors.fixEnsure you are using `pypandoc-binary` if you want Pandoc bundled, or verify Pandoc is in your PATH if using the `pypandoc` package.
affects: all
gotchaSince `pypandoc` v1.7.0, the `sandbox` mode for Pandoc (versions >= 2.15) is enabled by default. This enhances security but might restrict access to local files or network resources during conversion, potentially breaking existing workflows that relied on it.fixIf conversions fail due to sandboxing, you can disable it by passing `extra_args=['--no-sandbox']` to `convert_text` or `convert_file`, but be aware of the security implications.
affects: >=1.7.0
gotchaNewer versions of Pandoc (e.g., above 2.10), which are bundled with `pypandoc-binary`, do not include `citeproc` by default. If your conversions involve citations, you might need to install `pandoc-citeproc` separately or ensure it's available.fixIf citation processing fails, verify your Pandoc version and consider installing `pandoc-citeproc` or managing citation processing externally.
affects: >=1.6.3 (for bundled Pandoc versions)
Upgrade
Version history
1.17latest on PyPI · released Mar 14, 2026
Audit
Dependencies
No dependency data recorded yet.