4

I'm trying to get the package 'bigfloat' installed on my Mac (OS X 10.8.4), and I'm running into some issues. The package 'bigfloat' requires two other dependencies: 1) mpfr, and 2) gmp.

I've installed gmp here: http://gmplib.org/ <-- This seemed to work fine.

But installing mpfr is not as easy (http://www.mpfr.org/mpfr-current/mpfr.html#Installing-MPFR). They say to simply ./configure, make, and make install to get it going, but I get this error:

checking for gmp.h... no
configure: error: gmp.h can't be found, or is unusable.

I've googled around and people suggest specifying paths in the configure command, but I've had no luck so far. Any help would be appreciated!

As a reference, I am looking at mpfr-3.1.2 (located in the directory: /Users/myusername), and gmp-5.1.2 (located in the same directory).

Thanks!

astromax
  • 6,001
  • 10
  • 36
  • 47
  • UPDATE: Here is the command that I went with based on where I found gmp.h and libgmp.dylib to be: ./configure --with-gmp-include=/Users/groenera/gmp-5.1.2/ --with-gmp-lib=/opt/local/lib Now my problem is different: ERROR! The versions of gmp.h (5.1.2) and libgmp (5.0.5) do not match. Any idea how to fix this? – astromax Jul 01 '13 at 17:46

2 Answers2

6

Just in case anyone else comes across this page while trying to install bigfloat with pip on Mac OS X, here are the commands I had to use to get it to install correctly:

brew install gmp
brew install mpfr
sudo pip install --global-option=build_ext --global-option="-I/usr/local/include" --global-option="-L/usr/local/lib" bigfloat

This method requires that you have homebrew installed.

Trin
  • 61
  • 1
  • 1
2

When I compile private versions of GMP, MPFR, and MPC on Linux, I use:

# Create the desired destination directory for GMP, MPFR, and MPC.
$ mkdir /home/case/local
# Download and un-tar the GMP source code. Change to GMP source directory and compile GMP.
$ cd ~/src/gmp-5.1.0
$ ./configure --prefix=/home/case/local
$ make
$ make check
$ make install
# Download and un-tar the MPFR source code. Change to MPFR source directory and compile MPFR.
$ cd ~/src/mpfr-3.1.1
$ ./configure --prefix=/home/case/local --with-gmp=/home/case/local
$ make
$ make check
$ make install
# Download and un-tar the MPC source code. Change to MPC source directory and compile MPC.
$ cd ~/src/mpc-1.0.1
$ ./configure --prefix=/home/case/local --with-gmp=/home/case/local --with-mpfr=/home/case/local
$ make
$ make check
$ make install

I think those instructions will work on OSX, too.

Update

I successfully build bigfloat using the command:

py27 setup.py build_ext -I/home/case/local/include -L/home/case/local/lib -R/home/case/local/lib install
casevh
  • 11,093
  • 1
  • 24
  • 35
  • Alright - I did all of this and got no errors. Would you have any idea how to connect this back to bigfloat in any way? It needs to know (somehow) about these dependencies. I've tried easy_install but it tells me it doesn't know where gmp.h is. I've tried pip, too, and it doesn't seem to work either. – astromax Jul 01 '13 at 18:58
  • 1
    You'll probably need to do something like `python setup.py build_ext --I<> --L<> --R<> install`, where <> is the appropriate directory. PS. I maintain gmpy2 which also supports MPFR. – casevh Jul 01 '13 at 19:30
  • You seem to be very knowledgeable about the topic. I'll try those and get back to you. – astromax Jul 01 '13 at 19:36
  • I've tried the above command and it still tells me that 'gmp.h' is not found. Am I doing this correctly? python setup.py build_ext -I/Users/uname/local -L/Users/uname/local (where /Users/uname/local serves as your /home/case/local directory) – astromax Jul 01 '13 at 19:48
  • Try -I/Users/uname/local/include -L/Users/uname/local/lib -R/Users/uname/local/lib – casevh Jul 01 '13 at 20:00