Monday, February 2, 2015

Installing IPython Notebook on Redhat

I wanted in install IPython Notebook and got tripped up on sqlite dependencies.  Here is what worked:


# Install support libraries for python 2.7
yum groupinstall -y 'development tools'
yum install -y zlib-devel bzip2-devel openssl-devel xz-libs wget sqlite-devel

# Prepare, build and install python 2.7 as an alternate (don't mess with system python 2.6)
cd /usr/src
wget https://www.python.org/ftp/python/2.7.8/Python-2.7.8.tgz
tar xzf Python-2.7.8.tgz
cd Python-2.7.8
./configure
make altinstall

# Make sure Python 2.7 exec is available
export PATH="/usr/local/bin:$PATH"

# Check Python 2.7 and sqlite before moving forward
python2.7 -c 'import sqlite3'  # should have no output, especially errors

# Install setup tools (needed to install pip)
cd ..
wget --no-check-certificate https://pypi.python.org/packages/source/s/setuptools/setuptools-1.4.2.tar.gz
tar -xvf setuptools-1.4.2.tar.gz
cd setuptools-1.4.2

# Install setup toos into python 2.7
python2.7 setup.py install


# Install pip
cd ..
curl https://raw.githubusercontent.com/pypa/pip/master/contrib/get-pip.py | python2.7 -
pip --version

# Use pip to install ipython notebook
pip install "ipython[notebook]"

# start it up (in background—maybe should use screen)
# Note use of ip parm to avoid issue with not runnin IPV6, per:
# https://github.com/ipython/ipython/issues/5802

# cd to the directory that you want to serve your notebooks from and…
ipython notebook --ip 127.0.0.1

# the --ip 127.0.0.1 was to avoid a problem with not running IPv6 (you may be able to leave that off)

# Then open http://localhost:8888/ and you should be up and running


Most of the python is derivative of this page:

http://bicofino.io/blog/2014/01/16/installing-python-2-dot-7-6-on-centos-6-dot-5/

But in my case, that one comment by Teodor-Bogdan Barbieru was key... including sqlite-devel in the prerequisites.  The above probably works on Centos too.