rPython-win
rPython-win copied to clipboard
multi-architecture compile on windows
- updated docs, including need for options(rPython.paths=list(...))
- added .onLoad logic to add PYTHONHOME, PYTHONPATH, and update PATH (only if rPython.paths is set correctly)
- removed references to devtools (will not use options)
- removed configure files
- added makevars.win to change between 32-bit and 64-bit python directories and libraries
- updated cleanup file (one typo, added other compile directories)
This might satisfy #2 though I admit to not having tested it extensively with different python installation configurations.
This compiles cleanly and runs on my Windows 10 (64), R 3.2.3, python 2.7.11.
Command-line Multi-Arch Compilation
$ /c/R/R-3.2.3/bin/R CMD INSTALL --build .
Entering C:/Users/r2/Documents/Projects/github/rPython-win
* installing to library 'C:/Users/r2/R/win-library/3.2'
* installing *source* package 'rPython' ...
** libs
*** arch - i386
gcc -m32 -I"C:/R/R-3.2.3/include" -DNDEBUG -I"d:/RCompile/r-compiling/local/local323/include" -I"C:/Python27/i386/include" -O3 -Wall -std=gnu99 -mtune=core2 -c pycall.c -o pycall.o
gcc -m32 -shared -s -static-libgcc -o rPython.dll tmp.def pycall.o -LC:/python27/i386/libs -lpython27 -Ld:/RCompile/r-compiling/local/local323/lib/i386 -Ld:/RCompile/r-compiling/local/local323/lib -LC:/R/R-3.2.3/bin/i386 -lR
installing to C:/Users/r2/R/win-library/3.2/rPython/libs/i386
*** arch - x64
gcc -m64 -I"C:/R/R-3.2.3/include" -DNDEBUG -I"d:/RCompile/r-compiling/local/local323/include" -I"C:/Python27/x64/include" -O2 -Wall -std=gnu99 -mtune=core2 -c pycall.c -o pycall.o
gcc -m64 -shared -s -static-libgcc -o rPython.dll tmp.def pycall.o -LC:/python27/x64/libs -lpython27 -Ld:/RCompile/r-compiling/local/local323/lib/x64 -Ld:/RCompile/r-compiling/local/local323/lib -LC:/R/R-3.2.3/bin/x64 -lR
installing to C:/Users/r2/R/win-library/3.2/rPython/libs/x64
** R
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
*** arch - i386
Entering C:/Users/r2/Documents/Projects/github/rPython-win
Manually setting PYTHONHOME: /Python27/i386
Manually setting PYTHONPATH: /Python27/i386/Lib
*** arch - x64
Entering C:/Users/r2/Documents/Projects/github/rPython-win
Manually setting PYTHONHOME: /Python27/x64
Manually setting PYTHONPATH: /Python27/x64/Lib
* MD5 sums
packaged installation of 'rPython' as rPython_0.0-6.zip
* DONE (rPython)
32-bit R and Python
# R version 3.2.3 (2015-12-10) -- "Wooden Christmas-Tree"
# Copyright (C) 2015 The R Foundation for Statistical Computing
# Platform: i386-w64-mingw32/i386 (32-bit)
# ...
library(rPython)
# Loading required package: RJSONIO
# Manually setting PYTHONHOME: /Python27/i386
# Manually setting PYTHONPATH: /Python27/i386/Lib
python.exec('import platform')
python.get('platform.architecture()')
# [1] "32bit" "WindowsPE"
64-bit R and Python
# R version 3.2.3 (2015-12-10) -- "Wooden Christmas-Tree"
# Copyright (C) 2015 The R Foundation for Statistical Computing
# Platform: x86_64-w64-mingw32/x64 (64-bit)
# ...
library(rPython)
# Loading required package: RJSONIO
# Manually setting PYTHONHOME: /Python27/x64
# Manually setting PYTHONPATH: /Python27/x64/Lib
python.exec('import platform')
python.get('platform.architecture()')
# [1] "64bit" "WindowsPE"
TODO
- On package load, perhaps it should determine if the available python is 32-bit or 64-bit, and if not compatible, tell the user as such. For instance, if both 32-bit and 64-bit R libraries are available but the 64-bit python cannot be found, on package load it will likely cause R to crash.
- The munging of the current
PATHto update it is, well, a munge, and not immune from breakage. Perhaps this could be improved.