2014-10-01 33 views
0

我试图安装rpy2与我的Enthought python安装(在windows7下)Ipython一起使用,但不能得到这个工作(我第一次尝试安装外部软件包)。从我能理解的pip可以在Enthought下使用来安装外部软件包(请参阅,例如Using non-EPD package installers such as pip),并且该软件包似乎已下载。 EPD-python也是我的首选,所以这不应该成为一个问题。但是,在安装过程中,我得到了一个error: invalid command 'egg_info'如何在Enthought Python中安装外部软件包?

我也尝试了这个Q中的建议,明确地为PATH加上前缀:Install a Python package into a different directory using pip?(虽然问题似乎并不在于路径问题)。

我也看到this Qinvalid command 'egg_info'错误,同时建议升级setuptools的,但Enthought明确警告不要与setuptools的其他版本搞乱(见Installing packages into Canopy User Python from the OS command line) - 这也许是过时的信息认为?

这可能是一个微不足道的问题,但我不能得到这个工作。

命令:

pip install rpy2 

日志文件的部分粘贴如下:

Downloading from URL https://pypi.python.org/packages/source/r/rpy2/rpy2-2.4.3.tar.gz#md5=57e3fda409226dffb543c913c8553cdc (from https://pypi.python.org/simple/rpy2/) 
    Running setup.py (path:c:\users\tobjep\appdata\local\temp\pip_build_tobjep\rpy2\setup.py) egg_info for package rpy2 
    usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...] 
     or: -c --help [cmd1 cmd2 ...] 
     or: -c --help-commands 
     or: -c cmd --help 

    error: invalid command 'egg_info' 
    Complete output from command python setup.py egg_info: 
    usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...] 

    or: -c --help [cmd1 cmd2 ...] 

    or: -c --help-commands 

    or: -c cmd --help 

error: invalid command 'egg_info' 

---------------------------------------- 
Cleaning up... 
    Removing temporary dir c:\users\tobjep\appdata\local\temp\pip_build_tobjep... 
Command python setup.py egg_info failed with error code 1 in c:\users\tobjep\appdata\local\temp\pip_build_tobjep\rpy2 
Exception information: 
Traceback (most recent call last): 
    File "C:\Program_\EPD_python27\lib\site-packages\pip\basecommand.py", line 122, in main 
    status = self.run(options, args) 
    File "C:\Program_\EPD_python27\lib\site-packages\pip\commands\install.py", line 278, in run 
    requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle) 
    File "C:\Program_\EPD_python27\lib\site-packages\pip\req.py", line 1229, in prepare_files 
    req_to_install.run_egg_info() 
    File "C:\Program_\EPD_python27\lib\site-packages\pip\req.py", line 325, in run_egg_info 
    command_desc='python setup.py egg_info') 
    File "C:\Program_\EPD_python27\lib\site-packages\pip\util.py", line 697, in call_subprocess 
    % (command_desc, proc.returncode, cwd)) 
InstallationError: Command python setup.py egg_info failed with error code 1 in c:\users\tobjep\appdata\local\temp\pip_build_tobjep\rpy2 

更新:other advice我试图安装distributeenpkg distribute),然后重新安装pip。在此之后rpy2的安装仍然失败,但现在随着错误NameError: name 'sys_platform' is not defined

Traceback (most recent call last): 
    File "<string>", line 17, in <module> 
    File "c:\users\tobjep\appdata\local\temp\pip_build_tobjep\rpy2\setup.py", line 447, in <module> 
    'rpy2': ['doc/source/rpy2_logo.png', ]} 
    File "C:\Program_\EPD_python27\lib\distutils\core.py", line 112, in setup 
    _setup_distribution = dist = klass(attrs) 
    File "C:\Program_\EPD_python27\lib\site-packages\setuptools\dist.py", line 225, in __init__ 
    _Distribution.__init__(self,attrs) 
    File "C:\Program_\EPD_python27\lib\distutils\dist.py", line 287, in __init__ 
    self.finalize_options() 
    File "C:\Program_\EPD_python27\lib\site-packages\setuptools\dist.py", line 257, in finalize_options 
    ep.require(installer=self.fetch_build_egg) 
    File "C:\Program_\EPD_python27\lib\site-packages\pkg_resources.py", line 2099, in require 
    working_set.resolve(self.dist.requires(self.extras),env,installer)) 
    File "C:\Program_\EPD_python27\lib\site-packages\pkg_resources.py", line 2309, in requires 
    dm = self._dep_map 
    File "C:\Program_\EPD_python27\lib\site-packages\pkg_resources.py", line 2538, in _dep_map 
    self.__dep_map = self._compute_dependencies() 
    File "C:\Program_\EPD_python27\lib\site-packages\pkg_resources.py", line 2571, in _compute_dependencies 
    common = frozenset(reqs_for_extra(None)) 
    File "C:\Program_\EPD_python27\lib\site-packages\pkg_resources.py", line 2568, in reqs_for_extra 
    if req.marker_fn(override={'extra':extra}): 
    File "C:\Program_\EPD_python27\lib\site-packages\_markerlib\markers.py", line 109, in marker_fn 
    return eval(compiled_marker, environment) 
    File "<environment marker>", line 1, in <module> 
NameError: name 'sys_platform' is not defined 
Complete output from command python setup.py egg_info: 
Traceback (most recent call last): 
+0

从某种角度来看,问题依然存在。不过,我使用Enthought python找到的windows二进制文件成功安装了rpy2。现在问题是'RuntimeError:R_HOME没有定义',尽管R_HOME被定义。叹息... – fileunderwater 2014-10-01 19:10:33

回答

1

rpy2据说是很难建立在Windows上。

目前我最好的建议是尝试安装克里斯Gohlke的实验二进制编译: http://www.lfd.uci.edu/~gohlke/pythonlibs/#rpy2

由于他安装使用Windows注册表以指向Python中,你实际上应该已经在天幕制作雨棚默认的Python首选项,而不仅仅是使用Canopy命令提示符窗口。这在你链接的文章中有描述: https://support.enthought.com/entries/23389761-Installing-packages-into-Canopy-Python-from-the-command-line

+0

我刚刚做到了 - 请参阅上面的评论。这似乎工作,但我现在从Ipython中得到'RuntimeError:R_HOME not defined',即使已经定义了R_HOME。 – fileunderwater 2014-10-01 19:12:37

+0

正如我在Q中所写的,EDP-python是我的主要Python安装,首先在我的路径中。 – fileunderwater 2014-10-01 19:14:59