I am trying to setup a travis continuous build system with my project, which has numpy, scipy and matplotlib in its dependencies. I am targeting python 3.3.
In my .travis.yml
script I am installing numpy and scipy from apt-get, as well as (to be sure) from pip (only numpy). Unfortunatelly, matplotlib build still says that numpy is missing from deps. I tried almost all the methods found on the WEB but most of them do not work (they are outdated I think).
language: python
python:
- "3.3"
install:
- pip install numpy
- pip install colorama
- pip install matplotlib
- pip install nose
script: nosetests
virtualenv:
system_site_packages: true
before_install:
- sudo apt-get update -qq
- sudo apt-get install -qq python3-numpy python3-scipy
Below is the interesting part of travis log. It says that dependence is not satisfied, yet pip command can see numpy installed already from apt.
BUILDING MATPLOTLIB
matplotlib: 1.2.0
python: 3.3.2 (default, May 16 2013, 18:32:41) [GCC 4.6.3]
platform: linux
REQUIRED DEPENDENCIES
numpy: no
* You must install numpy 1.4 or later to build
* matplotlib.
Complete output from command python setup.py egg_info:
basedirlist is: ['/usr/local', '/usr']
If you don't need to test against multiple python versions, the easiest trick is to tell travis that your language is c
and then install everything from apt-get. This gets around all of the issues with system_site_packages and virtualenv.
This library, for instance, uses travis-ci for testing and depends on the full scipy stack (numpy, scipy, matplotlib, pytables, pandas, etc), which is installed via apt
with language=c
.
Apt-get, Robert McGibbon's suggestion, is still apparently quite slow.
Here's an approach from Dan Balchard using Miniconda, that will pre-install matplotlib and the rest of the scipy stack on your Travis CI test machine. Here's the full .travis.yml
file:
language: python
python:
- 2.7
- 3.3
notifications:
email: false
# 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/miniconda/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 python=$TRAVIS_PYTHON_VERSION atlas numpy scipy matplotlib nose dateutil pandas statsmodels
# Coverage packages are on my binstar channel
- conda install --yes -c dan_blanchard python-coveralls nose-cov
- python setup.py install
# Run test
script:
- nosetests --with-cov --cov YOUR_PACKAGE_NAME_HERE --cov-config .coveragerc --logging-level=INFO
# Calculate coverage
after_success:
- coveralls --config_file .coveragerc
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.