It says you need python 2.7 (which you already have):
$ python --version
Python 2.7.4
Then it says that you need the numpy package too, version >= 1.4.1:
apt-cache policy python-numpy
python-numpy:
Installed: (none)
Candidate: 1:1.7.1-1ubuntu1
Version table:
1:1.7.1-1ubuntu1 0
500 http://archive.ubuntu.com/ubuntu/ raring/main amd64 Packages
As you can see, I have available numpy version 1.7.1, so lets proceed to install it:
sudo apt-get install python-numpy
Now it says that we need cython, lets check if that package is availabe:
apt-cache policy cython
cython:
Installed: (none)
Candidate: 0.17.4-0ubuntu1
Version table:
0.17.4-0ubuntu1 0
500 http://archive.ubuntu.com/ubuntu/ raring/main amd64 Packages
We have it, we install it:
sudo apt-get install cython
Please, do notice that there are other packages that are dependency that are being installed too.
Oddly enough, we also need the scipy module too:
sudo apt-get install python-scipy
Testing. Open python in a terminal and type the following:
$ python
Python 2.7.4 (default, Sep 26 2013, 03:20:26)
[GCC 4.7.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
>>> import scipy
>>> import cython
>>> exit()
The above, has to be without errors. If something went wrong, go up and read the guide again, you forgot/skiped a step.
Downloading the CLASS sources from their page, go to the directory in the terminal, and untar it and make it:
cd where/the/tar/is
tar zxf class_v2.0.2.tar.gz
cd class_v2.0.2
make
Here we will wait until is complete. Once this is done, we go to the python directory and start the magic. Without moving from directories run this:
cd python
python setup.py build
python setup.py install --user
Now we have CLASS installed in our user directory. We should test it!
python
Python 2.7.4 (default, Sep 26 2013, 03:20:26)
[GCC 4.7.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from classy import Class
>>> exit()
Everything is nice a cozzy until here.
Now the truth time, download monthypython tarball in your code directory:
cd ~
mkdir code
cd code
wget https://www.dropbox.com/s/l7mnhwsktp1m8b5/montepython_v1.2.5.tar.bz2?dl=1 -O montepython_v1.2.5.tar.bz2
tar jxf montepython_v1.2.5.tar.bz2
In the installation instructions are some notes that aren't relevant in this peculiar case (a new install) but it may be important when you update montepython.
This change is important. You remember where you installed CLASS? Now you should tell Monte Python where is that. In my case it is /home/braiam/src/class_v2.0.2/class
, yours may be different. You can use find
to look for it:
find ~ -name class -print
Well, now I modify the default.conf
file using whatever you like (I'll use nano) and modify the root
path, so the complete file will looks like:
# Fill in the relevant path to your personal distribution.
# If you create a new file out of this one, please remember to call
# MontePython.py with the option '-conf my.conf'
# At minimum, this file should contain one line:
# ** path['cosmo'] = path to the cosmological code you are using. Note, if you are
# using a modified version of class, be sure that the path contains the word
# class, otherwise the code might not recognise it.
# If you want to use a data folder different from the one present in the folder
# you are executing the code, please also add:
# ** path['data'] = /path/to/the/other/data/
root = '/home/braiam/src/class_v2.0.2/'
path['cosmo'] = root+'/class/'
Save the file and exit.
Test montepython! If everything was ok, you should be able to run code/MontePython.py --help
in your montepythong directory and everything should run:
~/src/montepython$ code/MontePython.py --help
usage: MontePython.py [-h] [-N number of steps] [-o output folder]
[-p input param file] [-c input cov matrix]
[-j jumping method] [-f jumping factor]
[-conf configuration file] [-chain_number chain number]
[-r restart from chain] [-bf restart from best fit file]
[-info [compute information of desired file [compute information of desired file ...]]]
[-bins desired number of bins, default is 20] [-no_mean]
[-comp comparison folder]
[-extra plot file for custom needs] [-noplot] [-all]
[-ext change extension for the output file]
[-fontsize desired fontsize, default is 15]
[-ticksize desired ticksize, default is 13]
Monte Python, a Monte Carlo code in Python
optional arguments:
-h, --help show this help message and exit
-N number of steps
-o output folder
-p input param file
-c input cov matrix
-j jumping method
-f jumping factor
-conf configuration file
-chain_number chain number
-r restart from chain
-bf restart from best fit file
-info [compute information of desired file [compute information of desired file ...]]
-bins desired number of bins, default is 20
-no_mean
-comp comparison folder
-extra plot file for custom needs
-noplot
-all
-ext change extension for the output file
-fontsize desired fontsize, default is 15
-ticksize desired ticksize, default is 13
Best Answer
After much trial and error I've found the problem. It's the pip that's in Ubuntu PPA, v1.5.6. Of course it's ultimately my user error, but that version of pip is really not forgiving. I wrote more about it on this post.