Issue
Within my project, I (have to) use a feature included in Numpy 1.8, but not in earlier versions (the formatter
option of numpy.set_printoptions
).
Since Travis CI build machines are based on Ubuntu 12.04, by default I only have Numpy 1.6.1 available. I then tried to install the Numpy-1.8.1-Debian-package for Ubuntu 14.04 and it's dependencies manually, which led to further problems:
I need to install the packages libblas3
and liblapack3
to be able to install Numpy 1.8, which is not possible when liblapack3gf
and libblas3gf
are installed on the system (which are there by default), since the packages would "break" them. If I apt-get remove
them, automatically libatlas3gf-base
is being installed via the same apt-get
-command (which is not the case on a standard Ubuntu system, I even set one up on my local machine to make sure). If I then try to uninstall Vlibatlas3gf-baseV, again liblapack3gf
and libblas3gf
are automatically being installed again.
I do not really know how to handle this problem, or how to get around it to get Numpy 1.8 working with Travis. I also tried the suggestions for upgrading Numpy via pip
provided here, but within Travis this did not work.
Any help is highly appreciated!
Thank you very much!
The solution:
I completed rth's answer to the following .travis.yml
-file, with further help from here and here:
language: python
matrix:
include:
- python: 2.7
env: NUMPY=1.8 SCIPY=0.13
notifications:
email: false
before_install:
- travis_retry wget http://repo.continuum.io/miniconda/Miniconda-3.8.3-Linux-x86_64.sh -O miniconda.sh
- chmod +x miniconda.sh
- bash miniconda.sh -b -p $HOME/miniconda
- export PATH=/home/travis/miniconda/bin:$PATH
- conda update --yes conda
install:
- conda create --yes -n test python=$TRAVIS_PYTHON_VERSION
- source activate test
- conda install --yes numpy=$NUMPY scipy=$SCIPY matplotlib pip
- pip install setuptools
- [ ... some other packages to install ... ]
- python setup.py install
script:
- nosetests
Now everything works as expected. Please note: you will not be able to import and use PyLab with this setup, see the comments below for the explanations.
Solution
Building scientific python modules from sources (whether compiling directly or with pip
) in a continuous integration work-flow is slow (15 min for numpy, another 15 min if you need scipy, etc), and a waste of resources.
You should rather use a binary distribution of numpy, such as the one provided by Anaconda. For Travis CI you could use,
language: python
before_script:
- wget http://repo.continuum.io/miniconda/Miniconda-3.8.3-Linux-x86_64.sh -O miniconda.sh
- chmod +x miniconda.sh
- export PATH=/home/travis/miniconda/bin:$PATH
- conda install --yes numpy=1.8
Also have a look at this more complete setup example for Travis CI.
Answered By - rth
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.