JessicaTegner/pypandoc

support for osx-arm64 ?

MarkWieczorek opened this issue · 15 comments

There currently is not a pypandoc conda package that works on the new macos machines with M1 chips (osx-arm64). I tried to add pypandoc to the automatic osx-arm64 migrator to generate one (conda-forge/pypandoc-feedstock#16), but it appears that this package can't be automatically migrated for some unknown reason. I am not familiar enough with this repo to understand the problem, but it appears that this might be related to the fact that this wrapper to pandoc downloads pandoc binaries, and that perhaps there isn't an osx-arm64 binary available.

In any case, I would really like to use this package on the new macs, so if anyone knows the origin of this problem, please speak up!

@MarkWieczorek
from this issue it seems like there are available pandoc pandoc builds for the m1.
Can you try the folliwing:

  • Install pypandoc with pip
  • Try to install pandoc through pypandoc by importing it and running pypandoc.download_pandoc()

Please lety me know what result you have with the above, and if you get any error output from conda in general

Installing pypandoc with pip seemed to work ok (no errors).

However, the second part didn't work:

In [1]: import pypandoc

In [2]: pypandoc.download_pandoc()
[INFO] Downloading pandoc from https://github.com/jgm/pandoc/releases/download/2.18/pandoc-2.18-macOS.pkg ...
[INFO] Unpacking pandoc-2.18-macOS.pkg to tempfolder...
x .
x ./usr
x ./usr/local
x ./usr/local/bin
x ./usr/local/bin/pandoc
x ./usr/local/bin/._pandoc
x ./usr/local/._bin
x ./usr/local/share
x ./usr/local/share/man
x ./usr/local/share/man/man1
x ./usr/local/share/man/man1/pandoc.1
x ./usr/local/share/man/man1/._pandoc.1
x ./usr/local/share/man/._man1
x ./usr/local/share/._man
x ./usr/local/._share
x ./usr/._local
x ./._usr
[INFO] Copying pandoc to /Users/lunokhod/Applications/pandoc ...
[INFO] Making /Users/lunokhod/Applications/pandoc/pandoc executeable...
[INFO] Copying pandoc-citeproc to /Users/lunokhod/Applications/pandoc ...
[ERROR] Didn't copy pandoc-citeproc
Traceback (most recent call last):
  File "/Users/lunokhod/.conda/envs/test310/lib/python3.10/site-packages/pypandoc/pandoc_download.py", line 152, in _handle_darwin
    shutil.copyfile(src, dst)
  File "/Users/lunokhod/.conda/envs/test310/lib/python3.10/shutil.py", line 254, in copyfile
    with open(src, 'rb') as fsrc:
FileNotFoundError: [Errno 2] No such file or directory: '/var/folders/n2/f1yzwck529q90x_3y32txg640000gn/T/tmpshop3zjz/tmp/usr/local/bin/pandoc-citeproc'
[INFO] Done.

And here is the conda output

(test310) ➜  ~ conda install pypandoc
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: -
Found conflicts! Looking for incompatible packages.
This can take several minutes.  Press CTRL-C to abort.
failed

UnsatisfiableError: The following specifications were found to be incompatible with each other:

Output in format: Requested package -> Available versions

and just to make sure. The result from pypandoc.download_pandoc() doesn't actually put pandoc in the "/Users/lunokhod/Applications/pandoc" folder?

It did put the pandoc executable in that folder, and the executable seems to work (./pandoc --version didn't fail...)

That's interesting.
So it seems like it's not a m1 error. But as you pasted above, it seems to get a FileNotFoundError, which should be handled correctly, if pandoc citeproc isn't present...

I'll look into it

@MarkWieczorek the output from conda doesn't actually show what's wrong, just that it's failing.

From what I've gathered:

  1. There are m1 builds available of pandoc, wich pypandoc are indeed downloading
  2. The traceback in handle_darwin is expected

I'll try to see if I can add mac m1 to the ci here, before I say that this is an upstream issue.

hey @MarkWieczorek as you can see from the testing added in #267 it seems to be an anaconda issue, not so much a pypandoc issue.

I'm not sure how travis ci tests work with macos, but its possible that they are being run on intel macs.

as you can see from this link I've set the travis build to be run on macOS 12.3, macOS 11.6 and macOS 10.15.7.
So form my understanding, since it's running macOS Big Sur, it should be running on m1 macs, right?

In "normal" times that would be ok. But, every 10 years apple decides to screw with us an make new hardware that runs on new chips that are incompatible with the old ones. Generally, this occurs 5 years before they come out with a new charging port for iphones.

The past 10 years, macs have used intel chips, but about a year or so ago they started selling macs that use their own "M1" chip. "Big sur" runs on both of them. To be honest, I haven't figured out how to run CI tests using the two different chips...

aha... I'll see if I can make it report if it's running on inten or m1 chips

@MarkWieczorek as it turns out, you were right.
While it's running Big Sur, it's actually still running on intel chipsets.
TravisCI doesn't at the time of writing support MacOS M1 machines, so I have no way of testing pypandoc on M1 architecture

So the error is, that you are getting a "FileNotFoundError" when trying to install pandoc through PyPandoc.
The interesting part it, we do check for "FileNotFoundError" so don't know why you are getting this.

I don't know how to fix this... sorry!