我正在開發一個依賴於rpy2
的python包。我想用Travis CI進行測試。在.travis.yml
我安裝暢達和運行測試與:Travis CI:安裝rpy2時出錯
language: python
# Be strict when checking our package
warnings_are_errors: true
# command to install dependencies
install:
# http://conda.pydata.org/docs/travis.html
- wget https://repo.continuum.io/miniconda/Miniconda-latest-Linux-x86_64.sh -O miniconda.sh;
- bash miniconda.sh -b -p $HOME/miniconda
- export PATH="$HOME/miniconda/bin:$PATH"
- hash -r
- conda config --set always_yes yes --set changeps1 no
- conda update -q conda
# Useful for debugging any issues with conda
- conda info -a
# Replace dep1 dep2 ... with your dependencies
- conda create -q -n test-environment python=$TRAVIS_PYTHON_VERSION numpy scipy matplotlib pandas cython
- source activate test-environment
- python setup.py install
# command to run tests
script:
- green ...
在setup.py
:
from setuptools import setup, find_packages
setup(
version="0.0.0",
name="...",
packages=find_packages(),
install_requires=[
...
"green>=2.0.7",
"rpy2>=2.7.7",
],
)
當特拉維斯CI安裝我的包,我得到以下錯誤:
Installed /home/travis/miniconda/envs/test-environment/lib/python2.7/site-packages/tubtrack-0.0.0-py2.7.egg
Processing dependencies for tubtrack==0.0.0
Searching for rpy2>=2.7.7
Reading https://pypi.python.org/simple/rpy2/
Best match: rpy2 2.7.7
Downloading https://pypi.python.org/packages/source/r/rpy2/rpy2-2.7.7.tar.gz#md5=be93432426744cdae8a0e5d2b157d371
Processing rpy2-2.7.7.tar.gz
Writing /tmp/easy_install-CF50ds/rpy2-2.7.7/setup.cfg
Running rpy2-2.7.7/setup.py -q bdist_egg --dist-dir /tmp/easy_install-CF50ds/rpy2-2.7.7/egg-dist-tmp-TTJjtB
error: Setup script exited with Error: Tried to guess R's HOME but no command (R) in the PATH.
我想知道如果有人知道如何解決它?我試圖在.travis.yml
安裝R:
addons:
apt:
packages:
- r
但是,它並沒有改變錯誤信息......
編輯:在有人指出,我需要至少指定一個評論來源addons.apt.sources
APT插件的工作和R包被命名爲r-base
。我做了以下修改中.travis.yml
:
addons:
apt:
sources:
- r-packages-precise
packages:
- r-base
現在看來,rpy2
可以找到R
,但我仍然得到一個錯誤,當測試期間,與運行輸入:
Traceback (most recent call last):
File "/home/travis/miniconda/envs/test-environment/lib/python2.7/site-packages/green-2.2.0-py2.7.egg/green/loader.py", line 212, in loadFromModuleFilename
__import__(dotted_module)
File "xxx/xxx/xxx.py", line 4, in <module>
from .. import tools
File "xxx/tools.py", line 5, in <module>
import rpy2.robjects as robjects
File "/home/travis/miniconda/envs/test-environment/lib/python2.7/site-packages/rpy2-2.7.7-py2.7-linux-x86_64.egg/rpy2/robjects/__init__.py", line 15, in <module>
import rpy2.rinterface as rinterface
File "/home/travis/miniconda/envs/test-environment/lib/python2.7/site-packages/rpy2-2.7.7-py2.7-linux-x86_64.egg/rpy2/rinterface/__init__.py", line 99, in <module>
from rpy2.rinterface._rinterface import *
ImportError: /home/travis/miniconda/envs/test-environment/lib/libreadline.so.6: undefined symbol: PC
但是,在我的筆記本電腦上它工作正常!所以我想這個問題仍然是rpy2
沒有正確安裝。
R不是包裝。從[這裏]安裝(https://cran.r-project.org/)。當然,確保它在你的PATH上。 – alistaire
你知道如何自動使用Travis CI嗎? – desa
Sorta在我的區域之外,但可能類似[this](https://docs.travis-ci.com/user/languages/r)。 – alistaire