Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing rpy2 on MacOS

Tags:

python

pip

r

rpy2

I've been trying to install RPy2 on MacOS Sierra, for Python 3.6 but the pip installation fails without compiling.

The installation errors out with the message:

  clang: error: unsupported option '-fopenmp'
  error: command 'clang' failed with exit status 1

Any help with the installation would be appreciated.

like image 834
zenofsahil Avatar asked Sep 17 '18 06:09

zenofsahil


People also ask

Do I need to install R to use rpy2?

rpy2 will typically require an R version that is not much older than itself. This means that even if your system has R pre-installed, there is a chance that the version is too old to be compaible with rpy2. At the time of this writing, the latest rpy2 version is 2.8 and requires R 3.2 or higher.

What version of R does rpy2 use?

Installing rpy2 You must have Python >=3.7 and R >= 4.0 installed to use rpy2 3.5. 2. Once R is installed, install the rpy2 package by running pip install rpy2 . If you'd like to see where you installed rpy2 on your machine, you can run python -m rpy2.

What is rpy2 in Python?

rpy2 is an interface to R running embedded in a Python process. on Pypi. Questions and issues. Consider having a look at the documentation. Otherwise questions should preferably be asked on the rpy mailing-list on SourceForge, or on StackOverflow.


1 Answers

Found the solution in this thread.

env CC=/usr/local/Cellar/gcc/X.x.x/bin/gcc-X pip install rpy2

Running the above command by replacing the gcc version with the latest version on your machine should solve the problem. For example, on my mac, I ran

env CC=/usr/local/Cellar/gcc/8.2.0/bin/gcc-8 pip install rpy2

like image 105
zenofsahil Avatar answered Sep 23 '22 02:09

zenofsahil