Travis CI: 安装 rpy2 时出错
Travis CI: error when installing rpy2
我正在开发一个依赖于 rpy2
的 python 包。我想 运行 和 Travis CI 一起测试。在 .travis.yml
中,我使用 green
:
安装 conda 和 运行 测试
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",
],
)
Travis 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
,但是当测试 运行 和 green
时导入它时我仍然遇到错误:
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
没有安装好
错误ImportError: /home/travis/miniconda/envs/test-environment/lib/libreadline.so.6: undefined symbol: PC
其实是conda安装了readline导致的
此 Github issue 包含有关该问题的更多详细信息。
我已验证有效的解决方法是添加 import readline
。当我在 .travis.yml 上的 script
调用一个 python 脚本时 只有 有
import rpy2.robjects
我得到了同样的 ImportError: /home/travis/miniconda/envs/test-environment/lib/libreadline.so.6: undefined symbol: PC
错误。
当我使用下面的代码时,我的构建变绿了。
import readline
import rpy2.robjects
我正在开发一个依赖于 rpy2
的 python 包。我想 运行 和 Travis CI 一起测试。在 .travis.yml
中,我使用 green
:
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",
],
)
Travis 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
:
addons:
apt:
packages:
- r
但是,它并没有改变错误信息...
编辑: 在评论中有人指出我需要在 addons.apt.sources
中指定至少一个来源才能使 APT 插件工作,并且 R 包被命名为 r-base
。我在.travis.yml
中做了以下修改:
addons:
apt:
sources:
- r-packages-precise
packages:
- r-base
现在 rpy2
似乎可以找到 R
,但是当测试 运行 和 green
时导入它时我仍然遇到错误:
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
没有安装好
错误ImportError: /home/travis/miniconda/envs/test-environment/lib/libreadline.so.6: undefined symbol: PC
其实是conda安装了readline导致的
此 Github issue 包含有关该问题的更多详细信息。
我已验证有效的解决方法是添加 import readline
。当我在 .travis.yml 上的 script
调用一个 python 脚本时 只有 有
import rpy2.robjects
我得到了同样的 ImportError: /home/travis/miniconda/envs/test-environment/lib/libreadline.so.6: undefined symbol: PC
错误。
当我使用下面的代码时,我的构建变绿了。
import readline
import rpy2.robjects