rstudio / reticulate

R Interface to Python
https://rstudio.github.io/reticulate
Apache License 2.0
1.68k stars 328 forks source link

resolve m1mac CRAN build issues #1130

Open kevinushey opened 2 years ago

kevinushey commented 2 years ago

In reticulate's own vignettes:

* checking re-building of vignette outputs ... WARNING
Error(s) in re-building vignettes:
--- re-building ‘arrays.Rmd’ using rmarkdown
--- finished re-building ‘arrays.Rmd’

--- re-building ‘calling_python.Rmd’ using rmarkdown
--- finished re-building ‘calling_python.Rmd’

--- re-building ‘package.Rmd’ using rmarkdown
--- finished re-building ‘package.Rmd’

--- re-building ‘python_dependencies.Rmd’ using rmarkdown
--- finished re-building ‘python_dependencies.Rmd’

--- re-building ‘python_packages.Rmd’ using rmarkdown
--- finished re-building ‘python_packages.Rmd’

--- re-building ‘python_primer.Rmd’ using rmarkdown
Quitting from lines 155-176 (python_primer.Rmd) 
Error: processing vignette 'python_primer.Rmd' failed with diagnostics:
invalid syntax (<string>, line 12)
--- failed re-building ‘python_primer.Rmd’

--- re-building ‘r_markdown.Rmd’ using rmarkdown
--- finished re-building ‘r_markdown.Rmd’

--- re-building ‘versions.Rmd’ using rmarkdown
--- finished re-building ‘versions.Rmd’

SUMMARY: processing the following file failed:
  ‘python_primer.Rmd’

Error: Vignette re-building failed.
Execution halted

In some other packages, e.g. https://www.stats.ox.ac.uk/pub/bdr/M1mac/nmslibR.out

  > test_check("nmslibR")
  Error: '/usr/bin/python3' was not built with a shared library.
  reticulate can only bind to copies of Python built with '--enable-shared'.
  Execution halted
t-kalinowski commented 2 years ago

What is the relationship between https://www.stats.ox.ac.uk/pub/bdr/M1mac/reticulate.out and https://www.r-project.org/nosvn/R.check/r-release-macos-arm64/reticulate-00check.html ? In the latter run it looks like all checks passed.

kevinushey commented 2 years ago

That machine's setup is documented here: https://www.stats.ox.ac.uk/pub/bdr/M1mac/README.txt

t-kalinowski commented 2 years ago

Weird. There is no mention of python in that machine description. On my M1 Mac, the system python at /usr/bin/python3 is built as a shared library.

tomasz@ant [15:07:47] [~/Documents/GitHub/reticulate] [main *]
-> % RETICULATE_PYTHON=/usr/bin/python3 Rscript -e 'reticulate::py_config()'
python:         /usr/bin/python3
libpython:      /Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/config-3.8-darwin/libpython3.8.dylib
pythonhome:     /Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8:/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8
version:        3.8.9 (default, Oct 26 2021, 07:25:53)  [Clang 13.0.0 (clang-1300.0.29.30)]
numpy:           [NOT FOUND]

NOTE: Python version was forced by RETICULATE_PYTHON