From 144c94dc69d1e479604e4dafe6b4bb37e0070ba9 Mon Sep 17 00:00:00 2001 From: logicabrity Date: Tue, 9 Aug 2016 13:03:26 +0100 Subject: [PATCH 1/5] move fix_load_path_mac.py to bin directory --- fix_load_path_mac.py => bin/fix_load_path_mac.py | 0 doc/install.rst | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename fix_load_path_mac.py => bin/fix_load_path_mac.py (100%) diff --git a/fix_load_path_mac.py b/bin/fix_load_path_mac.py similarity index 100% rename from fix_load_path_mac.py rename to bin/fix_load_path_mac.py diff --git a/doc/install.rst b/doc/install.rst index 70265d86..f5aa0cdd 100644 --- a/doc/install.rst +++ b/doc/install.rst @@ -259,7 +259,7 @@ which can be seen by using ``otool -L fidimag/extensions/clib.so``, :: /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1213.0.0) /opt/local/lib/libgcc/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0) -A solution is to change these path manually with ``install_name_tool``, so we have provided a python script (``fix_load_path_mac.py``) to do this. +A solution is to change these path manually with ``install_name_tool``, so we have provided a python script (``bin/fix_load_path_mac.py``) to do this. After run the script, the library path is fixed, for example, the output of the cmd ``otool -L fidimag/extensions/clib.so`` gives :: fidimag/extensions/neb_clib.so: From cd1b3b5f496709316c6f1e821f7f2142196c107f Mon Sep 17 00:00:00 2001 From: logicabrity Date: Tue, 9 Aug 2016 13:04:12 +0100 Subject: [PATCH 2/5] remove installation script for sundials 2.5 we're using the 2.6 one now --- bin/install-sundials-2.5.sh | 46 ------------------------------------- 1 file changed, 46 deletions(-) delete mode 100755 bin/install-sundials-2.5.sh diff --git a/bin/install-sundials-2.5.sh b/bin/install-sundials-2.5.sh deleted file mode 100755 index 33ca05e0..00000000 --- a/bin/install-sundials-2.5.sh +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/bash - -# This script installs SUNDIALS locally. It may need to environment -# variables to work, like 'export CC=gcc' in ARCHER. - -SUNDIALS=sundials-2.5.0 - -set -e - -# Create target directory if needed. - -HERE_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) -FIDIMAG_DIR="$(dirname "$HERE_DIR")" -LIBS_DIR=${FIDIMAG_DIR}/local -mkdir -p $LIBS_DIR -cd ${LIBS_DIR} -echo "Installing SUNDIALS and FFTW to "$LIBS_DIR"." -echo "Using CC="$CC" " - -download_and_install() { - # $1 name of the package - # $2 URL where ${1}.tar.gz can be obtained - # $3 configure options - if [ ! -e ${1}.tar.gz ]; then - echo "Downloading "${1}"." - wget -q ${2}/${1}.tar.gz - fi; - - if [ ! -e ${1} ]; then - tar -xzf ${1}.tar.gz - cd ${1} - echo "Configuring "${1}"." - ./configure --quiet --enable-shared --prefix=${LIBS_DIR} $3 - echo "Compiling and installing "${1}"." - { - make - make install - } > /dev/null - echo "Done." - cd ${LIBS_DIR} - fi; -} - -download_and_install ${SUNDIALS} http://ftp.mcs.anl.gov/pub/petsc/externalpackages --disable-lapack - -echo "Installation succesful." From cbefdb969d0ba50f71915e6b78fd6c53786abf0d Mon Sep 17 00:00:00 2001 From: logicabrity Date: Tue, 9 Aug 2016 13:07:30 +0100 Subject: [PATCH 3/5] write a little module docstring for fix_load_path --- bin/fix_load_path_mac.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/bin/fix_load_path_mac.py b/bin/fix_load_path_mac.py index 1d69b33a..1825eded 100644 --- a/bin/fix_load_path_mac.py +++ b/bin/fix_load_path_mac.py @@ -1,3 +1,8 @@ +""" +Creates working dylibs on Mac OS X by adding the full path to referenced libraries. +This fixes ImportErrors that may appear starting with SUNDIALS 2.6. + +""" import os import glob import re @@ -27,4 +32,4 @@ def extract_library(so_file): for so in sos: extract_library(so) - print("Done for %s!"%so) \ No newline at end of file + print("Done for %s!"%so) From 8e3b5154a851130a5d7ba57145d8f58296c18cdd Mon Sep 17 00:00:00 2001 From: logicabrity Date: Tue, 9 Aug 2016 13:18:46 +0100 Subject: [PATCH 4/5] single apt-get command in install-ubuntu-packages --- bin/install-ubuntu-packages.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/bin/install-ubuntu-packages.sh b/bin/install-ubuntu-packages.sh index ff4ce943..f8a1a097 100755 --- a/bin/install-ubuntu-packages.sh +++ b/bin/install-ubuntu-packages.sh @@ -1,4 +1,7 @@ # required to compile fidimag -apt-get install python-pip python-numpy python-dev python-scipy cmake -# required for tests and running it -apt-get install python-pytest python-pyvtk ipython python-matplotlib +deps_compilation="python-pip python-numpy python-dev python-scipy cmake" + +# required for tests and running fidimag +deps_live="python-pytest python-pyvtk ipython python-matplotlib" + +apt-get install $deps_compilation $deps_live From 5ef6d96cacfb30c82993bd4eacc20354f6d39b32 Mon Sep 17 00:00:00 2001 From: logicabrity Date: Tue, 9 Aug 2016 13:33:43 +0100 Subject: [PATCH 5/5] outsource installation with pip to own script --- bin/install-python-packages.sh | 1 + bin/ubuntu_install_script.sh | 6 ++---- 2 files changed, 3 insertions(+), 4 deletions(-) create mode 100755 bin/install-python-packages.sh diff --git a/bin/install-python-packages.sh b/bin/install-python-packages.sh new file mode 100755 index 00000000..f2aa0347 --- /dev/null +++ b/bin/install-python-packages.sh @@ -0,0 +1 @@ +pip install --upgrade cython psutil ipywidgets diff --git a/bin/ubuntu_install_script.sh b/bin/ubuntu_install_script.sh index 592bff99..d0495696 100755 --- a/bin/ubuntu_install_script.sh +++ b/bin/ubuntu_install_script.sh @@ -1,15 +1,13 @@ echo "Super user authentication required to add packages (you will be \ prompted for confirmation)." sudo bash install-ubuntu-packages.sh +sudo bash install-python-packages.sh bash install-fftw.sh bash install-sundials.sh -sudo pip install cython --upgrade -sudo pip install psutil ipywidgets pushd .. > /dev/null make -# Adds Fidimag environment variables to profile.d, if they're not already -# there. +# Adds fidimag environment variables to profile.d, if they're not already there. FIDIMAG_PROFILE_PATH=/etc/profile.d/fidimag.sh if [ ! -e "$FIDIMAG_PROFILE_PATH" ]; then echo "Warning: Adding Fidimag to path at $FIDIMAG_PROFILE_PATH."