diff --git a/fix_load_path_mac.py b/bin/fix_load_path_mac.py similarity index 81% rename from fix_load_path_mac.py rename to bin/fix_load_path_mac.py index 1d69b33a..1825eded 100644 --- a/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) 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/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." 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 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." 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: