{"id":1655,"library":"pypandoc-binary","title":"pypandoc-binary: Pandoc Python Wrapper with Bundled Binary","description":"pypandoc-binary is a thin Python wrapper for Pandoc that conveniently includes the Pandoc executable directly within its wheels, eliminating the need for users to manually install Pandoc. It is actively maintained with a somewhat irregular but consistent release cadence, with the current version being 1.17.","status":"active","version":"1.17","language":"en","source_language":"en","source_url":"https://github.com/JessicaTegner/pypandoc","tags":["pandoc","markdown","conversion","documents","html","rst","binary"],"install":[{"cmd":"pip install pypandoc-binary","lang":"bash","label":"Install pypandoc-binary"}],"dependencies":[],"imports":[{"symbol":"convert_text","correct":"import pypandoc; pypandoc.convert_text(...)"},{"symbol":"convert_file","correct":"import pypandoc; pypandoc.convert_file(...)"},{"note":"All core functions are imported from `pypandoc`, even when installing `pypandoc-binary`.","wrong":"from pypandoc_binary import download_pandoc","symbol":"download_pandoc","correct":"import pypandoc; pypandoc.download_pandoc()"}],"quickstart":{"code":"import pypandoc\nimport os\n\n# pypandoc-binary includes the pandoc executable in its wheel.\n# No manual download is typically needed unless you want a different version.\n\nmarkdown_text = \"# Hello, World!\\n\\nThis is some **Markdown** content.\"\n\n# Convert Markdown text to reStructuredText\ntry:\n    rst_output = pypandoc.convert_text(markdown_text, 'rst', format='md')\n    print(\"Converted to reStructuredText:\\n\" + rst_output)\n\n    # Convert Markdown file to HTML file\n    with open('input.md', 'w') as f:\n        f.write(markdown_text)\n\n    pypandoc.convert_file('input.md', 'html', outputfile='output.html')\n    print(\"\\nConverted input.md to output.html\")\n    with open('output.html', 'r') as f:\n        print(\"\\nContent of output.html:\\n\" + f.read()[:100] + '...') # Print first 100 chars\n\nfinally:\n    # Clean up created files\n    for f in ['input.md', 'output.html']:\n        if os.path.exists(f):\n            os.remove(f)\n","lang":"python","description":"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."},"warnings":[{"fix":"Upgrade to Python 3.x (3.7+ is currently required).","message":"Python 2 support was officially dropped in `pypandoc` v1.8. Attempts to use it with Python 2.x will fail.","severity":"breaking","affected_versions":">=1.8"},{"fix":"Upgrade to Python 3.7 or newer. The current PyPI package requires >=3.7.","message":"Support for Python 3.6 was removed in `pypandoc` v1.13. Users on older Python 3.x versions may encounter installation or runtime errors.","severity":"breaking","affected_versions":">=1.13"},{"fix":"Ensure you are using `pypandoc-binary` if you want Pandoc bundled, or verify Pandoc is in your PATH if using the `pypandoc` package.","message":"`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.","severity":"gotcha","affected_versions":"all"},{"fix":"If 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.","message":"Since `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.","severity":"gotcha","affected_versions":">=1.7.0"},{"fix":"If citation processing fails, verify your Pandoc version and consider installing `pandoc-citeproc` or managing citation processing externally.","message":"Newer 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.","severity":"gotcha","affected_versions":">=1.6.3 (for bundled Pandoc versions)"}],"env_vars":null,"last_verified":"2026-04-09T00:00:00.000Z","next_check":"2026-07-08T00:00:00.000Z"}