How can I get the Nibabel module for Python 3? Only the Nibabel module for Python 2 is in the repository.
1 Answer
For Ubuntu 14.04 and earlier, this is not in the repositories, but you can install is yourself. (I tested this on Ubuntu 12.04 and 14.04).
A prerequisite is NumPy. If you don't have this for Python3, then open a terminal (CTLALTT).
sudo apt-get install python3-numpy
Easy Way (using PIP)
If you don't have PIP for Python 3, you can get it on Ubuntu 14.04 by doing
sudo apt-get install python3-pip
and on Ubuntu 12.04, by doing
sudo apt-get install python3-setuptools
sudo easy_install3 pip
Now, to install Nibabel, do
sudo pip3 install nibabel
Done.
Hard Way (build from source)
We'll use git to download Nibabel, so type this command
sudo apt-get install git
Download nibabel by typing
git clone https://github.com/nipy/nibabel.git
then move to the new nibabel
directory by doing
cd nibabel
At this point, you can do sudo python3 setup.py install
, but it's better to use the program checkinstall
which will make it easier to uninstall the package if you need to. So type
sudo apt-get install checkinstall
and install nibabel with
sudo checkinstall python3 setup.py install
If it asks Should I create a default set of package docs? [y]:
, hit YENTER.
When it says Please write a description for the package
, you can type whatever (I typed "python3-nibabel
") and hit ENTERENTER .
When it says This package will be built according to these values:
, hit ENTER.
If it asks Do you want me to list them? [n]:
, hit NENTER.
If it asks Should I exclude them from the package? ...
, hit YENTER.
You should be done. Type python3
, then import nibabel
to check that it worked. If you need to uninstall it, open a terminal and type: sudo apt-get remove nibabel
.