rpy2 / rpy2

Interface to use R from Python
https://rpy2.github.io
GNU General Public License v2.0
549 stars 72 forks source link

Can't build rpy2 with Visual C++ for Python on Windows 7 #354

Open lgautier opened 8 years ago

lgautier commented 8 years ago

Original report by Omar Bryan Khan (Bitbucket: obkhan, GitHub: obkhan).


#!python

Failed to build rpy2
Installing collected packages: rpy2
  Running setup.py install for rpy2 ... error
    Complete output from command C:\Users\myuser\AppData\Local\Continuum\Anacon
da2\python.exe -u -c "import setuptools, tokenize;__file__='c:\\users\\myuser\\
appdata\\local\\temp\\pip-build-80adxj\\rpy2\\setup.py';exec(compile(getattr(tok
enize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))"
 install --record c:\users\myuser\appdata\local\temp\pip-sqoxhr-record\install-
record.txt --single-version-externally-managed --compile:
    R version 3.2.4 (2016-03-10) -- "Very Secure Dishes"
    Copyright (C) 2016 The R Foundation for Statistical Computing
    Platform: x86_64-w64-mingw32/x64 (64-bit)

    R is free software and comes with ABSOLUTELY NO WARRANTY.
    You are welcome to redistribute it under the terms of the
    GNU General Public License versions 2 or 3.
    For more information about these matters see
    http://www.gnu.org/licenses/.

    R version 3.2.4 (2016-03-10) -- "Very Secure Dishes"
    C:\Users\myuser\AppData\Local\Programs\R-3.2.4\bin\x64\R CMD config --ldfla
gs
    C:\Users\myuser\AppData\Local\Programs\R-3.2.4\bin\x64\R CMD config --cppfl
ags

        Compilation parameters for rpy2's C components:
            include_dirs    = ['C:/Users/myuser/AppData/Local/Programs/R-3.2.4/
include', 'C:/Users/myuser/AppData/Local/Programs/R-3.2.4/include/x64']
            library_dirs    = ['C:/Users/myuser/AppData/Local/Programs/R-3.2.4/
bin/x64']
            libraries       = ['R', 'm']
            extra_link_args = ['-m64']

    running install
    running build
    running build_py
    creating build
    creating build\lib.win-amd64-2.7
    creating build\lib.win-amd64-2.7\rpy2
    copying .\rpy\rpy_classic.py -> build\lib.win-amd64-2.7\rpy2
    copying .\rpy\tests.py -> build\lib.win-amd64-2.7\rpy2
    copying .\rpy\tests_rpy_classic.py -> build\lib.win-amd64-2.7\rpy2
    copying .\rpy\__init__.py -> build\lib.win-amd64-2.7\rpy2
    creating build\lib.win-amd64-2.7\rpy2\rlike
    copying .\rpy\rlike\container.py -> build\lib.win-amd64-2.7\rpy2\rlike
    copying .\rpy\rlike\functional.py -> build\lib.win-amd64-2.7\rpy2\rlike
    copying .\rpy\rlike\indexing.py -> build\lib.win-amd64-2.7\rpy2\rlike
    copying .\rpy\rlike\__init__.py -> build\lib.win-amd64-2.7\rpy2\rlike
    creating build\lib.win-amd64-2.7\rpy2\rlike\tests
    copying .\rpy\rlike\tests\test_container.py -> build\lib.win-amd64-2.7\rpy2\
rlike\tests
    copying .\rpy\rlike\tests\test_functional.py -> build\lib.win-amd64-2.7\rpy2
\rlike\tests
    copying .\rpy\rlike\tests\test_indexing.py -> build\lib.win-amd64-2.7\rpy2\r
like\tests
    copying .\rpy\rlike\tests\__init__.py -> build\lib.win-amd64-2.7\rpy2\rlike\
tests
    creating build\lib.win-amd64-2.7\rpy2\rinterface
    copying .\rpy\rinterface\__init__.py -> build\lib.win-amd64-2.7\rpy2\rinterf
ace
    creating build\lib.win-amd64-2.7\rpy2\rinterface\tests
    copying .\rpy\rinterface\tests\test_Device.py -> build\lib.win-amd64-2.7\rpy
2\rinterface\tests
    copying .\rpy\rinterface\tests\test_EmbeddedR.py -> build\lib.win-amd64-2.7\
rpy2\rinterface\tests
    copying .\rpy\rinterface\tests\test_Sexp.py -> build\lib.win-amd64-2.7\rpy2\
rinterface\tests
    copying .\rpy\rinterface\tests\test_SexpClosure.py -> build\lib.win-amd64-2.
7\rpy2\rinterface\tests
    copying .\rpy\rinterface\tests\test_SexpEnvironment.py -> build\lib.win-amd6
4-2.7\rpy2\rinterface\tests
    copying .\rpy\rinterface\tests\test_SexpExtPtr.py -> build\lib.win-amd64-2.7
\rpy2\rinterface\tests
    copying .\rpy\rinterface\tests\test_SexpSymbol.py -> build\lib.win-amd64-2.7
\rpy2\rinterface\tests
    copying .\rpy\rinterface\tests\test_SexpVector.py -> build\lib.win-amd64-2.7
\rpy2\rinterface\tests
    copying .\rpy\rinterface\tests\test_SexpVectorNumeric.py -> build\lib.win-am
d64-2.7\rpy2\rinterface\tests
    copying .\rpy\rinterface\tests\__init__.py -> build\lib.win-amd64-2.7\rpy2\r
interface\tests
    creating build\lib.win-amd64-2.7\rpy2\robjects
    copying .\rpy\robjects\constants.py -> build\lib.win-amd64-2.7\rpy2\robjects

    copying .\rpy\robjects\conversion.py -> build\lib.win-amd64-2.7\rpy2\robject
s
    copying .\rpy\robjects\environments.py -> build\lib.win-amd64-2.7\rpy2\robje
cts
    copying .\rpy\robjects\functions.py -> build\lib.win-amd64-2.7\rpy2\robjects

    copying .\rpy\robjects\help.py -> build\lib.win-amd64-2.7\rpy2\robjects
    copying .\rpy\robjects\language.py -> build\lib.win-amd64-2.7\rpy2\robjects
    copying .\rpy\robjects\methods.py -> build\lib.win-amd64-2.7\rpy2\robjects
    copying .\rpy\robjects\numpy2ri.py -> build\lib.win-amd64-2.7\rpy2\robjects
    copying .\rpy\robjects\packages.py -> build\lib.win-amd64-2.7\rpy2\robjects
    copying .\rpy\robjects\packages_utils.py -> build\lib.win-amd64-2.7\rpy2\rob
jects
    copying .\rpy\robjects\pandas2ri.py -> build\lib.win-amd64-2.7\rpy2\robjects

    copying .\rpy\robjects\robject.py -> build\lib.win-amd64-2.7\rpy2\robjects
    copying .\rpy\robjects\vectors.py -> build\lib.win-amd64-2.7\rpy2\robjects
    copying .\rpy\robjects\__init__.py -> build\lib.win-amd64-2.7\rpy2\robjects
    creating build\lib.win-amd64-2.7\rpy2\robjects\tests
    copying .\rpy\robjects\tests\testArray.py -> build\lib.win-amd64-2.7\rpy2\ro
bjects\tests
    copying .\rpy\robjects\tests\testDataFrame.py -> build\lib.win-amd64-2.7\rpy
2\robjects\tests
    copying .\rpy\robjects\tests\testEnvironment.py -> build\lib.win-amd64-2.7\r
py2\robjects\tests
    copying .\rpy\robjects\tests\testFormula.py -> build\lib.win-amd64-2.7\rpy2\
robjects\tests
    copying .\rpy\robjects\tests\testFunction.py -> build\lib.win-amd64-2.7\rpy2
\robjects\tests
    copying .\rpy\robjects\tests\testHelp.py -> build\lib.win-amd64-2.7\rpy2\rob
jects\tests
    copying .\rpy\robjects\tests\testLanguage.py -> build\lib.win-amd64-2.7\rpy2
\robjects\tests
    copying .\rpy\robjects\tests\testMethods.py -> build\lib.win-amd64-2.7\rpy2\
robjects\tests
    copying .\rpy\robjects\tests\testNumpyConversions.py -> build\lib.win-amd64-
2.7\rpy2\robjects\tests
    copying .\rpy\robjects\tests\testPackages.py -> build\lib.win-amd64-2.7\rpy2
\robjects\tests
    copying .\rpy\robjects\tests\testPandasConversions.py -> build\lib.win-amd64
-2.7\rpy2\robjects\tests
    copying .\rpy\robjects\tests\testRObject.py -> build\lib.win-amd64-2.7\rpy2\
robjects\tests
    copying .\rpy\robjects\tests\testRobjects.py -> build\lib.win-amd64-2.7\rpy2
\robjects\tests
    copying .\rpy\robjects\tests\testVector.py -> build\lib.win-amd64-2.7\rpy2\r
objects\tests
    copying .\rpy\robjects\tests\__init__.py -> build\lib.win-amd64-2.7\rpy2\rob
jects\tests
    creating build\lib.win-amd64-2.7\rpy2\robjects\lib
    copying .\rpy\robjects\lib\dplyr.py -> build\lib.win-amd64-2.7\rpy2\robjects
\lib
    copying .\rpy\robjects\lib\ggplot2.py -> build\lib.win-amd64-2.7\rpy2\robjec
ts\lib
    copying .\rpy\robjects\lib\grid.py -> build\lib.win-amd64-2.7\rpy2\robjects\
lib
    copying .\rpy\robjects\lib\__init__.py -> build\lib.win-amd64-2.7\rpy2\robje
cts\lib
    creating build\lib.win-amd64-2.7\rpy2\robjects\lib\tests
    copying .\rpy\robjects\lib\tests\test_dplyr.py -> build\lib.win-amd64-2.7\rp
y2\robjects\lib\tests
    copying .\rpy\robjects\lib\tests\test_ggplot2.py -> build\lib.win-amd64-2.7\
rpy2\robjects\lib\tests
    copying .\rpy\robjects\lib\tests\__init__.py -> build\lib.win-amd64-2.7\rpy2
\robjects\lib\tests
    creating build\lib.win-amd64-2.7\rpy2\interactive
    copying .\rpy\interactive\packages.py -> build\lib.win-amd64-2.7\rpy2\intera
ctive
    copying .\rpy\interactive\process_revents.py -> build\lib.win-amd64-2.7\rpy2
\interactive
    copying .\rpy\interactive\__init__.py -> build\lib.win-amd64-2.7\rpy2\intera
ctive
    creating build\lib.win-amd64-2.7\rpy2\interactive\tests
    copying .\rpy\interactive\tests\__init__.py -> build\lib.win-amd64-2.7\rpy2\
interactive\tests
    creating build\lib.win-amd64-2.7\rpy2\ipython
    copying .\rpy\ipython\ggplot.py -> build\lib.win-amd64-2.7\rpy2\ipython
    copying .\rpy\ipython\html.py -> build\lib.win-amd64-2.7\rpy2\ipython
    copying .\rpy\ipython\rmagic.py -> build\lib.win-amd64-2.7\rpy2\ipython
    copying .\rpy\ipython\__init__.py -> build\lib.win-amd64-2.7\rpy2\ipython
    creating build\lib.win-amd64-2.7\rpy2\ipython\tests
    copying .\rpy\ipython\tests\test_rmagic.py -> build\lib.win-amd64-2.7\rpy2\i
python\tests
    copying .\rpy\ipython\tests\__init__.py -> build\lib.win-amd64-2.7\rpy2\ipyt
hon\tests
    running build_clib
    building 'r_utils' library
    creating build\temp.win-amd64-2.7
    creating build\temp.win-amd64-2.7\rpy
    creating build\temp.win-amd64-2.7\rpy\rinterface
    C:\Users\myuser\Downloads\VCPython27\SourceDir\Microsoft\Visual C++ for Pyt
hon\9.0\VC\Bin\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -I.\rpy\rinterface -I
C:/Users/myuser/AppData/Local/Programs/R-3.2.4/include -IC:/Users/myuser/AppDa
ta/Local/Programs/R-3.2.4/include/x64 /Tc.\rpy\rinterface\r_utils.c /Fobuild\tem
p.win-amd64-2.7\.\rpy\rinterface\r_utils.obj
    r_utils.c
    C:\Users\myuser\Downloads\VCPython27\SourceDir\Microsoft\Visual C++ for Pyt
hon\9.0\VC\Include\stdio.h(258) : warning C4068: unknown pragma
    C:\Users\myuser\Downloads\VCPython27\SourceDir\Microsoft\Visual C++ for Pyt
hon\9.0\VC\Include\stdio.h(259) : warning C4068: unknown pragma
    C:\Users\myuser\Downloads\VCPython27\SourceDir\Microsoft\Visual C++ for Pyt
hon\9.0\VC\Include\stdio.h(356) : warning C4068: unknown pragma
    C:\Users\myuser\Downloads\VCPython27\SourceDir\Microsoft\Visual C++ for Pyt
hon\9.0\VC\Include\stdio.h(357) : warning C4068: unknown pragma
    C:\Users\myuser\Downloads\VCPython27\SourceDir\Microsoft\Visual C++ for Pyt
hon\9.0\VC\Include\stdio.h(359) : warning C4068: unknown pragma
    C:\Users\myuser\Downloads\VCPython27\SourceDir\Microsoft\Visual C++ for Pyt
hon\9.0\VC\Include\stdio.h(364) : warning C4068: unknown pragma
    C:\Users\myuser\Downloads\VCPython27\SourceDir\Microsoft\Visual C++ for Pyt
hon\9.0\VC\Include\stdio.h(365) : warning C4068: unknown pragma
    C:\Users\myuser\Downloads\VCPython27\SourceDir\Microsoft\Visual C++ for Pyt
hon\9.0\VC\Include\stdio.h(367) : warning C4068: unknown pragma
    C:\Users\myuser\Downloads\VCPython27\SourceDir\Microsoft\Visual C++ for Pyt
hon\9.0\VC\Include\stdio.h(481) : warning C4068: unknown pragma
    C:\Users\myuser\Downloads\VCPython27\SourceDir\Microsoft\Visual C++ for Pyt
hon\9.0\VC\Include\stdio.h(482) : warning C4068: unknown pragma
    C:\Users\myuser\Downloads\VCPython27\SourceDir\Microsoft\Visual C++ for Pyt
hon\9.0\VC\Include\stdio.h(484) : warning C4068: unknown pragma
    C:\Users\myuser\Downloads\VCPython27\SourceDir\Microsoft\Visual C++ for Pyt
hon\9.0\VC\Include\stdio.h(537) : warning C4068: unknown pragma
    C:\Users\myuser\Downloads\VCPython27\SourceDir\Microsoft\Visual C++ for Pyt
hon\9.0\VC\Include\stdio.h(538) : warning C4068: unknown pragma
    C:\Users\myuser\Downloads\VCPython27\SourceDir\Microsoft\Visual C++ for Pyt
hon\9.0\VC\Include\stdio.h(539) : warning C4141: 'swprintf has been changed to c
onform with the ISO C standard, adding an extra character count parameter. To us
e traditional Microsoft swprintf, set _CRT_NON_CONFORMING_SWPRINTFS.' : used mor
e than once
    C:\Users\myuser\Downloads\VCPython27\SourceDir\Microsoft\Visual C++ for Pyt
hon\9.0\VC\Include\stdio.h(539) : warning C4141: 'swprintf has been changed to c
onform with the ISO C standard, adding an extra character count parameter. To us
e traditional Microsoft swprintf, set _CRT_NON_CONFORMING_SWPRINTFS.' : used mor
e than once
    C:\Users\myuser\Downloads\VCPython27\SourceDir\Microsoft\Visual C++ for Pyt
hon\9.0\VC\Include\stdio.h(540) : warning C4141: 'swprintf has been changed to c
onform with the ISO C standard, adding an extra character count parameter. To us
e traditional Microsoft swprintf, set _CRT_NON_CONFORMING_SWPRINTFS.' : used mor
e than once
    C:\Users\myuser\Downloads\VCPython27\SourceDir\Microsoft\Visual C++ for Pyt
hon\9.0\VC\Include\stdio.h(540) : warning C4141: 'swprintf has been changed to c
onform with the ISO C standard, adding an extra character count parameter. To us
e traditional Microsoft swprintf, set _CRT_NON_CONFORMING_SWPRINTFS.' : used mor
e than once
    C:\Users\myuser\Downloads\VCPython27\SourceDir\Microsoft\Visual C++ for Pyt
hon\9.0\VC\Include\stdio.h(541) : warning C4068: unknown pragma
    C:\Users\myuser\Downloads\VCPython27\SourceDir\Microsoft\Visual C++ for Pyt
hon\9.0\VC\Include\swprintf.inl(34) : warning C4068: unknown pragma
    C:\Users\myuser\Downloads\VCPython27\SourceDir\Microsoft\Visual C++ for Pyt
hon\9.0\VC\Include\swprintf.inl(35) : warning C4068: unknown pragma
    C:\Users\myuser\Downloads\VCPython27\SourceDir\Microsoft\Visual C++ for Pyt
hon\9.0\VC\Include\swprintf.inl(45) : warning C4068: unknown pragma
    C:\Users\myuser\Downloads\VCPython27\SourceDir\Microsoft\Visual C++ for Pyt
hon\9.0\VC\Include\swprintf.inl(47) : warning C4068: unknown pragma
    C:\Users\myuser\Downloads\VCPython27\SourceDir\Microsoft\Visual C++ for Pyt
hon\9.0\VC\Include\swprintf.inl(48) : warning C4068: unknown pragma
    C:\Users\myuser\Downloads\VCPython27\SourceDir\Microsoft\Visual C++ for Pyt
hon\9.0\VC\Include\swprintf.inl(53) : warning C4068: unknown pragma
    C:\Users\myuser\Downloads\VCPython27\SourceDir\Microsoft\Visual C++ for Pyt
hon\9.0\VC\Include\swprintf.inl(58) : warning C4068: unknown pragma
    C:\Users\myuser\Downloads\VCPython27\SourceDir\Microsoft\Visual C++ for Pyt
hon\9.0\VC\Include\swprintf.inl(59) : warning C4068: unknown pragma
    C:\Users\myuser\Downloads\VCPython27\SourceDir\Microsoft\Visual C++ for Pyt
hon\9.0\VC\Include\swprintf.inl(69) : warning C4068: unknown pragma
    C:\Users\myuser\Downloads\VCPython27\SourceDir\Microsoft\Visual C++ for Pyt
hon\9.0\VC\Include\swprintf.inl(71) : warning C4068: unknown pragma
    C:\Users\myuser\Downloads\VCPython27\SourceDir\Microsoft\Visual C++ for Pyt
hon\9.0\VC\Include\swprintf.inl(72) : warning C4068: unknown pragma
    C:\Users\myuser\Downloads\VCPython27\SourceDir\Microsoft\Visual C++ for Pyt
hon\9.0\VC\Include\swprintf.inl(77) : warning C4068: unknown pragma
    C:\Users\myuser\Downloads\VCPython27\SourceDir\Microsoft\Visual C++ for Pyt
hon\9.0\VC\Include\stdio.h(591) : warning C4068: unknown pragma
    .\rpy\rinterface\r_utils.c(164) : error C2275: 'SEXP' : illegal use of this
type as an expression
            C:/Users/myuser/AppData/Local/Programs/R-3.2.4/include\Rinternals.h
(438) : see declaration of 'SEXP'
    .\rpy\rinterface\r_utils.c(164) : error C2146: syntax error : missing ';' be
fore identifier 'result'
    .\rpy\rinterface\r_utils.c(164) : error C2065: 'result' : undeclared identif
ier
    .\rpy\rinterface\r_utils.c(164) : warning C4047: '=' : 'int' differs in leve
ls of indirection from 'SEXP'
    .\rpy\rinterface\r_utils.c(166) : error C2065: 'result' : undeclared identif
ier
    .\rpy\rinterface\r_utils.c(166) : warning C4047: 'return' : 'SEXP' differs i
n levels of indirection from 'int'
    .\rpy\rinterface\r_utils.c(180) : error C2275: 'SEXP' : illegal use of this
type as an expression
            C:/Users/myuser/AppData/Local/Programs/R-3.2.4/include\Rinternals.h
(438) : see declaration of 'SEXP'
    .\rpy\rinterface\r_utils.c(180) : error C2146: syntax error : missing ';' be
fore identifier 'result'
    .\rpy\rinterface\r_utils.c(180) : error C2065: 'result' : undeclared identif
ier
    .\rpy\rinterface\r_utils.c(180) : warning C4047: '=' : 'int' differs in leve
ls of indirection from 'SEXP'
    .\rpy\rinterface\r_utils.c(182) : error C2065: 'result' : undeclared identif
ier
    .\rpy\rinterface\r_utils.c(182) : warning C4047: 'return' : 'SEXP' differs i
n levels of indirection from 'int'
    .\rpy\rinterface\r_utils.c(236) : warning C4013: 'malloc' undefined; assumin
g extern returning int
    .\rpy\rinterface\r_utils.c(236) : warning C4047: 'initializing' : 'Externall
yManagedVector *' differs in levels of indirection from 'int'
    error: command 'C:\\Users\\myuser\\Downloads\\VCPython27\\SourceDir\\Micros
oft\\Visual C++ for Python\\9.0\\VC\\Bin\\cl.exe' failed with exit status 2

    ----------------------------------------
Command "C:\Users\myuser\AppData\Local\Continuum\Anaconda2\python.exe -u -c "im
port setuptools, tokenize;__file__='c:\\users\\myuser\\appdata\\local\\temp\\pi
p-build-80adxj\\rpy2\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__f
ile__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record c:\use
rs\myuser\appdata\local\temp\pip-sqoxhr-record\install-record.txt --single-vers
ion-externally-managed --compile" failed with error code 1 in c:\users\myuser\a
ppdata\local\temp\pip-build-80adxj\rpy2\

C:\Users\myuser\Downloads\VCPython27\SourceDir\Microsoft\Visual C++ for Python\
9.0\VC>
lgautier commented 8 years ago

Original comment by Laurent Gautier (Bitbucket: lgautier, GitHub: lgautier).


There is no official support for rpy2 on Windows. May be the community can help.

What I am seeing is that first error message is:

.\rpy\rinterface\r_utils.c(164) : error C2275: 'SEXP' : illegal use of this
type as an expression
            C:/Users/myuser/AppData/Local/Programs/R-3.2.4/include\Rinternals.h
(438) : see declaration of 'SEXP'

Back when I initially supported Windows, and if I remember it right, I had to use MinGW (R, or C extensions to R would not compile with MSVC++).

@cgohlke is contributing unofficial binaries, and I think most of rpy2's Windows users rely on these.

lgautier commented 8 years ago

Original comment by Omar Bryan Khan (Bitbucket: obkhan, GitHub: obkhan).


I did try Ming32 and ended up with the same error as ahjulsta : https://bitbucket.org/rpy2/rpy2/issues/261/installation-compilation-error-on-windows

That said the unofficial binaries found at cgohike - seem to work fine, and all I need - thanks! http://www.lfd.uci.edu/~gohlke/pythonlibs/#rpy2

lgautier commented 8 years ago

Original comment by Michael Gooch (Bitbucket: kotoroshinoto, GitHub: kotoroshinoto).


it looks like the official binary for python3.5+ are dependant on MS visual 2015 and aren't very compatible with mingw.

as such, somebody really ought to be compiling binary *.whl files and putting them up on pypi so windows users don't need to compiler, OR the source needs to be adjusted to issue msvc compiler commands when the system python compiler is set to MSVC and not mingw or gcc

lgautier commented 8 years ago

Original comment by Michael Gooch (Bitbucket: kotoroshinoto, GitHub: kotoroshinoto).


http://www.lfd.uci.edu/~gohlke/pythonlibs/#rpy2

this page seems to have a method worked out for doing it, perhaps ask the person who made these what they did

lgautier commented 8 years ago

Original comment by Laurent Gautier (Bitbucket: lgautier, GitHub: lgautier).


Back when made rpy2 binaries for Windows I used the stock Python (compiled with MSVC++) and built rpy2 with mingw (and the R tool chain to build C extensions for R). @cgohlke is currently making the only public Windows builds I know of, but I don't know what he is using.