≡ Menu

Making PyMinuit play nice on Ubuntu

Python logo

Image via Wikipedia

I finally have a working python setup on my Ubuntu desktop that has all the bells and whistles that I want at the same time with the same setup.

The python setup I use comes from the Enthought Python Distribution.

System specs:

Ubuntu 10.10 x86 64-bit
Python 2.7.1 |EPD 7.0-1 (64-bit)| (r271:86832, Nov 29 2010, 13:51:37)

I also wanted to have the python wrapper for Minuit, pyminuit, available for use with some code that I’ve written.

Following the installation instructions verbatim for the linux distribution will spew the following errors:

MnUserTransformation.cpp: In constructor 'MnUserTransformation::MnUserTransformation(const std::vector >&, const std::vector >&)':
MnUserTransformation.cpp:30: error: 'sprintf' is not a member of 'std'
make[2]: *** [MnUserTransformation.lo] Error 1
make[2]: Leaving directory `/home/jonathan/Minuit-1_7_9/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/jonathan/Minuit-1_7_9'
make: *** [all] Error 2

The way I got it to work

$ sudo apt-get install g++

I also did (but not sure if it was necessary):

$ sudo apt-get install python-dev

The error I talk about above can be fixed by going into the Minuit-1_7_9/src/MnUserTransformation.cpp file and adding to the fifth line:

#include <cstdio>

Just like this well-hidden gem says to do.

Download:

After finding where Minuit-1_7_9a.tar.gz downloaded, move it somewhere convenient (or just do what I do):

$ mv Minuit-1_7_9a.tar.gz ~/Minuit-1_7_9a.tar.gz
$ cd ~
$ tar -xvzf Minuit-1_7_9a.tar.gz
$ cd Minuit-1_7_9a

Find where pyminuit-1.1.0.tgz was downloaded

$ tar -xvzf pyminuit-1.1.0.tgz
$ cd pyminuit
$ python setup.py install --with-minuit=/home/[your-username]/Minuit-1_7_9a

Add the following to your .bashrc and you should be set to fly!

$ export LD_LIBRARY_PATH=/home/[your-username]/Minuit-1_7_9a/src/.libs:$LD_LIBRARY_PATH
$ export PATH=/home/[your-username]/epd-7.0-1-rh5-x86_64/bin:$PATH

Hopefully that helped!

Enhanced by Zemanta
{ 0 comments… add one }

Leave a Comment

Next post:

Previous post: