繁体   English   中英

Travis-ci matplotlib依赖和python3

[英]Travis-ci matplotlib dependency and python3

我正在尝试使用我的项目设置travis连续构建系统,该项目在其依赖项中具有numpy,scipy和matplotlib。 我的目标是python 3.3。

在我的.travis.yml脚本中,我从apt-get安装numpy和scipy,以及(确定)从pip(只有numpy)安装。 不幸的是,matplotlib构建仍然表示deps中缺少numpy。 我尝试了几乎所有在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  

以下是travis日志的有趣部分。 它表示不满足依赖性,但是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']                                                                                                                                                              

如果您不需要针对多个python版本进行测试,最简单的方法是告诉travis您的语言是c ,然后从apt-get安装所有内容。 这解决了system_site_packages和virtualenv的所有问题。

例如,这个库使用travis-ci进行测试,并依赖于完整的scipy堆栈(numpy,scipy,matplotlib,pytables,pandas等),它通过aptlanguage=c安装。

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

Apt-get,Robert McGibbon的建议,显然仍然很慢。

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