CDU-data-science-team / pxtextminingdashboard

Text mining and visualization of NHS patient feedback.
https://feedbackmatters.uk/rsconnect/text_mining_dashboard/
Other
4 stars 1 forks source link

reticulate causes RStudio to crash #31

Closed andreassot10 closed 3 years ago

andreassot10 commented 3 years ago

There seems to be a bug related to reticulate that causes RStudio to crash under a very particular occasion: closing the pxtexminingdashboard dashboard after one has first viewed tab "Polarity - text":

https://github.com/CDU-data-science-team/pxtextminingdashboard/blob/763211883f47771e67bd22d205055fb518108a22/R/app_ui.R#L132-L137

which runs golem module mod_sentiment_analysis_textblob_polarity.R.

This module uses reticulate to calculate TextBlob polarities in Python:

https://github.com/CDU-data-science-team/pxtextminingdashboard/blob/763211883f47771e67bd22d205055fb518108a22/R/mod_sentiment_analysis_textblob_polarity.R#L52-L59

Installing and running the dashboard (run_app()) causes no problems at all. I have navigated on each and every tab, including "Polarity-text" without problem.

However, the problem arises when interrupting RStudio to stop the dashboard from running:

  1. If I do not navigate on the tab "Polarity-text" at all, then interrupting RStudio works just fine.
  2. If I do navigate on the tab "Polarity-text", then interrupting RStudio causes it to crash.

I don't know why (2) happens. It looks like I'm not the only one having this issue with reticulate.:

  1. https://github.com/rstudio/reticulate/issues/683 (issue when using Shiny)
  2. https://github.com/rstudio/rstudio/issues/8189
  3. https://github.com/rstudio/reticulate/issues/827

From the issues above, I suspect it has something to do with Python environments and paths?

ChrisBeeley commented 3 years ago

I think this is fixed here https://github.com/rstudio/rstudio/pull/6140. I'm a bit unclear as to which version of RStudio it's in, it looks like 1.4 but the PR mentions 1.3

Try getting IT to install 1.4 for you and try again

andreassot10 commented 3 years ago

I'm using 1.4.1103.

ChrisBeeley commented 3 years ago

Oh, right 😆.

I'll do some more reading then

ChrisBeeley commented 3 years ago

Did you install the dev version of reticulate as suggested in one of the links @andreassot10 ?

andreassot10 commented 3 years ago

As we discussed, it seems like the new Preview Release of RStudio fixes this issue. I can't get the release to work on my personal laptop, so we will have to wait until the preview becomes a formal release and IT installs it for us at work.

Nothing can be done from our side. No reason to keep this open.