https://github.com/davidcsterratt/KappaNEURON
Raw File
Tip revision: 54f776ada45972b69f67c7820585b8b424a7eed7 authored by David C Sterratt on 08 June 2017, 15:49:19 UTC
Merge branch 'master' of github.com:davidcsterratt/KappaNEURON
Tip revision: 54f776a
INSTALL-neuron
#!/bin/bash
# Script to checkout and install branch of Neuron
# Branches have names such as "Release 7.4"
# By default, the working version is installed.

NCPU=4
version=$1
DATE=$2
PREFIX=${HOME}/nrn

## Defaults. Set version to version known to work.
if [ "x$version" == "x" ] && [ "x$DATE" == "x" ]; then
    version="trunk"
    DATE="2014-09-23"
fi

if [ "x$version" == "x" ] || [ "x$version" == "xtrunk"]; then 
    branch=trunk
    if [ "x${DATE}" == "x" ]; then
        NRNPREFIX=${PREFIX}/${branch}
    else
        NRNPREFIX=${PREFIX}/${branch}-${DATE}
    fi
else
    branch="Release ${version}"
    if [ "x${DATE}" == "x" ]; then
        NRNPREFIX=${PREFIX}/${version}
    else
        NRNPREFIX=${PREFIX}/${version}-${DATE}
    fi
fi
echo "Branch \"$branch\" will be checked out.."
echo "...and installed in ${NRNPREFIX}"

function installpkg {
    echo -n "checking for $1 ... "
    if [ -e $1 ]; then
        echo "present"
    else
        if [ -x "/usr/bin/apt-get" ]; then
            echo
            sudo apt-get install $2
        else
            echo "perhaps not present - check package equivalent to Debian $2 is installed"
        fi
    fi
}
installpkg /usr/bin/bison bison
installpkg /usr/bin/flex flex
installpkg /usr/bin/hg mercurial
installpkg /usr/bin/gcc build-essential
installpkg /usr/bin/aclocal automake
installpkg /usr/bin/libtoolize libtool
installpkg /usr/include/X11/Xlib.h libx11-dev
installpkg /usr/include/X11/extensions/Xext.h libxext-dev
installpkg /usr/include/python2.7/Python.h libpython2.7-dev
installpkg /usr/include/ncurses.h ncurses-dev
installpkg /usr/lib/python2.7/dist-packages/scipy/version.py python-scipy
installpkg /usr/share/pyshared/matplotlib/__init__.py python-matplotlib

mkdir neuron-build
cd neuron-build
# Install neuron
if [ -d iv ] ; then
   cd iv
   hg pull
   cd ..
else
   hg clone http://www.neuron.yale.edu/hg/neuron/iv # skip this if you don't want the GUI
fi
if [ -d nrn ] ; then
   cd nrn
   hg pull
   cd ..
else 
   hg clone http://www.neuron.yale.edu/hg/neuron/nrn
fi

cd iv/
./build.sh 
./configure --prefix=$NRNPREFIX/iv
make -j ${NCPU}
make install

cd ../nrn
if [ "x${DATE}" != "x" ]; then
    hg update -d ${DATE}
else
    hg update "${branch}"
fi
./build.sh
./configure --prefix=$NRNPREFIX/nrn --with-iv=$NRNPREFIX/iv  --with-nrnpython=/usr/bin/python2.7
make -j ${NCPU}
make install

cd ..
# Python packages are installed in ${NRNPREFIX}/lib/python

echo "Branch \"$branch\" (Date: ${DATE}) has been installed in ${NRNPREFIX}"

## Test
${NRNPREFIX}/nrn/x86_64/bin/nrngui 

echo "To test python"
echo "--------------"
echo
echo "1. Add the neuron package to your PYTHONPATH:"
echo "   export PYTHONPATH=${NRNPREFIX}/nrn/lib/python/:\$PYTHONPATH"
echo
echo "2. Try the following:"
echo
echo "   python2.7"
echo "   import neuron"
echo "   import neuron.rxd.rxd"
echo


echo "   export PYTHONPATH=${NRNPREFIX}/nrn/lib/python/:\$PYTHONPATH"

back to top