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

reticulate error on ubuntu #31

Open
lmdu opened this issue Dec 13, 2023 · 4 comments
Open

reticulate error on ubuntu #31

lmdu opened this issue Dec 13, 2023 · 4 comments

Comments

@lmdu
Copy link

lmdu commented Dec 13, 2023

Hi, and thanks a lot for this great library!

I used rchitect on ubuntu 22.04, and I encountered a problem. However, the code works well on Windows 11.

Traceback (most recent call last):
  File "/mnt/d/coding/rnasuite/src/main.py", line 50, in <module>
    rchitect.rcall('source', 'R/data.R')
  File "/usr/local/lib/python3.10/dist-packages/rchitect/interface.py", line 278, in rcall
    s = rcall_p(*args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/rchitect/interface.py", line 272, in rcall_p
    raise RuntimeError("{}".format(err))
RuntimeError: Error in eval(ei, envir) :
  python3 - /lib/python3: cannot read file data: Is a directory

In 'R/data.R' file, I used library(reticulate) to load reticulate library. Could you help me. Thanks!

@lmdu
Copy link
Author

lmdu commented Dec 14, 2023

I have fixed it. It was not a bug. I have created a link for /usr/bin/python3 to /usr/local/bin/python, and use python to run script successfully.

@lmdu
Copy link
Author

lmdu commented Dec 18, 2023

I'm sorry, I have another question.

I used rchitect and httpgd to interact with R and view plot. The httpgd server started ok. However, only the first thumbnail of plot can display, the maximized plot can not display. The http server has no response. But, in radian, I input R code from command line, the plot can immediately displayed on web page.

Can you help me to solve this problem. Thanks!

To Reproduce

import time
import rchitect

rchitect.init()
rchitect.rcall('library', 'reticulate')
rchitect.rcall('library', 'httpgd')
rchitect.rcall('hgd')
rchitect.rcall('hgd_browse')

rchitect.reval('x<-c(1,2,3,4,5,6); y<-c(4,5,6,7,8,9); plot(x,y)')

time.sleep(10)

Environment OS: Windows 11
Browser: Edge 120.0.2210.77
R version: 4.3.2
httpgd version: 1.3.1 and 2.0.0.9000

@randy3k
Copy link
Owner

randy3k commented Jan 18, 2024

You will need to "process" the events using interface.process_events(). Basically, you will need to poll the status like

While True:
    if interface.peek_event():
        interface.process_events()
    time.sleep(0.1)

@lmdu
Copy link
Author

lmdu commented Jan 18, 2024

Thank you so much. That works very well.

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