JessicaTegner/pypandoc

Can pypandoc_binary support linux/arm64, because download_pandoc() seems to?

paul-gauthier opened this issue · 4 comments

Thanks for a great tool! I really appreciate the attention to making it easy to automagically install the pandoc executable. This makes it really easy to build tools on top of pandoc without asking end users to do out of band manual installs.

It appears that download_pandoc() is able to install pandoc on linux/arm64. But the pypandoc_binary package fails to install in that environment. Is it possible to upgrade pypandoc_binary to directly support linux/arm64?

Here's a transcript of a linux/arm64 docker container showing the pip install pypandoc_binary failing and the download_pandoc() working:

$ docker run --platform linux/arm64 -it python:3.10 /bin/bash

root@d781f0bbe5ba:/# uname -m
aarch64

root@d781f0bbe5ba:/# pip install pypandoc
Collecting pypandoc
  Downloading pypandoc-1.12-py3-none-any.whl (20 kB)
Installing collected packages: pypandoc
Successfully installed pypandoc-1.12

root@d781f0bbe5ba:/# pip install pypandoc_binary
ERROR: Could not find a version that satisfies the requirement pypandoc_binary (from versions: none)
ERROR: No matching distribution found for pypandoc_binary

root@d781f0bbe5ba:/# python
Python 3.10.13 (main, Feb  1 2024, 05:13:02) [GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.

>>> import pypandoc
>>> pypandoc.convert_text('# some title', 'rst', format='md')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.10/site-packages/pypandoc/__init__.py", line 92, in convert_text
    return _convert_input(source, format, 'string', to, extra_args=extra_args,
  File "/usr/local/lib/python3.10/site-packages/pypandoc/__init__.py", line 337, in _convert_input
    _ensure_pandoc_path()
  File "/usr/local/lib/python3.10/site-packages/pypandoc/__init__.py", line 763, in _ensure_pandoc_path
    raise OSError("No pandoc was found: either install pandoc and add it\n"
OSError: No pandoc was found: either install pandoc and add it
to your PATH or or call pypandoc.download_pandoc(...) or
install pypandoc wheels with included pandoc.

>>> pypandoc.download_pandoc()
>>> pypandoc.convert_text('# some title', 'rst', format='md')
'some title\n==========\n'

Thanks for a great issue :)

Should be easy enough to do for pypandoc_biniary, since download_pandoc already seems to support arm. Only thing we would need to do, is adapt the CI pipeline to also build pypandoc_binary on an arm linux platform

Hey @paul-gauthier

Could you please test the produced wheels you need from the following build, and let me know if it works for you.

https://github.com/JessicaTegner/pypandoc/actions/runs/7883689309

@JessicaTegner
I can confirm the pypandoc_binary-1.12-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl and mac arm64 both work correctly on the corresponding platforms.
Can you upload to pypi soon? I am eager to install them via pypi for my docker environment. Thanks a lot for your generous contribution!

Hey @paul-gauthier

Could you please test the produced wheels you need from the following build, and let me know if it works for you.

https://github.com/JessicaTegner/pypandoc/actions/runs/7883689309

@superkeyor great. Thanks for the confirmation. Yeah we will probably have it on pypi, within a week