Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem installation R package (windows 10) : Exception ignored from cffi callback (UnicodeDecodeError) #1026

Open
mservantufc opened this issue May 16, 2023 · 2 comments
Labels
bug Something isn't working Windows

Comments

@mservantufc
Copy link

mservantufc commented May 16, 2023

Trying to install package 'rtdists' using rpy 2 (os = windows 10, IDE = spyder, Anaconda distribution, python 3.9).

Code:

utils.install_packages('rtdists', repos="https://github.com/rtdists/rtdists/") 

Error:

Exception ignored from cffi callback <function _consolewrite_ex at 0x00000181C9861A60>:
Traceback (most recent call last):
  File "C:\Users\mservant\Anaconda3\envs\venv-ConflictTask\lib\site-packages\rpy2\rinterface_lib\callbacks.py", line 133, in _consolewrite_ex
    s = conversion._cchar_to_str_with_maxlen(buf, n, _CCHAR_ENCODING)
  File "C:\Users\mservant\Anaconda3\envs\venv-ConflictTask\lib\site-packages\rpy2\rinterface_lib\conversion.py", line 138, in _cchar_to_str_with_maxlen
    s = ffi.string(c, maxlen).decode(encoding)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe9 in position 123: invalid continuation byte
R[write to console]: Warning:
Exception ignored from cffi callback <function _consolewrite_ex at 0x00000181C9861A60>:
Traceback (most recent call last):
  File "C:\Users\mservant\Anaconda3\envs\venv-ConflictTask\lib\site-packages\rpy2\rinterface_lib\callbacks.py", line 133, in _consolewrite_ex
    s = conversion._cchar_to_str_with_maxlen(buf, n, _CCHAR_ENCODING)
  File "C:\Users\mservant\Anaconda3\envs\venv-ConflictTask\lib\site-packages\rpy2\rinterface_lib\conversion.py", line 138, in _cchar_to_str_with_maxlen
    s = ffi.string(c, maxlen).decode(encoding)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe9 in position 17: invalid continuation byte
R[write to console]: Warning:
Exception ignored from cffi callback <function _consolewrite_ex at 0x00000181C9861A60>:
Traceback (most recent call last):
  File "C:\Users\mservant\Anaconda3\envs\venv-ConflictTask\lib\site-packages\rpy2\rinterface_lib\callbacks.py", line 133, in _consolewrite_ex
    s = conversion._cchar_to_str_with_maxlen(buf, n, _CCHAR_ENCODING)
  File "C:\Users\mservant\Anaconda3\envs\venv-ConflictTask\lib\site-packages\rpy2\rinterface_lib\conversion.py", line 138, in _cchar_to_str_with_maxlen
    s = ffi.string(c, maxlen).decode(encoding)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe9 in position 17: invalid continuation byte
Out[9]: <rpy2.rinterface_lib.sexp.NULLType object at 0x00000181C9A66980> [RTYPES.NILSXP]
 
@mservantufc mservantufc added the bug Something isn't working label May 16, 2023
@lgautier
Copy link
Member

Likely related if not identical to issue #1018 .

@lgautier
Copy link
Member

This is likely because rpy2 is (wrongly) assuming UTF-8 strings.
There is an unmerged PR (#1020). Can you check if this solves the issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Windows
Projects
None yet
Development

No branches or pull requests

2 participants