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

R 4.0.0 support by rpy2 3.3.2 (?) #695

Closed
HanOostdijk opened this issue Apr 28, 2020 · 7 comments
Closed

R 4.0.0 support by rpy2 3.3.2 (?) #695

HanOostdijk opened this issue Apr 28, 2020 · 7 comments

Comments

@HanOostdijk
Copy link

I ran into a problem when I try to use R from a Jupyter notebook (in Windows 10).
But let's start to say that I have no experience with Jupyter and very little with Python.
Given my limited knowledge of these products I wonder if I made installation errors or that possibly my software versions are not yet supported
I installed (the most?) recent versions of Jupyter (1.0) , Python (3.8.2) , rpy2 (3.3.2) and R (4.0.0).
Also with an earlier version of R I could not get rpy2 working without error messages (see end of this issue).
I added D:/tools/R/R-4.0.0/library/grDevices/libs/x64/ to the path when I saw the error messages but without result.

I include the jupyter and console output. If anyone can help me out: TIA

Jupyter input and output:
image
image
image
Messages in command window:

[I 16:11:48.235 NotebookApp] Kernel started: 571c2282-4870-4ff0-a05f-59b01937d92c
Warning message:
package 'methods' was built under R version 4.0.0
Error: package or namespace load failed for 'grDevices' in inDL(x, as.logical(local), as.logical(now), ...):
 unable to load shared object 'D:/tools/R/R-4.0.0/library/grDevices/libs/x64/grDevices.dll':
  LoadLibrary failure:  The specified procedure could not be found.

Error: package or namespace load failed for 'graphics' in inDL(x, as.logical(local), as.logical(now), ...):
 unable to load shared object 'D:/tools/R/R-4.0.0/library/grDevices/libs/x64/grDevices.dll':
  LoadLibrary failure:  The specified procedure could not be found.

Error: package or namespace load failed for 'stats' in inDL(x, as.logical(local), as.logical(now), ...):
 unable to load shared object 'D:/tools/R/R-4.0.0/library/grDevices/libs/x64/grDevices.dll':
  LoadLibrary failure:  The specified procedure could not be found.

During startup - Warning messages:
1: package 'datasets' was built under R version 4.0.0
2: package 'utils' was built under R version 4.0.0
3: package 'grDevices' was built under R version 4.0.0
4: package 'grDevices' in options("defaultPackages") was not found
5: package 'graphics' was built under R version 4.0.0
6: package 'graphics' in options("defaultPackages") was not found
7: package 'stats' was built under R version 4.0.0
8: package 'stats' in options("defaultPackages") was not found
Error: package or namespace load failed for 'grDevices' in inDL(x, as.logical(local), as.logical(now), ...):
 unable to load shared object 'D:/tools/R/R-4.0.0/library/grDevices/libs/x64/grDevices.dll':
  LoadLibrary failure:  The specified procedure could not be found.

Error in inDL(x, as.logical(local), as.logical(now), ...) :
  unable to load shared object 'D:/tools/R/R-4.0.0/library/grDevices/libs/x64/grDevices.dll':
  LoadLibrary failure:  The specified procedure could not be found.
In addition: Warning message:
package 'tools' was built under R version 4.0.0
[I 16:13:48.138 NotebookApp] Saving file at /hannotebook.ipynb

Error message(s) in pop-up window:

Python.exe Entry Point Not Found
The procedure entry point Rf_translateCharFP could not be found in the dynamic link library  D:\tools\R\R-4.0.0\library\grDevices\libs\x64\grDevices.dll

Earlier R version:
Not to confuse the issue but also with an earlier version of R I could not get it correctly working:
with R 3.6.0 and the same other versions (Jupyter (1.0) , Python (3.8.2) , rpy2 (3.3.2) ) I got a 'UserWarning' in

D:\tools\python\python38\Lib\site-packages\rpy2\robjects\packages.py : 365
UserWarning: The symbol 'quartz' is not in this R namespace/package
    warnings.warn(
@HanOostdijk
Copy link
Author

I see that R version 4.0.0. is still a work in progress: Add R 4.0 to build matrix #697.
Thanks for all the work!

In the documentation about this change in Python package / build (3.8, 4, windows-latest) I saw in the install package section some warnings/errors that made me wonder if the build was okay (even when the documentation calls the build successful) :

13 command 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.25.28610\bin\HostX86\x64\cl.exe' failed with exit status 2
23 rpy2/_rinterface_cffi_build.py:188: UserWarning: cannot parse "void __cffi_extern_python_start; void _capsule_finalizer(SEXP); void __cffi_extern_python_stop;"
24 .cdef source string. :500:96: Illegal character '\r'
25 warnings.warn(str(e))

But if you are not worried, why would I be ?

@lgautier
Copy link
Member

lgautier commented May 3, 2020

It would be surprising if the \r error was specific to R-4.0.

Otherwise the error you have suggests a mismatch between the R library loaded at runtime and the one you'd expect to be loaded.

@HanOostdijk
Copy link
Author

Thanks Laurent, this helps.

In the path I still referenced the old folder. Replacing this by D:\tools\R\R-4.0.0\bin\x64\ I no longer get the error messages.

However two issues remain for me:

  • as a result of %load_ext rpy2.ipython I get the warning in the notebook

D:\tools\python\python38\Lib\site-packages\rpy2\robjects\packages.py : 365
UserWarning: The symbol 'quartz' is not in this R namespace/package
warnings.warn(

  • the output of R 'sessions' does not appear in the notebook but in the command window where I started the notebook. As a newbie I would expect the result to be returned in the notebook?

%%R
sessionInfo()

Output in command window (not in notebook) :

R version 4.0.0 (2020-04-24)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18363)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252
[2] LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C
[5] LC_TIME=English_United States.1252

attached base packages:
[1] tools stats graphics grDevices utils datasets methods
[8] base

loaded via a namespace (and not attached):
[1] compiler_4.0.0

@lgautier
Copy link
Member

Getting rpy2 to work again on Windows is both recent, and not yet on par with Linux or OS X. Check issue #682 to see if you can find hints about what might be the issue on your end.

@HanOostdijk
Copy link
Author

I already followed #682 but got no clues about what to do about it.
My conclusion: at the moment my configuration is not supported in a way that I would like it to be and I can't do anything about it. Game over.

@HanOostdijk
Copy link
Author

I saw today that version 3.3.3 was available. So I uninstalled version 3.3.2 and installed version 3.3.3 .
From the issues I described in #695 (comment) the most important is solved: the output of

%%R
sessionInfo()

appears now in the notebook. Now it makes sense for me to explore the Python - R interface.

The minor issue that there is a strange warning at initialisation time remains:

%load_ext rpy2.ipython
d:\python38\lib\site-packages\rpy2\robjects\packages.py:365: UserWarning: The symbol 'quartz' is not in this R namespace/package.
  warnings.warn(

Thanks for the good work

@lgautier
Copy link
Member

This is odd. Unless I am mistaken quartz is only available OS X.
Did you copy from somewhere an R initialization setup file or instructions written for Macs ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants