0

I'm trying to install rpy2 to use with Ipython under my Enthought python installation (under windows7), but cannot get this to work (my first attempt to install external packages). From what I can understand pip can be used under Enthought to install external packages (see e.g. Using non-EPD package installers such as pip), and the package seems to be downloaded. EPD-python is also first in my path, so this should not be an issue. However, during installation I get an the error: invalid command 'egg_info'.

I have also tried the suggestions in this Q to explicitly prefix the PATH: Install a Python package into a different directory using pip? (the problem doesn't seem to lie in a path issue though).

I have also seen this Q on the invalid command 'egg_info' error, with the suggestion to upgrade setuptools, but Enthought explicitly warns against messing with other versions of setuptools (see Installing packages into Canopy User Python from the OS command line) - maybe this is obsolete info thought?.

This might be a trivial question, but I cannot get this working.

Command:

pip install rpy2

A section of the log file is pasted below:

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

Update: Following other advice I tried to install distribute (enpkg distribute) and then reinstalling pip. After this the installation of rpy2 still fails, but now with the error 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):
1
  • In one way, the question still stands. However, I successfully installed rpy2 using the windows binary, which is found by Enthought python. Now with the problem RuntimeError: R_HOME not defined though, even thought R_HOME is defined. Sigh... Commented Oct 1, 2014 at 19:10

1 Answer 1

1

rpy2 is reputedly difficult to build on Windows.

My best suggestion at present would be to try installing Chris Gohlke's experimental binary build: http://www.lfd.uci.edu/~gohlke/pythonlibs/#rpy2

Since his installers use the Windows registry to point to Python, you should actually have made Canopy your default Python in the Canopy preferences, not merely be using a Canopy Command Prompt window. This is described in the article that you linked: https://support.enthought.com/entries/23389761-Installing-packages-into-Canopy-Python-from-the-command-line

Sign up to request clarification or add additional context in comments.

2 Comments

I just did this - see comment above. This seems to work but I now get the RuntimeError: R_HOME not defined from within Ipython, even though R_HOME is defined.
And as I wrote in the Q EDP-python is my main python installation, first in my path.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.