0

I try to install rpy2 using pip.

I user windows 10.

I run the pip command in cmd console with admin option

However I receive this error:

pip install rpy2

 Collecting rpy2
      Using cached https://files.pythonhosted.org/packages/7e/e0/7da849bb6cf47466ceb28a75f930e61c311878882c275dfb4bbb4fdcc3cb/rpy2-3.2.0.tar.gz
        ERROR: Command errored out with exit status 1:
         command: 'c:\users\mary\appdata\local\programs\python\python37-32\python.exe'

-c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\Mary\AppData\Local\Temp\pip-install-bov9dean\rpy2\setup.py'"'"'; file='"'"'C:\Users\Mary\AppData\Local\Temp\pip-install-bov9dean\rpy2\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' egg_info --egg-base pip-egg-info cwd: C:\Users\Mary\AppData\Local\Temp\pip-install-bov9dean\rpy2\ Complete output (79 lines): test_pw_r.c C:\Users\Mary\AppData\Local\Temp\tmp_pw_r_b9t41l4r\test_pw_r.c(1): fatal error C1083: Cannot open include file: 'Rinterface.h': No such file or directory warning: no previously-included files found matching 'setup.pyc' warning: no previously-included files matching 'yacctab.' found under directory 'tests' warning: no previously-included files matching 'lextab.' found under directory 'tests' warning: no previously-included files matching 'yacctab.' found under directory 'examples' warning: no previously-included files matching 'lextab.' found under directory 'examples' zip_safe flag not set; analyzing archive contents... pycparser.ply.pycache.lex.cpython-37: module references file pycparser.ply.pycache.lex.cpython-37: module MAY be using inspect.getsourcefile pycparser.ply.pycache.yacc.cpython-37: module references file pycparser.ply.pycache.yacc.cpython-37: module MAY be using inspect.getsourcefile pycparser.ply.pycache.yacc.cpython-37: module MAY be using inspect.stack pycparser.ply.pycache.ygen.cpython-37: module references file

        Installed c:\users\mary\appdata\local\temp\pip-install-bov9dean\rpy2\.eggs\pycparser-2.19-py3.7.egg
        Traceback (most recent call last):
          File "c:\users\mary\appdata\local\temp\pip-install-bov9dean\rpy2\.eggs\cffi-1.12.3-py3.7-win32.egg\cffi\cparser.py",

line 294, in _parse ast = _get_parser().parse(fullcsource) File "c:\users\mary\appdata\local\temp\pip-install-bov9dean\rpy2.eggs\pycparser-2.19-py3.7.egg\pycparser\c_parser.py", line 152, in parse debug=debuglevel) File "c:\users\mary\appdata\local\temp\pip-install-bov9dean\rpy2.eggs\pycparser-2.19-py3.7.egg\pycparser\ply\yacc.py", line 331, in parse return self.parseopt_notrack(input, lexer, debug, tracking, tokenfunc) File "c:\users\mary\appdata\local\temp\pip-install-bov9dean\rpy2.eggs\pycparser-2.19-py3.7.egg\pycparser\ply\yacc.py", line 1061, in parseopt_notrack lookahead = get_token() # Get the next token File "c:\users\mary\appdata\local\temp\pip-install-bov9dean\rpy2.eggs\pycparser-2.19-py3.7.egg\pycparser\c_lexer.py", line 77, in token self.last_token = self.lexer.token() File "c:\users\mary\appdata\local\temp\pip-install-bov9dean\rpy2.eggs\pycparser-2.19-py3.7.egg\pycparser\ply\lex.py", line 386, in token newtok = self.lexerrorf(tok) File "c:\users\mary\appdata\local\temp\pip-install-bov9dean\rpy2.eggs\pycparser-2.19-py3.7.egg\pycparser\c_lexer.py", line 484, in t_error self._error(msg, t) File "c:\users\mary\appdata\local\temp\pip-install-bov9dean\rpy2.eggs\pycparser-2.19-py3.7.egg\pycparser\c_lexer.py", line 93, in _error self.error_func(msg, location[0], location[1]) File "c:\users\mary\appdata\local\temp\pip-install-bov9dean\rpy2.eggs\pycparser-2.19-py3.7.egg\pycparser\c_parser.py", line 193, in _lex_error_func self._parse_error(msg, self._coord(line, column)) File "c:\users\mary\appdata\local\temp\pip-install-bov9dean\rpy2.eggs\pycparser-2.19-py3.7.egg\pycparser\plyparser.py", line 67, in _parse_error raise ParseError("%s: %s" % (coord, msg)) pycparser.plyparser.ParseError: :492:96: Illegal character '\r'

        During handling of the above exception, another exception occurred:

        Traceback (most recent call last):
          File "<string>", line 1, in <module>
          File "C:\Users\Mary\AppData\Local\Temp\pip-install-bov9dean\rpy2\setup.py",

line 182, in 'rpy2/rinterface_lib/R_API_eventloop.h'])], File "c:\users\mary\appdata\local\programs\python\python37-32\lib\site-packages\setuptools__init__.py", line 145, in setup return distutils.core.setup(**attrs) File "c:\users\mary\appdata\local\programs\python\python37-32\lib\distutils\core.py", line 108, in setup _setup_distribution = dist = klass(attrs) File "c:\users\mary\appdata\local\programs\python\python37-32\lib\site-packages\setuptools\dist.py", line 444, in init k: v for k, v in attrs.items() File "c:\users\mary\appdata\local\programs\python\python37-32\lib\distutils\dist.py", line 292, in init self.finalize_options() File "c:\users\mary\appdata\local\programs\python\python37-32\lib\site-packages\setuptools\dist.py", line 732, in finalize_options ep.load()(self, ep.name, value) File "c:\users\mary\appdata\local\temp\pip-install-bov9dean\rpy2.eggs\cffi-1.12.3-py3.7-win32.egg\cffi\setuptools_ext.py", line 217, in cffi_modules add_cffi_module(dist, cffi_module) File "c:\users\mary\appdata\local\temp\pip-install-bov9dean\rpy2.eggs\cffi-1.12.3-py3.7-win32.egg\cffi\setuptools_ext.py", line 49, in add_cffi_module execfile(build_file_name, mod_vars) File "c:\users\mary\appdata\local\temp\pip-install-bov9dean\rpy2.eggs\cffi-1.12.3-py3.7-win32.egg\cffi\setuptools_ext.py", line 25, in execfile exec(code, glob, glob) File "rpy2/_rinterface_cffi_build.py", line 164, in ffibuilder_api = createbuilder_api() File "rpy2/_rinterface_cffi_build.py", line 157, in createbuilder_api ffibuilder.cdef(cdef) File "c:\users\mary\appdata\local\temp\pip-install-bov9dean\rpy2.eggs\cffi-1.12.3-py3.7-win32.egg\cffi\api.py", line 112, in cdef self._cdef(csource, override=override, packed=packed, pack=pack) File "c:\users\mary\appdata\local\temp\pip-install-bov9dean\rpy2.eggs\cffi-1.12.3-py3.7-win32.egg\cffi\api.py", line 126, in _cdef self._parser.parse(csource, override=override, **options) File "c:\users\mary\appdata\local\temp\pip-install-bov9dean\rpy2.eggs\cffi-1.12.3-py3.7-win32.egg\cffi\cparser.py", line 347, in parse self._internal_parse(csource) File "c:\users\mary\appdata\local\temp\pip-install-bov9dean\rpy2.eggs\cffi-1.12.3-py3.7-win32.egg\cffi\cparser.py", line 352, in _internal_parse ast, macros, csource = self._parse(csource) File "c:\users\mary\appdata\local\temp\pip-install-bov9dean\rpy2.eggs\cffi-1.12.3-py3.7-win32.egg\cffi\cparser.py", line 296, in _parse self.convert_pycparser_error(e, csource) File "c:\users\mary\appdata\local\temp\pip-install-bov9dean\rpy2.eggs\cffi-1.12.3-py3.7-win32.egg\cffi\cparser.py", line 325, in convert_pycparser_error raise CDefError(msg) cffi.CDefError: cannot parse "void __cffi_extern_python_start; void _capsule_finalizer(SEXP); void __cffi_extern_python_stop;" :492:96: Illegal character '\r' ---------------------------------------- ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

Any idea please what should I fix?

What is egg_info ?

Is an alternative option to install it?

2 Answers 2

1

Seems like there happens to be a cache issue. Have you installed the package before ? If yes then try to uninstall the package and then try reinstalling it once.

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

1 Comment

Thank you. I tried to unistall rpy2 but it is not exist
1

It may be because you need the R libraries. It Should work using anaconda. First install anaconda (see https://www.anaconda.com/distribution/) Then you install running from the anaconda console.

conda install rpy2

The difference is that it will take care of the dependencies. See last and most recent answer in: Installing rpy2 for Python 3 using pip

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.