3

I'm running Mountain Lion which has Python 2.7.2 installed by default. I've set up a new virtual Python environment using this version of Python. I install a few packages using pip install such as numpy, matplotlib, ipython, and a few others. I've been trying to develop a script to load data from R and so I also install rpy2. When I start up Python in the terminal, I can import all the installed packages (e.g. numpy, matplotlib, etc.) and there are no problems. But when I enter either:

import pandas.rpy.common as com

or

import rpy2.robjects as objects

and then exit() from Python, there is a segmentation fault 11 reported. This might not be too much of a problem is I were to enter each command separately at the Python prompt since the commands seem to be working OK. However, I can't run the commands as part of a longer script because the fault seems to cause the script to stop prematurely.

The version of pandas that is installed is 0.14.1 (previously 0.14.0 – same problem). The version of R is 3.1.1. I've tried reinstalling R and recreating new virtual environments with new installations of all the packages.

There's a lot of discussion about segmentation fault 11 resulting from changes introduced in Mavericks. But, I assume those issues shouldn't affect Mountion Lion. Any suggestions would be gratefully received.

user1718097
  • 4,090
  • 11
  • 48
  • 63
  • 1
    From past reports of such problems, the answer was almost invariably: don't use OS X system's Python, but one you install yourself. – lgautier Jul 12 '14 at 13:07
  • Thanks for the tip. I tried using Python 2.7.8 that I installed using Fink (I really like Fink). I created a virtual environment using "virtualenv -p /sw/bin/python env" but then I had trouble getting matplotlib to install. For some reason it failed to compile (although other packages such as numpy had no problems). Perhaps that should be another question. – user1718097 Jul 12 '14 at 15:56
  • I tried installing a brand new Python (2.7.8) using the .dmg at Python.org. Used virtualenv to create a new environment using the newly installed version of Python. But still get the same segmentation fault 11. – user1718097 Jul 16 '14 at 20:23
  • File a bug report. I do not currently have access to an OS X system on which I could do rpy2 development, but someone else might be able to help. – lgautier Jul 17 '14 at 02:59

1 Answers1

0

On machines where a system R is installed (e.g with RStudio) together with rpy2 installed in an environment (e.g conda), the system one is used, and that might not be compatible with the one rpy2 was built with, causing seg faults. To diagnose if you have different R version which rpy2 is bundeled with, run:

import rpy2
for row in rpy2.situation.iter_info():
    print(row)

See more info in this answer.

Eitan Rousso
  • 181
  • 1
  • 5