Installing rpy2 on MacOS

Viewed 3598

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.

3 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

If you have the python package wheel installed, pip install should fetch the pre-compiled binary for OS X, I believe.

Related