Unable to run Python code in RStudio

Hi, I'm trying to run Python code in RStudio. Clicking the Run button gives a message:

Executing Python code requires an updated version of the reticulate package.
Do you want to install this package now?
[ Yes ] [ No ]

If I click the "Yes" button, the package appears to update just fine. Here's what is displayed in the "Jobs" window:

Installing 'reticulate' for Python/Reticulate...

Installing package into 'C:/Users/Student/Documents/R/win-library/3.5'
(as 'lib' is unspecified)

  There is a binary version available but the source version is later:
           binary source needs_compilation
reticulate   1.15   1.18              TRUE

  Binaries will be installed
trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.5/reticulate_1.15.zip'
Content type 'application/zip' length 1744105 bytes (1.7 MB)
==================================================
downloaded 1.7 MB

package 'reticulate' successfully unpacked and MD5 sums checked

The downloaded binary packages are in
	C:\Users\Student\AppData\Local\Temp\RtmpULsJq3\downloaded_packages


<U+2714> Package 'reticulate' successfully installed.

I then try running the code, and... even after doing this, I still get the exact same message saying that my reticulate package isn't up to date. Any suggestions for how to escape this loop?

You are installing the binary version, to update you need to install from source.

What does that mean? What is the difference? (And how do I do it?)

Installing from source requires compilation, for compiling packages on Windows you need to have RTools installed in your system (you can download RTools for R 3.5 from here https://cran.r-project.org/bin/windows/Rtools/history.html).

After that you can install reticulate with this command install.packages("reticulate") and when asked if you want to install from source, answer "yes".

Also, you are using a very old R version, if you update R to the latest version, R 4.0.4, chances are that a precompiled binary version of the package is available for it and you can skip the compiling process.

Ahh, this fixed it - turns out my R version was 3 years old. Thank you so much!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.