LoginSignup
1
2

More than 5 years have passed since last update.

Travis CI に CVXOPT, NumPy, SciPy をインストールする

Last updated at Posted at 2016-03-24

概要

Travis CICVXOPT, NumPy, SciPy を使った Python プログラムをテストしたい.
これらのライブラリは pip だけではインストールできなかったので,他に必要なパッケージをまとめる.

CVXOPTがSuiteSparseの同梱を辞めたことによる修正(2017年2月5日)

前提

テストの実行に必要なライブラリは requirements.txt に書かれているものとする.
この時,Travisは自動で pip install -r requirements.txt してくれるので, install ステップは不要.

.travis.yml

まとめると,CVXOPT のインストールに libblas-devliblapack-dev が,
SciPy のインストールに gfortran が必要なので,.travis.ymladdons.apt.packages を使って用意しておく.

また,CVXOPTがSuiteSparseの同梱を辞めたため,自前で用意しておく必要がある.
この手続きは before_install に記述する.

.travis.yml
language: python
python:
  - 2.7
addons:
  apt:
    packages:
      - libblas-dev
      - liblapack-dev
      - gfortran
before_install:
  - wget http://faculty.cse.tamu.edu/davis/SuiteSparse/SuiteSparse-4.5.3.tar.gz
  - tar -xf SuiteSparse-4.5.3.tar.gz
  - export CVXOPT_SUITESPARSE_SRC_DIR=$(pwd)/SuiteSparse
script:
  - ./unittest_script.py

古いバージョンだと before_installsudo apt-get install を使って用意していたようだが,コンテナベースの場合 sudo は使えず, addons.apt を使うようだ.

ちなみに,今回の requirements.txt

requirements.txt
cvxcanon>=0.1.1           # via cvxpy
cvxopt>=1.1.9
cvxpy>=0.4.8
cycler>=0.10.0            # via matplotlib
ecos>=2.0.4               # via cvxpy
fastcache>=1.0.2          # via cvxpy
functools32>=3.2.3.post2  # via matplotlib
matplotlib>=2.0.0
multiprocess>=0.70.4      # via cvxpy
numpy>=1.12.0
pyparsing>=2.1.10         # via matplotlib
python-dateutil>=2.6.0    # via matplotlib
pytz>=2016.10             # via matplotlib
scipy>=0.18.1
scs>=1.2.6                # via cvxpy
six>=1.10.0               # via cvxpy, cycler, matplotlib, python-dateutil
subprocess32>=3.2.7       # via matplotlib
toolz>=0.8.2              # via cvxpy

である.

1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2