randy3k / radian

A 21 century R console
MIT License
1.96k stars 73 forks source link

httpgd no longer working in radian #446

Closed uhkeller closed 7 months ago

uhkeller commented 7 months ago

Recently, httpgd devices have stopped working in radian R sessions, while continuing to work just fine in a normal R session.

Steps to reproduce

Start radian

Run httpgd::hgd() and open the supplied URL.

Generate a plot, for example with plot(rnorm(100)).

In the browser window, the thumbnail of the generated plot is displayed, but the actual plot area stays empty. Subsequent plotting commands have no effect at all. Quitting the radian R session using q() does not work, the session hangs.

Other info

In a standard R session everything works just fine.

I'm using R 4.3.2 on macOS 13.6, radian version 0.6.8, Python 3.11.6. httpgd: current HEAD on GitHub and version 1.3.1.

Other Python packages:

rchitect 0.4.4 prompt-toolkit 3.0.40 pygments 2.16.1 wcwidth 0.2.9 cffi 1.16.0 six 1.16.0 pycparser 2.21

memeplex commented 7 months ago

I downgraded to radian==0.6.6 with rchitect==0.3.39 but it is the same.

I had upgraded my venv last weekend and the issue probably started happening at that point, because I remember having used httpgd with radian just fine last week.

benz0li commented 7 months ago

The problem is prompt-toolkit ≥ 3.0.40. Downgrade to prompt-toolkit==3.0.39 and it works again.

Ping @jonathanslenders

benz0li commented 7 months ago

The diff from 3.0.39 to 3.0.40: https://github.com/prompt-toolkit/python-prompt-toolkit/compare/490cf900188df357611cdc9358256be0e5ce2e16...b6a9f05f9a71f82785a4d2ba99bd12a7072744e1

@randy3k Any idea what could have caused this? Maybe https://github.com/prompt-toolkit/python-prompt-toolkit/commit/27cb5c05af3f5f8cdfc5b5093e44bc92cbfca0d4?

benz0li commented 7 months ago

Ping @renkun-ken as the R Extension for Visual Studio Code recommends the use of radian and httpgd.

acser00 commented 7 months ago

I had a similar issue of rendering plots using httpgd. I am using macOS 13.6, R 4.3.1, and radian 0.6.8. Downgrading to prompt-toolkit==3.0.39 using pip install --force-reinstall prompt-toolkit==3.0.39 has solved this issue on my system.

randy3k commented 7 months ago

Oh, good find. Let me check wha T they have changed.

randy3k commented 7 months ago

Looks like 3.0.41 has a fix for Ipython. Though it doesn't work for us.

https://github.com/prompt-toolkit/python-prompt-toolkit/commit/8c601936b11d91388edc653df80aa34bd9cb1606

memeplex commented 7 months ago

I've upgraded to 3.0.41 and the problem persists. Downgrading to 3.0.39 fixed it.

pehkawn commented 7 months ago

I've upgraded to 3.0.41 and the problem persists. Downgrading to 3.0.39 fixed it.

Can confirm this worked. In addition to downgrading to prompt-tookit 3.0.39, I had to downgrade radian to v 0.6.7 for compatibility.

randy3k commented 7 months ago

The current version of radian should be compatible with the new version of prompt-toolkit.

benz0li commented 7 months ago

The current version of radian should be compatible with the new version of prompt-toolkit.

I can confirm that it works with the latest versions of radian (currently v0.6.9) and prompt-tookit (currently v3.0.41).

This can be verified by anyone with a GitHub account on my reference deployment at https://demo.jupyter.b-data.ch.