简体   繁体   中英

R packages Rssa is not imported to python with rpy2 importr

When I executed in Python command

rssa = importr('Rssa')

I got eroor

Traceback (most recent call last):
  File "<pyshell#3>", line 1, in <module>
    rssa = importr('Rssa')
  File "C:\Python34\lib\site-packages\rpy2\robjects\packages.py", line 412, in importr
    version = version)
  File "C:\Python34\lib\site-packages\rpy2\robjects\packages.py", line 178, in __init__
    self.__fill_rpy2r__(on_conflict = on_conflict)
  File "C:\Python34\lib\site-packages\rpy2\robjects\packages.py", line 280, in __fill_rpy2r__
    super(SignatureTranslatedPackage, self).__fill_rpy2r__(on_conflict = on_conflict)
  File "C:\Python34\lib\site-packages\rpy2\robjects\packages.py", line 233, in __fill_rpy2r__
    rpyobj = conversion.ri2ro(riobj)
  File "C:\Python34\lib\functools.py", line 707, in wrapper
    return dispatch(args[0].__class__)(*args, **kw)
  File "C:\Python34\lib\site-packages\rpy2\robjects\__init__.py", line 101, in _
    return SignatureTranslatedFunction(obj)
  File "C:\Python34\lib\site-packages\rpy2\robjects\functions.py", line 150, in __init__
    raise ValueError("Error: '%s' already in the translation table. This means that the signature of the R function contains the parameters '%s' and/or '%s' <sigh> in multiple copies." %(r_param, r_param, prm_translate[py_param]))
ValueError: Error: '...' already in the translation table. This means that the signature of the R function contains the parameters '...' and/or '...' <sigh> in multiple copies.

Other packages are imported without problem, as example

stats = importr('stats')
tseries = importr('tseries')
forecast = importr('forecast')

I was looking for such problem, but I could not find nothing close. Please, suggest some decision of this problem.

This was caused by bug in Rssa when it tries to take control over 'decompose' function (which is exported from 'stats' package). In particular, in the list of formals '...' is added twice and this is what rpy2 is complaining about.

This will be fixed in the subsequent Rssa releases.

The only workaround is to comment out in R/common.R the following line:

formals(decompose.default) <- c(formals(decompose.default), alist(... = ))

And reinstall Rssa from source. This might be non-trivial on Windows, though R windows builder can help here.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM