Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Travis-ci matplotlib dependency and python3

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']                                                                                                                                                              
like image 379
Darek Avatar asked Nov 13 '22 02:11

Darek


1 Answers

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.

https://github.com/rmcgibbo/mdtraj/blob/master/.travis.yml

like image 167
Robert T. McGibbon Avatar answered Nov 14 '22 22:11

Robert T. McGibbon