Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing gmpy on OSX - mpc.h not found

I have brew installed mpcand gmp , but when I try to pip install gmpy2 I get a compile error on the line

#include "mpc.h"

so for some reason clang is having trouble finding the mpc library. I'm not sure what I should do at this point.

like image 463
Jakob Weisblat Avatar asked Apr 20 '14 21:04

Jakob Weisblat


3 Answers

For OSX with homebrew users - I tried to do the usual dance with

brew install mpc
brew install mpfr

and then

python setup.py --prefix=/usr/local/Cellar

but got the error, that 'mpc.h' could not be found. True enough, there is no mpc.h file to be found. The solution is, to use

brew install libmpc
brew install mpfr

instead. After that gmpy2 was compiling and installing with no further problems.

like image 111
Werner Thie Avatar answered Oct 13 '22 21:10

Werner Thie


The short and sweet 2015 answer:

brew install mpfr
brew install libmpc
pip install gmpy2
like image 17
wim Avatar answered Oct 13 '22 20:10

wim


I'm the maintainer for gmpy2. I don't have access to a Mac so I can't test OSX builds.

I assume you've also installed mpfr since it is a prerequisite of mpc. Where are the development files (i.e. gmp.h, mpfr.h, and mpc.h) located?

Instead of installing via pip, can you try installing from the command line? I use a command similar to:

python setup.py install --prefix=/opt/local --force

This command assumes that the .h files are located in /opt/local/include. You will need to adjust the prefix to suit your system.

like image 6
casevh Avatar answered Oct 13 '22 21:10

casevh