rpy2 не работает для новых Da sh и Plotly "R" и Python поддержка - PullRequest
0 голосов
/ 15 марта 2020

Только что попробовал установить rpy2 с помощью conda для использования с Da sh и новой поддержкой R для Plotly.

Вот мое окружение:

Python 3.7.6 Da sh и Plotly (последняя установка)

(dash_plotly) c: \ Users> jupyter - -version jupyter core: 4.6.2 jupyter-notebook: 6.0.3 qtconsole: 4.6.0 i python: 7.12.0 ipykernel: 5.1.4 jupyter client: 5.3.4 jupyter lab: не установлено nbconvert: 5.6.1 ipywidgets : 7.5.1 nbformat: 5.0.4 traitlets: 4.3.3

Что я пробовал

(dash_plotly) c:\Users>pip install rpy2
Collecting rpy2
  Using cached rpy2-3.2.6.tar.gz (162 kB)
    ERROR: Command errored out with exit status 1:
     command: 'c:\ProgramData\Anaconda3\envs\dash_plotly\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\rlysakow\\AppData\\Local\\Temp\\pip-install-ae13m7qp\\rpy2\\setup.py'"'"'; __file__='"'"'C:\\Users\\rlysakow\\AppData\\Local\\Temp\\pip-install-ae13m7qp\\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 'C:\Users\rlysakow\AppData\Local\Temp\pip-install-ae13m7qp\rpy2\pip-egg-info'
         cwd: C:\Users\rlysakow\AppData\Local\Temp\pip-install-ae13m7qp\rpy2\
    Complete output (69 lines):
    c:\users\rlysakow\appdata\local\temp\pip-install-ae13m7qp\rpy2\.eggs\cffi-1.14.0-py3.7-win-amd64.egg\cffi\cparser.py:164: UserWarning: Global variable 'UserBreak' in cdef(): for consistency with C it should have a storage class specifier (usually 'extern')
      "(usually 'extern')" % (decl.name,))
    c:\users\rlysakow\appdata\local\temp\pip-install-ae13m7qp\rpy2\.eggs\cffi-1.14.0-py3.7-win-amd64.egg\cffi\cparser.py:164: UserWarning: Global variable 'AllDevicesKilled' in cdef(): for consistency with C it should have a storage class specifier (usually 'extern')
      "(usually 'extern')" % (decl.name,))
    Traceback (most recent call last):
      File "c:\users\rlysakow\appdata\local\temp\pip-install-ae13m7qp\rpy2\.eggs\cffi-1.14.0-py3.7-win-amd64.egg\cffi\cparser.py", line 305, in _parse
        ast = _get_parser().parse(fullcsource)
      File "c:\users\rlysakow\appdata\local\temp\pip-install-ae13m7qp\rpy2\.eggs\pycparser-2.20-py3.7.egg\pycparser\c_parser.py", line 152, in parse
        debug=debuglevel)
      File "c:\users\rlysakow\appdata\local\temp\pip-install-ae13m7qp\rpy2\.eggs\pycparser-2.20-py3.7.egg\pycparser\ply\yacc.py", line 331, in parse
        return self.parseopt_notrack(input, lexer, debug, tracking, tokenfunc)
      File "c:\users\rlysakow\appdata\local\temp\pip-install-ae13m7qp\rpy2\.eggs\pycparser-2.20-py3.7.egg\pycparser\ply\yacc.py", line 1061, in parseopt_notrack
        lookahead = get_token()     # Get the next token
      File "c:\users\rlysakow\appdata\local\temp\pip-install-ae13m7qp\rpy2\.eggs\pycparser-2.20-py3.7.egg\pycparser\c_lexer.py", line 77, in token
        self.last_token = self.lexer.token()
      File "c:\users\rlysakow\appdata\local\temp\pip-install-ae13m7qp\rpy2\.eggs\pycparser-2.20-py3.7.egg\pycparser\ply\lex.py", line 386, in token
        newtok = self.lexerrorf(tok)
      File "c:\users\rlysakow\appdata\local\temp\pip-install-ae13m7qp\rpy2\.eggs\pycparser-2.20-py3.7.egg\pycparser\c_lexer.py", line 514, in t_error
        self._error(msg, t)
      File "c:\users\rlysakow\appdata\local\temp\pip-install-ae13m7qp\rpy2\.eggs\pycparser-2.20-py3.7.egg\pycparser\c_lexer.py", line 93, in _error
        self.error_func(msg, location[0], location[1])
      File "c:\users\rlysakow\appdata\local\temp\pip-install-ae13m7qp\rpy2\.eggs\pycparser-2.20-py3.7.egg\pycparser\c_parser.py", line 193, in _lex_error_func
        self._parse_error(msg, self._coord(line, column))
      File "c:\users\rlysakow\appdata\local\temp\pip-install-ae13m7qp\rpy2\.eggs\pycparser-2.20-py3.7.egg\pycparser\plyparser.py", line 67, in _parse_error
        raise ParseError("%s: %s" % (coord, msg))
    pycparser.plyparser.ParseError: <cdef source string>:495: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\rlysakow\AppData\Local\Temp\pip-install-ae13m7qp\rpy2\setup.py", line 183, in <module>
        'rinterface_lib/R_API_eventloop.h']}
      File "c:\ProgramData\Anaconda3\envs\dash_plotly\lib\site-packages\setuptools\__init__.py", line 144, in setup
        return distutils.core.setup(**attrs)
      File "c:\ProgramData\Anaconda3\envs\dash_plotly\lib\distutils\core.py", line 108, in setup
        _setup_distribution = dist = klass(attrs)
      File "c:\ProgramData\Anaconda3\envs\dash_plotly\lib\site-packages\setuptools\dist.py", line 448, in __init__
        k: v for k, v in attrs.items()
      File "c:\ProgramData\Anaconda3\envs\dash_plotly\lib\distutils\dist.py", line 292, in __init__
        self.finalize_options()
      File "c:\ProgramData\Anaconda3\envs\dash_plotly\lib\site-packages\setuptools\dist.py", line 740, in finalize_options
        ep.load()(self)
      File "c:\ProgramData\Anaconda3\envs\dash_plotly\lib\site-packages\setuptools\dist.py", line 747, in _finalize_setup_keywords
        ep.load()(self, ep.name, value)
      File "c:\users\rlysakow\appdata\local\temp\pip-install-ae13m7qp\rpy2\.eggs\cffi-1.14.0-py3.7-win-amd64.egg\cffi\setuptools_ext.py", line 217, in cffi_modules
        add_cffi_module(dist, cffi_module)
      File "c:\users\rlysakow\appdata\local\temp\pip-install-ae13m7qp\rpy2\.eggs\cffi-1.14.0-py3.7-win-amd64.egg\cffi\setuptools_ext.py", line 49, in add_cffi_module
        execfile(build_file_name, mod_vars)
      File "c:\users\rlysakow\appdata\local\temp\pip-install-ae13m7qp\rpy2\.eggs\cffi-1.14.0-py3.7-win-amd64.egg\cffi\setuptools_ext.py", line 25, in execfile
        exec(code, glob, glob)
      File "rpy2/_rinterface_cffi_build.py", line 166, in <module>
        ffibuilder_api = createbuilder_api()
      File "rpy2/_rinterface_cffi_build.py", line 159, in createbuilder_api
        ffibuilder.cdef(cdef)
      File "c:\users\rlysakow\appdata\local\temp\pip-install-ae13m7qp\rpy2\.eggs\cffi-1.14.0-py3.7-win-amd64.egg\cffi\api.py", line 112, in cdef
        self._cdef(csource, override=override, packed=packed, pack=pack)
      File "c:\users\rlysakow\appdata\local\temp\pip-install-ae13m7qp\rpy2\.eggs\cffi-1.14.0-py3.7-win-amd64.egg\cffi\api.py", line 126, in _cdef
        self._parser.parse(csource, override=override, **options)
      File "c:\users\rlysakow\appdata\local\temp\pip-install-ae13m7qp\rpy2\.eggs\cffi-1.14.0-py3.7-win-amd64.egg\cffi\cparser.py", line 358, in parse
        self._internal_parse(csource)
      File "c:\users\rlysakow\appdata\local\temp\pip-install-ae13m7qp\rpy2\.eggs\cffi-1.14.0-py3.7-win-amd64.egg\cffi\cparser.py", line 363, in _internal_parse
        ast, macros, csource = self._parse(csource)
      File "c:\users\rlysakow\appdata\local\temp\pip-install-ae13m7qp\rpy2\.eggs\cffi-1.14.0-py3.7-win-amd64.egg\cffi\cparser.py", line 307, in _parse
        self.convert_pycparser_error(e, csource)
      File "c:\users\rlysakow\appdata\local\temp\pip-install-ae13m7qp\rpy2\.eggs\cffi-1.14.0-py3.7-win-amd64.egg\cffi\cparser.py", line 336, 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;"
    <cdef source string>:495:96: Illegal character '\r'
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

Я не знаю, если это да sh, по сюжету, R, Rpy2 или Python проблема.

Так как я устанавливал rpy2, и это выбрасывает ошибки из другого пакета, называемого "cffi_modules". Файл яйца rpy2, возможно, был неправильным для моей платформы, Windows 10 64-bit?

...