'RStudio compatibility with R version 4.2.0

Is RStudio 2021.09.0+351 compatible with R version 4.2.0? I am on Windows 8.1 with UCRT installed, using RStudio 2021.09.0+351. It works fine with R 4.1.3, but if I update to 4.2.0, then RStudio does not even start. I get the following Startup Failure Report.

## R Session Startup Failure Report

### RStudio Version

RStudio 2021.09.0+351, "Ghost Orchid" (077589bc, 2021-09-20) for Windows

Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) QtWebEngine/5.12.8 Chrome/69.0.3497.128 Safari/537.36

### Error message

[No error available]

### Process Output

The R session exited with code -1073740791. 

Error output:


[No errors emitted]


Standard output:


[No output emitted]


### Logs

*C:/Users/FJG/AppData/Local/RStudio/log/rsession-FJG.log*


2022-05-19T13:56:53.053155Z [rsession-FJG] WARNING findProgramOnPath returns wrong result: C:\PROGRA~1\texlive\2019\bin\win32\pdflatex.exe != C:/Program Files/texlive/2019/bin/win32/pdflatex.exe; LOGGED FROM: class rstudio::core::FilePath __cdecl rstudio::session::module_context::findProgram(const class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > &) src/cpp/session/SessionModuleContext.cpp:1206
2022-05-19T13:57:02.575089Z [rsession-FJG] ERROR system error 10053 (Se ha anulado una conexi�n establecida por el software en su equipo host.) [request-uri: /events/get_events]; OCCURRED AT void __cdecl rstudio::session::HttpConnectionImpl<class rstudio_boost::asio::ip::tcp>::sendResponse(const class rstudio::core::http::Response &) src/cpp/session/http/SessionWin32HttpConnectionListener.cpp:114; LOGGED FROM: void __cdecl rstudio::session::HttpConnectionImpl<class rstudio_boost::asio::ip::tcp>::sendResponse(const class rstudio::core::http::Response &) src/cpp/session/http/SessionWin32HttpConnectionListener.cpp:119
2022-05-19T13:57:02.575089Z [rsession-FJG] ERROR system error 10053 (Se ha anulado una conexi�n establecida por el software en su equipo host.) [request-uri: /events/get_events]; OCCURRED AT void __cdecl rstudio::session::HttpConnectionImpl<class rstudio_boost::asio::ip::tcp>::sendResponse(const class rstudio::core::http::Response &) src/cpp/session/http/SessionWin32HttpConnectionListener.cpp:114; LOGGED FROM: void __cdecl rstudio::session::HttpConnectionImpl<class rstudio_boost::asio::ip::tcp>::sendResponse(const class rstudio::core::http::Response &) src/cpp/session/http/SessionWin32HttpConnectionListener.cpp:119

May I update to RStudio-2022.02.2-485 using Windows 8.1?

Thanks a lot.



Solution 1:[1]

It is very unlikely that the problems you see are due to RStudio/R4.2 compatibility. It is more probably an OS compatibility issue - Windows 8.1 is quite old, and a lot can go wrong.

The first thing to note is the comment in the download page:

This build requires UCRT, which is part of Windows since Windows 10 and Windows Server 2016. On older systems, UCRT has to be installed manually from here.

If installing UCRT doesn't suffice, I'd suggest to carefully go over the doc section Does R run under Windows Vista/7/8/10/11/Server (although it is mostly about user permissions, you might catch something relevant to your case)

Solution 2:[2]

The problem is that when you are assigning to j inside func2, you are creating a new local variable inside that function. Python then tries to reference that local variable (j) on the right-hand side of the assignment, and can't find any value assigned to it yet.

A possible solution is to use the nonlocal keyword on j like this:

def func1():
    nums = [1,3]
    j = 1
    def func2(k):
        nonlocal j
        nums.append(k)
        print(nums)
        j = j + k
        print(j)
    func2(5)
func1()

Which produces

[1, 3, 5]
6

This post is related an might give you some more clarity: Python 3: UnboundLocalError: local variable referenced before assignment

Also some more information from the Python docs: https://docs.python.org/3/faq/programming.html#why-am-i-getting-an-unboundlocalerror-when-the-variable-has-a-value

Solution 3:[3]

def func2(j, k)

And call it with:

func2(j, 5)

Worked when I tested it like this.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Ofek Shilon
Solution 2 André Krosby
Solution 3 ouflak