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.
The only thing that you need for installing Numpy on Windows are: Python. PIP or Conda (depending upon user preference)
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.
I tried installing Numpy 1.8.2 with pip
on Travis CI and it seems to have worked.
Here is the content of my .travis.yml
file:
language: python
before_script:
- pip uninstall numpy -y
- pip install -I numpy==1.8.2
script: python -c 'import numpy; print numpy.version.version'
You can see that it is successfully printing 1.8.2
in this build log.
Hope this helps!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With