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

rmagic not displaying output in jupyter python notebook #2619

Open
mikekaminsky opened this issue Jun 29, 2017 · 7 comments
Open

rmagic not displaying output in jupyter python notebook #2619

mikekaminsky opened this issue Jun 29, 2017 · 7 comments

Comments

@mikekaminsky
Copy link

(Apologies if this is not the right the repo for this issue, or if I'm missing something obvious in the ecosystem.)

When I'm using rmagic to run models in R in the midst of my python notebook, the R output is getting sent to stdout (visible where my notebook server is running) but I can't get it to display the output in my notebook.

A notebook with these two cells should reproduce the issue.

# Setup
import rpy2
%load_ext rpy2.ipython

Run a model:

%%R
X <-c(1,4,5,7)
Y <- c(2,4,3,9)
summary(lm(Y~X))
@takluyver
Copy link
Member

This may be something that rpy2 can improve more easily in the short term. We're working on a mechanism to capture output at the OS level, which would fix this, but it's an idea we've had for years that gets bogged down in discussion every time we try to drive it forwards.

@mikekaminsky
Copy link
Author

I see some chatter about jupyter in the rpy2 repo. @takluyver If you give me some more of an idea of what you're thinking about I can try to run this down a bit farther over there.

@takluyver
Copy link
Member

Are you on Windows? If so, I think this is the issue: https://bitbucket.org/rpy2/rpy2/issues/125/set_writeconsole-not-working-on-windows

If you're on another platform, I'd recommend opening a new issue about it. Feel free to link to this issue and tag me (I'm takluyver on bitbucket as well).

@mikekaminsky
Copy link
Author

macOS unfortunately. I've tagged you over there. Thanks for the help!

@lgautier
Copy link

Repeating comment in https://bitbucket.org/rpy2/rpy2/issues/416/rmagic-not-displaying-output-in-jupyter.

The callbacks are properly function in ipython:

In [1]: import rpy2.robjects as ro                                              

In [2]: ro.r('library("dplyr")')                                                
R[write to console]: 
Attaching package: ‘dplyr’


R[write to console]: The following objects are masked from ‘package:stats’:

    filter, lag


R[write to console]: The following objects are masked from ‘package:base’:

    intersect, setdiff, setequal, union


Out[2]: 
R object with classes: ('character',) mapped to:
['dplyr', 'tools', 'stats', 'graphics', ..., 'utils', 'datasets', 'methods', 'base']

@lgautier
Copy link

Actually I cannot reproduce the issue on Linux. I am expecting that the discussion will continue in the issue tracker for rpy2, and I'll come back here if this is believed to be an issue with Jupyter.

@joseph-allen
Copy link

This still appears to be an issue

%%R
x <- c(0,1,2,3,4)
print(x)

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

4 participants