如何在 Travis CI 中使用 python-openbabel? [英] How do I use python-openbabel in Travis CI?

查看:36
本文介绍了如何在 Travis CI 中使用 python-openbabel?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 Travis CI 作为毒理学绘图项目的一部分.对于这个项目,我需要 python-openbabel 作为依赖项.因此,我已将 apt-get 安装程序添加到 .travis.yml 文件中,如下所示(已删除注释).

I use Travis CI as part of a Toxicology mapping project. For this project I require python-openbabel as a dependency. As such, I have added the apt-get installer to the .travis.yml file, shown below ( comments removed ).

language: python
python: 
  - "2.7"
before_install:
  - sudo apt-get update -qq
  - sudo apt-get install python-openbabel
install: "pip install -r requirements.txt"
script: nosetests tox.py

但是,所有这些尝试都失败了,并显示错误消息 Error: SWIG failed.是否安装了 Open Babel?.我曾尝试将 SWIG 添加到要安装的应用程序列表中,但无济于事.

However, all these attempts failed with the error message Error: SWIG failed. Is Open Babel installed?. I have tried adding SWIG to the list of applications to be installed, to no avail.

此外,我尝试添加 Openbabel 本身提出的整个构建过程,这会产生以下 travis.yml:

Additionally, I have attempted to add the entire build process as proposed by Openbabel itself, this yields the following travis.yml:

language: python
python: 
  - "2.7"
before_install:
  - sudo apt-get update -qq
  - sudo apt-get install python-openbabel
  - wget http://downloads.sourceforge.net/project/openbabel/openbabel/2.3.1/openbabel-2.3.1.tar.gz?r=http://%3A%2F%2Fsourceforge.net%2Fprojects%2Fopenbabel%2Fopenbabel%2F2.3.1%2Fts=1393727248&use_mirror=switch
  - tar zxf openbabel-2.3.1.tar.gz
  - mkdir build
  - cd build
  - cmake ../openbabel-2.3.1 -DPYTHON_BINDINGS=ON
  - make
  - make install
  - export PYTHONPATH=/usr/local/lib:$PYTHONPATH
install: "pip install -r requirements.txt"
script: nosetests tox.py

尝试解压下载的文件时失败.

This fails when trying to untar the downloaded file.

所有失败的构建都可以在 Travis-CI 上看到:https://travis-ci.org/ToxProject/ToxProject
Github 存储库在这里:https://github.com/ToxProject/ToxProject

All the failed builds can be seen on Travis-CI: https://travis-ci.org/ToxProject/ToxProject
The Github repo is here: https://github.com/ToxProject/ToxProject

简而言之,我如何让 python-openbabel 与 Travis-CI 一起工作?

In short, how do I get python-openbabel working with Travis-CI?

推荐答案

我发现现在构建在 pip 安装需求阶段失败.Travis 创建了一个运行 python 的虚拟环境.默认情况下,系统上安装的 python 包(即通过 apt-get)将不可用,除非您将其添加到您的 travils.yml 中:

I see that now the build fails at the pip install requirements stage. Travis creates a virtual environment for running python. By default, python packages installed on the system (ie via apt-get) will not be available, unless you add this to your travils.yml:

virtualenv:
      system_site_packages: true

我在使用 python-qt4 和 python-qgis 时遇到了同样的问题,这是我最近使用的 travis.yml 文件:https://github.com/anitagraser/TimeManager/blob/master/.travis.yml

I had the same problem with python-qt4 and python-qgis, here is a travis.yml file I used recently: https://github.com/anitagraser/TimeManager/blob/master/.travis.yml

这篇关于如何在 Travis CI 中使用 python-openbabel?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆