installing Python bigfloat module

4.2k Views Asked by At

I'm trying to get the bigfloat Python package onto my mac, but I'm not very good at this sort of thing.

I have downloaded the latest package as described here. The documentation says:

In order to use the bigfloat package you will need to have both the GMP and MPFR libraries already installed on your system.

I think that the GMP and MPFR libraries are already installed on my system - at least when I search for them I see folders with their names and files in them.

When I try to install bigfloat by typing:

python setup.py install

I get lots of error messages. The first ones being:

src/mpfr.c:223:17: error: gmp.h: No such file or directory
src/mpfr.c:224:18: error: mpfr.h: No such file or directory

The gmp.h and mpfr.h files are on my computer, but obviously I need to do something else.

Cleary I don't understand how the whole process works, but any pointers in the right direction would be great. Thank you.

3

There are 3 best solutions below

1
astromax On

I'm having the same problem and here's what I've tried as per the readme file in the bigfloat installation directory:

"An example: on Mac OS X, using the system Python, but with MPFR and GMP installed in /opt/local (e.g., by MacPorts), one can do":

LIBRARY_PATH=/opt/local/lib CPATH=/opt/local/include python setup.py build

This didn't throw any errors, but when I checked to see if it installed by running this test:

python -m bigfloat.test.test_bigfloat

I got the error:

/Library/Frameworks/Python.framework/Versions/7.2/Resources/Python.app/Contents/MacOS/Python: No module named mpfr  

You can give this a try to see if it works for you, but I'm still lost.

What you should get if it's a successful installation is this:

the bigfloat-0.3.0a1/ directory that you created can now be deleted.
0
Charles P. On

First you will need to have installed both the GMP and MPFR libraries.

sudo apt-get install libmpfr-dev

Then just run:

 sudo pip install bigfloat

Regards!

0
B Rad C On

I was having trouble installing python bigfloat on my Mac (v10.10.3) via easy_install and pip and got a similar error problem; it is because bigfloat requires a couple other libraries.

Per this answer

I installed the gmp & mpfr libraries then pip would install properly

pip install bigfloat

or

pip3.5 install bigfloat