install.sh 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. #!/bin/bash
  2. # Based on a script from scikit-learn
  3. # This script is meant to be called by the "install" step defined in
  4. # .travis.yml. See http://docs.travis-ci.com/ for more details.
  5. # The behavior of the script is controlled by environment variabled defined
  6. # in the .travis.yml in the top level folder of the project.
  7. set -e
  8. # Fix the compilers to workaround avoid having the Python 3.4 build
  9. # lookup for g++44 unexpectedly.
  10. export CC=gcc
  11. export CXX=g++
  12. if [[ "$DISTRIB" == "conda_min" ]]; then
  13. # Deactivate the travis-provided virtual environment and setup a
  14. # conda-based environment instead
  15. deactivate
  16. # Use the miniconda installer for faster download / install of conda
  17. # itself
  18. wget http://repo.continuum.io/miniconda/Miniconda-latest-Linux-x86_64.sh \
  19. -O miniconda.sh
  20. chmod +x miniconda.sh && ./miniconda.sh -b -p $HOME/miniconda
  21. export PATH=/home/travis/miniconda/bin:$PATH
  22. conda config --set always_yes yes
  23. conda update --yes conda
  24. # Configure the conda environment and put it in the path using the
  25. # provided versions
  26. conda create -n testenv --yes python=$PYTHON_VERSION pip nose coverage \
  27. six=$SIX_VERSION numpy=$NUMPY_VERSION scipy=$SCIPY_VERSION
  28. source activate testenv
  29. conda install libgfortran=1
  30. if [[ "$INSTALL_MKL" == "true" ]]; then
  31. # Make sure that MKL is used
  32. conda install --yes --no-update-dependencies mkl
  33. else
  34. # Make sure that MKL is not used
  35. conda remove --yes --features mkl || echo "MKL not installed"
  36. fi
  37. elif [[ "$DISTRIB" == "conda" ]]; then
  38. # Deactivate the travis-provided virtual environment and setup a
  39. # conda-based environment instead
  40. deactivate
  41. # Use the miniconda installer for faster download / install of conda
  42. # itself
  43. wget http://repo.continuum.io/miniconda/Miniconda-latest-Linux-x86_64.sh \
  44. -O miniconda.sh
  45. chmod +x miniconda.sh && ./miniconda.sh -b -p $HOME/miniconda
  46. export PATH=/home/travis/miniconda/bin:$PATH
  47. conda config --set always_yes yes
  48. conda update --yes conda
  49. # Configure the conda environment and put it in the path using the
  50. # provided versions
  51. conda create -n testenv --yes python=$PYTHON_VERSION pip nose coverage six=$SIX_VERSION \
  52. numpy=$NUMPY_VERSION scipy=$SCIPY_VERSION pandas=$PANDAS_VERSION scikit-learn
  53. source activate testenv
  54. if [[ "$INSTALL_MKL" == "true" ]]; then
  55. # Make sure that MKL is used
  56. conda install --yes --no-update-dependencies mkl
  57. else
  58. # Make sure that MKL is not used
  59. conda remove --yes --features mkl || echo "MKL not installed"
  60. fi
  61. if [[ "$COVERAGE" == "true" ]]; then
  62. pip install coveralls
  63. fi
  64. python -c "import pandas; import os; assert os.getenv('PANDAS_VERSION') == pandas.__version__"
  65. elif [[ "$DISTRIB" == "mpi" ]]; then
  66. # Deactivate the travis-provided virtual environment and setup a
  67. # conda-based environment instead
  68. deactivate
  69. # Use the miniconda installer for faster download / install of conda
  70. # itself
  71. wget http://repo.continuum.io/miniconda/Miniconda-latest-Linux-x86_64.sh \
  72. -O miniconda.sh
  73. chmod +x miniconda.sh && ./miniconda.sh -b -p $HOME/miniconda
  74. export PATH=/home/travis/miniconda/bin:$PATH
  75. conda config --set always_yes yes
  76. conda update --yes conda
  77. # Configure the conda environment and put it in the path using the
  78. # provided versions
  79. conda create -n testenv --yes python=$PYTHON_VERSION pip nose coverage six=$SIX_VERSION \
  80. numpy=$NUMPY_VERSION scipy=$SCIPY_VERSION scikit-learn mpi4py=$MPI_VERSION
  81. source activate testenv
  82. if [[ "$INSTALL_MKL" == "true" ]]; then
  83. # Make sure that MKL is used
  84. conda install --yes --no-update-dependencies mkl
  85. else
  86. # Make sure that MKL is not used
  87. conda remove --yes --features mkl || echo "MKL not installed"
  88. fi
  89. if [[ "$COVERAGE" == "true" ]]; then
  90. pip install coveralls
  91. fi
  92. elif [[ "$DISTRIB" == "ubuntu" ]]; then
  93. # deactivate
  94. # Create a new virtualenv using system site packages for numpy and scipy
  95. # virtualenv --system-site-packages testenv
  96. # source testenv/bin/activate
  97. pip install -r requirements.txt
  98. fi
  99. if [[ "$COVERAGE" == "true" ]]; then
  100. pip install coveralls
  101. fi
  102. # pip install neo==0.3.3
  103. wget https://github.com/NeuralEnsemble/python-neo/archive/master.tar.gz
  104. tar -xzvf master.tar.gz
  105. pushd python-neo-master
  106. python setup.py install
  107. popd
  108. pip install .
  109. if ! [[ "$DISTRIB" == "ubuntu" ]]; then
  110. python -c "import numpy; import os; assert os.getenv('NUMPY_VERSION') == numpy.__version__, 'Numpy versions do not match: {0} - {1}'.format(os.getenv('NUMPY_VERSION'), numpy.__version__)"
  111. python -c "import scipy; import os; assert os.getenv('SCIPY_VERSION') == scipy.__version__, 'Scipy versions do not match: {0} - {1}'.format(os.getenv('SCIPY_VERSION'), scipy.__version__)"
  112. fi