Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

following lgautier's advice on rpy2 installation on Mac OSX, I posted my request on rpy-list and got in touch with Yair Benita who said he could only install rpy2 through his default Mac OS X python and wondered if I had not another version running.

In /usr/bin, I can actually find python, python2.5 and python2.6. Asking which python, the default one is /usr/bin/python. Running /usr/bin/python, I get that:

Python 2.6.1 (r261:67515, Jun 24 2010, 21:47:49)    
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin    
Type "help", "copyright", "credits" or "license" for more information

I get the same answer running /usr/bin/python2.6

Is that ok or should I define a specific PYTHONPATH in my ~/.profile file?


Yair also suggested I defined the R variables correctly in my ~/.profile file:

export R_LIBS=/Library/Frameworks/R.framework/Versions/2.14/Resources/library export R_HOME=/Library/Frameworks/R.framework/Versions/2.14/Resources

That didn't work either.


He finally stated I had a not found error he coudn't see.

Here is the log message I get running python setup.py build :

running build
running build_py
running build_ext
Configuration for R as a library:
  include_dirs: ('/Library/Frameworks/R.framework/Resources/include', '/Library/Frameworks/R.framework/Resources/include/x86_64')
  libraries: ('Rblas', 'Rlapack')
  library_dirs: ('/Library/Frameworks/R.framework/Resources/lib/x86_64',)
  extra_link_args: ('-framework R', '-F/Library/Frameworks/R.framework/..')
 # OSX-specific (included in extra_link_args)
  framework_dirs: ('-F/Library/Frameworks/R.framework/..',)
  frameworks: ('-framework R',)
building 'rpy2.rinterface._rinterface' extension
gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch ppc -arch x86_64 -pipe -DR_INTERFACE_PTRS=1 -DHAVE_POSIX_SIGJMP=1 -DRIF_HAS_RSIGHAND=1 -DCSTACK_DEFNS=1 -I./rpy/rinterface -I/System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6 -I/Library/Frameworks/R.framework/Resources/include -I/Library/Frameworks/R.framework/Resources/include/x86_64 -c ./rpy/rinterface/_rinterface.c -o build/temp.macosx-10.6-universal-2.6/./rpy/rinterface/_rinterface.o
In file included from ./rpy/rinterface/_rinterface.c:63:
/Library/Frameworks/R.framework/Resources/include/Rinternals.h:657: warning: function declaration isn’t a prototype
In file included from ./rpy/rinterface/_rinterface.c:79:
/Library/Frameworks/R.framework/Resources/include/R_ext/Rdynload.h:26: warning: function declaration isn’t a prototype
In file included from ./rpy/rinterface/_rinterface.c:132:
./rpy/rinterface/sequence.c: In function ‘VectorSexp_ass_slice’:
./rpy/rinterface/sequence.c:542: warning: unused variable ‘sexp_item’
./rpy/rinterface/sequence.c:542: warning: unused variable ‘tmp’
./rpy/rinterface/sequence.c:541: warning: unused variable ‘vs’
./rpy/rinterface/sequence.c:478: warning: unused variable ‘self_typeof’
./rpy/rinterface/_rinterface.c: At top level:
./rpy/rinterface/sequence.c:2173: warning: ‘ComplexVectorSexp_AsSexp’ defined but not used
./rpy/rinterface/_rinterface.c: In function ‘EmbeddedR_ShowFiles’:
./rpy/rinterface/_rinterface.c:748: warning: ‘gstate’ may be used uninitialized in this function
./rpy/rinterface/_rinterface.c: In function ‘EmbeddedR_FlushConsole’:
./rpy/rinterface/_rinterface.c:602: warning: ‘gstate’ may be used uninitialized in this function
./rpy/rinterface/_rinterface.c: In function ‘EmbeddedR_ReadConsole’:
./rpy/rinterface/_rinterface.c:470: warning: ‘gstate’ may be used uninitialized in this function
./rpy/rinterface/_rinterface.c: In function ‘EmbeddedR_WriteConsole’:
./rpy/rinterface/_rinterface.c:328: warning: ‘gstate’ may be used uninitialized in this function
./rpy/rinterface/_rinterface.c: In function ‘EmbeddedR_ShowMessage’:
./rpy/rinterface/_rinterface.c:402: warning: ‘gstate’ may be used uninitialized in this function
./rpy/rinterface/_rinterface.c: In function ‘EmbeddedR_CleanUp’:
./rpy/rinterface/_rinterface.c:896: warning: ‘gstate’ may be used uninitialized in this function
./rpy/rinterface/_rinterface.c: In function ‘EmbeddedR_ChooseFile’:
./rpy/rinterface/_rinterface.c:646: warning: ‘gstate’ may be used uninitialized in this function
In file included from /Library/Frameworks/R.framework/Resources/include/R.h:34,
                 from ./rpy/rinterface/_rinterface.c:61:
/Library/Frameworks/R.framework/Resources/include/Rconfig.h:5:25: error: ppc/Rconfig.h: No such file or directory
In file included from ./rpy/rinterface/_rinterface.c:62:
/Library/Frameworks/R.framework/Resources/include/Rversion.h:5:26: error: ppc/Rversion.h: No such file or directory
In file included from ./rpy/rinterface/_rinterface.c:63:
/Library/Frameworks/R.framework/Resources/include/Rinternals.h:657: warning: function declaration isn’t a prototype
In file included from ./rpy/rinterface/_rinterface.c:79:
/Library/Frameworks/R.framework/Resources/include/R_ext/Rdynload.h:26: warning: function declaration isn’t a prototype
In file included from ./rpy/rinterface/_rinterface.c:110:
./rpy/rinterface/r_utils.h:13: error: ‘R_MAJOR’ undeclared here (not in a function)
./rpy/rinterface/r_utils.h:13: error: ‘R_MINOR’ undeclared here (not in a function)
./rpy/rinterface/r_utils.h:13: error: ‘R_STATUS’ undeclared here (not in a function)
./rpy/rinterface/r_utils.h:14: error: ‘R_SVN_REVISION’ undeclared here (not in a function)
In file included from ./rpy/rinterface/_rinterface.c:132:
./rpy/rinterface/sequence.c: In function ‘VectorSexp_ass_slice’:
./rpy/rinterface/sequence.c:542: warning: unused variable ‘sexp_item’
./rpy/rinterface/sequence.c:542: warning: unused variable ‘tmp’
./rpy/rinterface/sequence.c:541: warning: unused variable ‘vs’
./rpy/rinterface/sequence.c:478: warning: unused variable ‘self_typeof’
In file included from ./rpy/rinterface/_rinterface.c:63:
/Library/Frameworks/R.framework/Resources/include/Rinternals.h:657: warning: function declaration isn’t a prototype
In file included from ./rpy/rinterface/_rinterface.c:79:
/Library/Frameworks/R.framework/Resources/include/R_ext/Rdynload.h:26: warning: function declaration isn’t a prototype
In file included from ./rpy/rinterface/_rinterface.c:132:
./rpy/rinterface/sequence.c: In function ‘VectorSexp_ass_slice’:
./rpy/rinterface/sequence.c:542: warning: unused variable ‘sexp_item’
./rpy/rinterface/sequence.c:542: warning: unused variable ‘tmp’
./rpy/rinterface/sequence.c:541: warning: unused variable ‘vs’
./rpy/rinterface/sequence.c:478: warning: unused variable ‘self_typeof’
./rpy/rinterface/_rinterface.c: At top level:
./rpy/rinterface/sequence.c:2173: warning: ‘ComplexVectorSexp_AsSexp’ defined but not used
./rpy/rinterface/_rinterface.c: In function ‘EmbeddedR_ShowFiles’:
./rpy/rinterface/_rinterface.c:748: warning: ‘gstate’ may be used uninitialized in this function
./rpy/rinterface/_rinterface.c: In function ‘EmbeddedR_FlushConsole’:
./rpy/rinterface/_rinterface.c:602: warning: ‘gstate’ may be used uninitialized in this function
./rpy/rinterface/_rinterface.c: In function ‘EmbeddedR_ReadConsole’:
./rpy/rinterface/_rinterface.c:470: warning: ‘gstate’ may be used uninitialized in this function
./rpy/rinterface/_rinterface.c: In function ‘EmbeddedR_WriteConsole’:
./rpy/rinterface/_rinterface.c:328: warning: ‘gstate’ may be used uninitialized in this function
./rpy/rinterface/_rinterface.c: In function ‘EmbeddedR_ShowMessage’:
./rpy/rinterface/_rinterface.c:402: warning: ‘gstate’ may be used uninitialized in this function
./rpy/rinterface/_rinterface.c: In function ‘EmbeddedR_CleanUp’:
./rpy/rinterface/_rinterface.c:896: warning: ‘gstate’ may be used uninitialized in this function
./rpy/rinterface/_rinterface.c: In function ‘EmbeddedR_ChooseFile’:
./rpy/rinterface/_rinterface.c:646: warning: ‘gstate’ may be used uninitialized in this function
lipo: can't open input file: /var/folders/5L/5Li0yCI7EqmkqJ+Ra--M9U+++TI/-Tmp-//cchTMCy0.out (No such file or directory)
error: command 'gcc-4.2' failed with exit status 1

I also tryed to install rpy2 through Macport with sudo port install py26-rpy2and got the following error message:

--->  Computing dependencies for py26-rpy2
--->  Dependencies to be installed: R cairo glib2 libpixman libpng xorg-xcb-util xorg-libxcb python27 db46 libedit openssl python_select sqlite3 xorg-libXau xorg-xproto xorg-libXdmcp xorg-libpthread-stubs xorg-xcb-proto xrender xorg-libX11 xorg-kbproto xorg-renderproto gcc45 cctools cctools-headers llvm-3.0 llvm_select gcc_select gmp ld64 libmpc mpfr ppl glpk icu jpeg pango Xft2 gobject-introspection readline tcl tiff tk xorg-libXScrnSaver xorg-libXext xorg-xextproto xorg-scrnsaverproto xorg-libXmu xorg-libXt xorg-libsm xorg-libice python26
--->  Applying patches to glib2
Error: org.macports.patch for port glib2 returned: command execution failed
Error: Failed to install glib2
Please see the log file for port glib2 for details:
    /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_glib2/glib2/main.log
Error: The following dependencies were not installed: R cairo glib2 libpixman libpng xorg-xcb-util xorg-libxcb python27 db46 libedit openssl python_select sqlite3 xorg-libXau xorg-xproto xorg-libXdmcp xorg-libpthread-stubs xorg-xcb-proto xrender xorg-libX11 xorg-kbproto xorg-renderproto gcc45 cctools cctools-headers llvm-3.0 llvm_select gcc_select gmp ld64 libmpc mpfr ppl glpk icu jpeg pango Xft2 gobject-introspection readline tcl tiff tk xorg-libXScrnSaver xorg-libXext xorg-xextproto xorg-scrnsaverproto xorg-libXmu xorg-libXt xorg-libsm xorg-libice python26
To report a bug, follow the instructions in the guide:
    http://guide.macports.org/#project.tickets
Error: Processing of port py26-rpy2 failed

And on the log file for glib2 :

version:1
:debug:main changing euid/egid - current euid: 0 - current egid: 0
:debug:main egid changed to: 502
:debug:main euid changed to: 502
:debug:main Executing org.macports.main (glib2)
:debug:main Privilege de-escalation not attempted as not running as root.
:debug:main Skipping completed org.macports.archivefetch (glib2)
:debug:main Privilege de-escalation not attempted as not running as root.
:debug:main Skipping completed org.macports.fetch (glib2)
:debug:main Privilege de-escalation not attempted as not running as root.
:debug:main Skipping completed org.macports.checksum (glib2)
:debug:main Privilege de-escalation not attempted as not running as root.
:debug:main Skipping completed org.macports.extract (glib2)
:debug:main Privilege de-escalation not attempted as not running as root.
:debug:patch patch phase started at Mon Jul 16 11:43:43 CEST 2012
:debug:patch Executing org.macports.patch (glib2)
:notice:patch --->  Applying patches to glib2
:info:patch --->  Applying patch-configure.diff
:debug:patch Environment: CPATH='/opt/local/include' CC_PRINT_OPTIONS_FILE='/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_glib2/glib2/work/.CC_PRINT_OPTIONS' LIBRARY_PATH='/opt/local/lib' CC_PRINT_OPTIONS='YES' MACOSX_DEPLOYMENT_TARGET='10.6'
:debug:patch Assembled command: 'cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_glib2/glib2/work/glib-2.32.3" && /usr/bin/patch -p0'
:debug:patch Executing command line:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_glib2/glib2/work/glib-2.32.3" && /usr/bin/patch -p0 < '/opt/local/var/macports/sources/rsync.macports.org/release/tarballs/ports/devel/glib2/files/patch-configure.diff'
:info:patch sh: line 0: cd: /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_glib2/glib2/work/glib-2.32.3: No such file or directory
:info:patch Command failed:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_glib2/glib2/work/glib-2.32.3" && /usr/bin/patch -p0 < '/opt/local/var/macports/sources/rsync.macports.org/release/tarballs/ports/devel/glib2/files/patch-configure.diff'
:info:patch Exit code: 1
:error:patch org.macports.patch for port glib2 returned: command execution failed
:debug:patch Error code: CHILDSTATUS 4581 1
:debug:patch Backtrace: command execution failed
    while executing
"system $fullcmdstring"
    ("eval" body line 1)
    invoked from within
"eval system $notty $nice \$fullcmdstring"
    invoked from within
"command_exec patch "" "< '$patch'""
    (procedure "portpatch::patch_main" line 35)
    invoked from within
"$procedure $targetname"
:info:patch Warning: targets not executed for glib2: org.macports.activate org.macports.patch org.macports.configure org.macports.build org.macports.destroot org.macports.install
:error:patch Failed to install glib2
:debug:patch couldn't open "/System/Library/Frameworks/Tcl.framework/Versions/8.5/Resources/tclIndex": no such file or directory
    while executing
"open [file join $dir tclIndex]"
:notice:patch Please see the log file for port glib2 for details:
    /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_glib2/glib2/main.log

Has anybody another idea about what I could try ?

Thanks a lot

stan

share|improve this question

closed as off topic by Mapperz Jul 17 '12 at 13:27

Questions on Geographic Information Systems Stack Exchange are expected to relate to geographic information systems within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

add comment

2 Answers 2

I have two suggestions, one for each approach:

Build it yourself: try with a newer gcc, as 4.2 is old by now and there have been many bugfixes since. Maybe rpy2 even supports building with LLVM (clang or gcc) and you have another risky option.

It baffles me how you could come so far, since the second bit suggest you don't have all the dependencies yet.

Macports: where you got stuck has nothing to do with rpy2 directly. There appears to be a bug in the glib2 package and you should report it like the error suggested. ryandesign is the maintainer, but I couldn't find any public email you could include in the report directly.

share|improve this answer
add comment

If you can not build/install rpy2, go to Kyngchaos and download RPy2 2.2.6-1 for R 2.15

If you want to build/install rpy2 yourself:

  • you need to install the complete R package from R but also Gfortran (from Tools - R for Mac OS X)
  • type R in the terminal, if nothing happens, is that R is not well installed.
  • you must have R/usr/bin (/usr/bin/R): it is a symbolic link to /Library/Frameworks/R.framework/Versions/2.xx/Resources/bin/R64 created by the official installer of R
  • if R is well installed, all the paths are fixed and no need to specify export R_LIBS but only export R_HOME=/Library/Frameworks/R.framework/Resources
  • after that, no problem, use python setup.py build (to check) - sudo python setup.py install
share|improve this answer
    
That's what I desperatly looked for! And it did worked provided I installed the latest 2.15 version of R. Thanks all. Yet, SDA4PP plugin in Quantum-GIS keeps crashing everytime I try to launch any tools, even though I've installed R-packages dependencies... –  Stanislas Rebaudet Jul 16 '12 at 16:16
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.