Repository navigation
Open
Description
I followed the instruction, but got compilation error on Windows 7 64bit. Has anyone confirmed that rPython works on on 64bit PC with 64bit R? If so, then I must have missed something. Any suggestions on what else I should check?
BTW, I am using Anaconda python 3.4 distribution. My configure.win looks like the following:
#!/bin/sh
echo 'PKG_LIBS=-LC:/Anaconda3/libs -lpython34' > src/makevars.win
echo 'PKG_CFLAGS=-I"C:/Anaconda3/include"' >> src/makevars.win
I used RStudio, and here is the commands and outputs:
> library(devtools)
> install("C:/Downloads/rPython")
Installing rPython
"C:/R/R-31~1.2/bin/x64/R" --vanilla CMD INSTALL "C:/Downloads/rPython" \
--library="C:/R/R-3.1.2/library" --install-tests
* installing *source* package 'rPython' ...
** libs
Warning: this package has a non-empty 'configure.win' file,
so building only the main architecture
gcc -m64 -shared -s -static-libgcc -o rPython.dll tmp.def pycall.o -LC:/Anaconda3/libs -lpython34 -Ld:/RCompile/CRANpkg/extralibs64/local/lib/x64 -Ld:/RCompile/CRANpkg/extralibs64/local/lib -LC:/R/R-31~1.2/bin/x64 -lR
c:/rtools/gcc-4.6.3/bin/../lib/gcc/i686-w64-mingw32/4.6.3/../../../../i686-w64-mingw32/bin/ld.exe: i386 architecture of input file `pycall.o' is incompatible with i386:x86-64 output
pycall.o:pycall.c:(.text+0x5): undefined reference to `__imp__Py_Initialize'
pycall.o:pycall.c:(.text+0x1a): undefined reference to `__imp__PyRun_SimpleStringFlags'
pycall.o:pycall.c:(.text+0x31): undefined reference to `__imp__Py_Finalize'
pycall.o:pycall.c:(.text+0x56): undefined reference to `__imp__PyRun_SimpleStringFlags'
pycall.o:pycall.c:(.text+0x8c): undefined reference to `__imp__PyImport_AddModule'
pycall.o:pycall.c:(.text+0x95): undefined reference to `__imp__PyModule_GetDict'
pycall.o:pycall.c:(.text+0xa8): undefined reference to `__imp__PyDict_GetItemString'
pycall.o:pycall.c:(.text+0xbe): undefined reference to `__imp__PyBytes_AsString'
collect2: ld returned 1 exit status
no DLL was created
ERROR: compilation failed for package 'rPython'
* removing 'C:/R/R-3.1.2/library/rPython'
Error: Command failed (1)
Just an update, I tried it on Windows XP 32bit (with Anaconda python 2.7) and the installation was successful. I'll try to run some code and see if everything is working.
> library(devtools)
> install("C:/Downloads/rPython")
Installing rPython
"C:/R/R-31~1.2/bin/i386/R" --vanilla CMD INSTALL "C:/Downloads/rPython" \
--library="C:/R/R-3.1.2/library" --install-tests
* installing *source* package 'rPython' ...
** libs
Warning: this package has a non-empty 'configure.win' file,
so building only the main architecture
gcc -m32 -I"C:/R/R-31~1.2/include" -DNDEBUG -I"d:/RCompile/CRANpkg/extralibs64/local/include" -I"C:/Anaconda/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:/Anaconda/libs -lpython27 -Ld:/RCompile/CRANpkg/extralibs64/local/lib/i386 -Ld:/RCompile/CRANpkg/extralibs64/local/lib -LC:/R/R-31~1.2/bin/i386 -lR
installing to C:/R/R-3.1.2/library/rPython/libs/i386
** R
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
* DONE (rPython)
Metadata
Metadata
Assignees
Labels
No labels
Activity
cjgb commentedon Jun 22, 2015
I had a look at the problem (not on Windows, but the issue also applies there) and I wrote what I found out at http://www.datanalytics.com/2015/06/22/rpython-anaconda/
The problem seems to be related to whether Anaconda's Python dll are found when you load the package or not.
Frikster commentedon Oct 13, 2015
I have what appears to be the same problem. Though I tried installing Python 2.7 for 32-bit via Anaconda and pointing the configure.win to that but it still wont work (Same 64 bit PC. That shouldn't be a problem, right? I have both Program Files and Program Files (x86) so I should be able to use python 32-bit?). Any other ideas?
bhuston commentedon Oct 27, 2015
Just tried installing on a windows 10 machine (Rstudio x64 version). My install seems to be failing for a slightly different reason though..
install("C:/Users/bbhus_000/Downloads/rPython")
Installing rPython
"C:/PROGRA
1/R/R-321.1/bin/x64/R" --no-site-file--no-environ --no-save --no-restore CMD INSTALL
"C:/Users/bbhus_000/Downloads/rPython"
--library="C:/Users/bbhus_000/Documents/R/win-library/3.2"
--install-tests
Warning: running command 'sh ./configure.win' had status 127
ERROR: configuration failed for package 'rPython'
Error: Command failed (1)
mkoohafkan commentedon Nov 17, 2015
I get the same error as @bhuston on win7x64. My case may be a bit different though as I am trying to use rPython with the Python 2.7 distribution installed by ArcGIS (it is the only python distribution installed on my machine). I will test on my win10x64 machine later to see if the same error occurs.
Really excited about this package, I hope I can get it working---you're doing great work @cjgb!
bwanaaa commentedon Dec 21, 2015
trying to install rPython into R 3.1.3, win 7 Pro, Anaconda Python 3.5
i get as far as install("C:/rPython")
then this error:
cannot find -lpython35.lib
collect2: ld returned 1 exit status
no DLL was created
ERROR: compilation failed for package 'rPython'
Error: Command failed (1)
My configure.win file is:
#!/bin/sh
echo 'PKG_LIBS=-LC:\Anaconda3\libs -l python35' > src/makevars.win
echo 'PKG_CFLAGS=-I"C:Anaconda3\include"' >> src/makevars.win
I got it to work by changing backslashes to forward slashes like so:
#!/bin/sh
echo 'PKG_LIBS=-LC:/Anaconda3/libs -lpython35' > src/makevars.win
echo 'PKG_CFLAGS=-I"C:/Anaconda3/include"' >> src/makevars.win
Hope this helps.
arielfuentes commentedon Dec 31, 2015
I have python27 in win 64bits machine and I get the following:
ImportError: No module named site
ERROR: loading failed
davidljung commentedon Feb 9, 2016
Similar result Win7, Anaconda 2.4.0 (64 bit) Python 2.7.11:
Didn't seem to give any error output from gcc, but there is no rPython folder in C:\Program Files\R\R-3.2.3\library as that "installing to" line claimed.
isra312 commentedon May 16, 2016
I was able to run it on Windows 10 64 bits. I'm using Python27 that I downloaded straight from Python.org.
I have also gotten "ImportError: No module named site
ERROR: loading failed".
I solved that creating a system environment variable called PYTHONHOME and set it to the python path (in my case: "c:\Python27"). So I restarted R and ran install(".../rPython") again.
source: http://kb.froglogic.com/pages/viewpage.action?pageId=2457937
kishorekumar2127 commentedon Jun 8, 2016
worked well :-)
kishorekumar2127 commentedon Jun 8, 2016
Thanks
hephaestus9 commentedon Jun 26, 2016
I received the same error as grandtiger, and I got around it by installing the 32bit version of r, deleting my rPython directory, and unzipping it again. The install worked properly once I was using 32bit r and 32bit python27.
Necla commentedon Oct 9, 2017
I am very new to R. I am applying all the step the same but still the same problem. Could u pls help me? I
Installing rPython
"C:/PROGRA
1/R/R-341.2/bin/x64/R" --no-site-file --no-environ --no-save --no-restore --quiet CMD INSTALL "C:/Users/Necla/Downloads/rPython"--library="C:/Users/Necla/Documents/R/win-library/3.4" --install-tests
** libs
Warning: this package has a non-empty 'configure.win' file,
so building only the main architecture
C:/RBuildTools/3.3/mingw_64/bin/gcc -I"C:/PROGRA
1/R/R-341.2/include" -DNDEBUG -I"d:/Compiler/gcc-4.9.3/local330/include" -I"C:/Python27/include" -O2 -Wall -std=gnu99 -mtune=core2 -c pycall.c -o pycall.oC:/RBuildTools/3.3/mingw_64/bin/gcc -shared -s -static-libgcc -o rPython.dll tmp.def pycall.o -LC:/python27/libs -lpython27 -Ld:/Compiler/gcc-4.9.3/local330/lib/x64 -Ld:/Compiler/gcc-4.9.3/local330/lib -LC:/PROGRA
1/R/R-341.2/bin/x64 -lRC:/RBuildTools/3.3/mingw_64/bin/../lib/gcc/x86_64-w64-mingw32/4.9.3/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/python27/libs/libpython27.a when searching for -lpython27
C:/RBuildTools/3.3/mingw_64/bin/../lib/gcc/x86_64-w64-mingw32/4.9.3/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/python27/libs/python27.lib when searching for -lpython27
C:/RBuildTools/3.3/mingw_64/bin/../lib/gcc/x86_64-w64-mingw32/4.9.3/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/python27/libs\libpython27.a when searching for -lpython27
C:/RBuildTools/3.3/mingw_64/bin/../lib/gcc/x86_64-w64-mingw32/4.9.3/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/python27/libs/libpython27.a when searching for -lpython27
C:/RBuildTools/3.3/mingw_64/bin/../lib/gcc/x86_64-w64-mingw32/4.9.3/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/python27/libs/python27.lib when searching for -lpython27
C:/RBuildTools/3.3/mingw_64/bin/../lib/gcc/x86_64-w64-mingw32/4.9.3/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/python27/libs\python27.lib when searching for -lpython27
C:/RBuildTools/3.3/mingw_64/bin/../lib/gcc/x86_64-w64-mingw32/4.9.3/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lpython27
collect2.exe: error: ld returned 1 exit status
no DLL was created
ERROR: compilation failed for package 'rPython'
Error: Command failed (1)
RaoTianlong commentedon Dec 21, 2017
@mkoohafkan thank you so so so much!!! it works!
mannimann commentedon Jan 16, 2018
@Necla I had the same error. I finaly got it working by only installing the 32bit version of R (and same with Python ofc). Hope this helps
LuigiPon commentedon Apr 16, 2020
I am experiencing the same error as grandtiger. I use windows 10 64 bits, Python 3.7.6 and R 3.6.1
In the folder "libs" there are 3 files: libpython37.a python3.lib and python37
Which one should I refer to in the configure.win line
echo 'PKG_LIBS=-LC:/Anaconda3/libs -lpython34' > src/makevars.win
my line so far looks like this
echo 'PKG_LIBS=-L"C:/Program Files(x86)/Python37-32/libs -libpython37.a"' > src/makevars.win
echo 'PKG_CFLAGS=-I"C:/Program Files (x86)/Python37-32/include"' >> src/makevars.win
Note that I had to include a " for the libs path too, otherwise I was getting a different error. Something like unexpected symbol ')"
Does anybody have a solution?