rchitect icon indicating copy to clipboard operation
rchitect copied to clipboard

reticulate error on ubuntu

Open lmdu opened this issue 1 year ago • 4 comments
trafficstars

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 avatar Dec 13 '23 12:12 lmdu

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 avatar Dec 14 '23 00:12 lmdu

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

lmdu avatar Dec 18 '23 02:12 lmdu

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)

randy3k avatar Jan 18 '24 07:01 randy3k

Thank you so much. That works very well.

lmdu avatar Jan 18 '24 08:01 lmdu