verilog書く人

自称ASIC設計者です。どなたかkaggle一緒に出ましょう。

Travis CIでscipyを使うときの四苦八苦

Travis CIでscipyをインストールして使うとき、pipでもapt-getでもインストールできなくて、Travis CIのログがエラーだらけになったのでメモ。

 

調べてみると、


(1)minicondaを使う
(2)addons.apt.packagesを使う

の二つの選択肢がありそうでした。

 

 


私が管理しているstacked_generalizationでは

Quicker Travis builds that rely on numpy and scipy using Miniconda · GitHubを参考にして、

(1)を使うことにしました。.travis.ymlはこんなかんじ。↓

language: python
python:
  - 2.7
  - 3.4
# Setup anaconda
before_install:
  - wget http://repo.continuum.io/miniconda/Miniconda-latest-Linux-x86_64.sh -O miniconda.sh
  - chmod +x miniconda.sh
  - ./miniconda.sh -b
  - export PATH=/home/travis/miniconda2/bin:$PATH
  - conda update --yes conda
  # The next couple lines fix a crash with multiprocessing on Travis and are not specific to using Miniconda
  - sudo rm -rf /dev/shm
  - sudo ln -s /run/shm /dev/shm
# Install packages
install:
  - conda install --yes atlas numpy scipy nose scikit-learn pandas

 

(ついでにnoseとscikit-learnとpandasも入れてます。)

sikit-learnではどうしてるんだろう?とおもいみてみると、

language: python
# Pre-install packages for the ubuntu distribution
addons:
  apt:
    packages:
      - libatlas3gf-base
      - libatlas-dev
      # only required by the DISTRIB="ubuntu" build:
      - python-scipy

となってました。

CI環境をminicondaに依存させたくない時はこっちの方がよさそうですね。

 

全文はこちら↓

scikit-learn/.travis.yml at master · scikit-learn/scikit-learn · GitHub

 

.travis.ymlを書くときは有名ライブラリを参考にするのが間違いなさそうだなあ。

 

ちょっとしたライブラリでも複数のPythonのバージョンをサポートしたいなどを考えると、Travis CIには非常に助かってます。