我使用 Travis CI 作为毒理学绘图项目的一部分。对于这个项目,我需要 python-openbabel 作为依赖项。因此,我已将 apt-get 安装程序添加到 .travis.yml 文件中,如下所示(已删除注释)。
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. Is Open Babel installed?
。我尝试将 SWIG 添加到要安装的应用程序列表中,但无济于事。
此外,我尝试添加 Openbabel 本身提出的整个构建过程,这会产生以下 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
尝试解压下载的文件时会失败。
所有失败的构建都可以在 Travis-CI 上看到:https://travis-ci.org/ToxProject/ToxProject https://travis-ci.org/ToxProject/ToxProject
Github 存储库在这里:https://github.com/ToxProject/ToxProject https://github.com/ToxProject/ToxProject
简而言之,我如何获得python-openbabel
与 Travis-CI 合作?
The version of openbabel installed via apt-get is 1.7 while the version specified in setup.py in requirements.txt is openbabel>=1.8
.
This make makes the package installed by apt-get not satisfy the requirements.txt
and pip is trying install it regardless the installed old version of openbabel. And virtualenv doesn't use the already installed system packages.
And when install openbabel via pip, it needs the header files of libopenbabel
which is not included in libopenbabel4
which is automatically installed by python-openbabel
The version of libopenbabel-dev
in ubuntu 12.04 used by travisCI doesn't satisfy the needs of openbabel==1.8
.
解决方案:
安装较新版本的libopenbabel-dev
and libopenbabel4
手动:
before_install:
- sudo apt-get install -qq -y swig python-dev
- wget http://mirrors.kernel.org/ubuntu/pool/universe/o/openbabel/libopenbabel4_2.3.2+dfsg-1.1_amd64.deb
- sudo dpkg -i libopenbabel4_2.3.2+dfsg-1.1_amd64.deb
- wget http://mirrors.kernel.org/ubuntu/pool/universe/o/openbabel/libopenbabel-dev_2.3.2+dfsg-1.1_amd64.deb
- sudo dpkg -i libopenbabel-dev_2.3.2+dfsg-1.1_amd64.deb
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)