简体   繁体   English

Travis-ci matplotlib依赖和python3

[英]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. 我正在尝试使用我的项目设置travis连续构建系统,该项目在其依赖项中具有numpy,scipy和matplotlib。 I am targeting python 3.3. 我的目标是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). 在我的.travis.yml脚本中,我从apt-get安装numpy和scipy,以及(确定)从pip(只有numpy)安装。 Unfortunatelly, matplotlib build still says that numpy is missing from deps. 不幸的是,matplotlib构建仍然表示deps中缺少numpy。 I tried almost all the methods found on the WEB but most of them do not work (they are outdated I think). 我尝试了几乎所有在WEB上找到的方法,但大部分方法都不起作用(我认为它们已经过时了)。

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. 以下是travis日志的有趣部分。 It says that dependence is not satisfied, yet pip command can see numpy installed already from apt. 它表示不满足依赖性,但是pip命令可以看到已经从apt安装了numpy。

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. 如果您不需要针对多个python版本进行测试,最简单的方法是告诉travis您的语言是c ,然后从apt-get安装所有内容。 This gets around all of the issues with system_site_packages and virtualenv. 这解决了system_site_packages和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 . 例如,这个库使用travis-ci进行测试,并依赖于完整的scipy堆栈(numpy,scipy,matplotlib,pytables,pandas等),它通过aptlanguage=c安装。

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

Apt-get, Robert McGibbon's suggestion, is still apparently quite slow. Apt-get,Robert McGibbon的建议,显然仍然很慢。

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. 这是Dan Balchard使用Miniconda的一种方法 ,它将在Travis CI测试机上预安装matplotlib和scipy堆栈的其余部分。 Here's the full .travis.yml file: 这是完整的.travis.yml文件:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM