Getting a seemingly obvious error (that I can't figure out how to troubleshoot) when trying to deploy any content to RStudio Connect on Apache Ubuntu 20.04 server.
"Cannot find compatible environment: no compatible Local environment with R version 4.1.2"
We specified R 4.1.2 in the manifest.json file, and R 4.1.2 is on PATH of the server. Any help would be greatly appreciated!
Which versions of R do you have installed on the server and where are they located? Which R versions are recognized by Connect, i.e. which are shown at the bottom of the "Documentation" tab? Do you use any RVersion* settings in /etc/rstudio-connect/rstudio-connect.gcfg?
/usr/lib/R -- version 3.6.3 (this is the version of R that RStudio Connect is using) /opt/R -- version 4.1.2 (this is the version of R that I would like RStudio Connect to use instead)
Note that the version of R on the PATH is also 4.1.2.
The "Documentation" tab shows only version 3.6.3 recognized.
Is it an acceptable solution to update the version of R at /usr/lib/R to a newer version (e.g., 4.1.2)? If so, are there any best practices for executing that update safely?
I did try adding the following line to the /etc/rstudio-connect/rstudio-connect.gcfg file:
[Server]
RVersion = /opt/R/4.1.2
And I restarted the service via sudo systemctl restart rstudio-connect, but the issue still remains (can only find 3.6.3 on deployment from RStudio IDE, and the "Documentation" tab still only shows 3.6.3)
However, when I add RVersionScanning = false to that block, it breaks RStudio Connect altogether (I receive a 503 error in the browser)
Here's what I see for error messages in the server log -- this might be helpful:
2022/04/06 17:15:18 Could not detect R at /opt/R/4.1.2/bin/R: Could not run R as rstudio-connect; exit status 1; received output: '/opt/R/4.1.2/bin/R: line 1 93: /usr/bin/sed: No such file or directory
ERROR: option '-e' requires a non-empty argument'
2022/04/06 17:15:18 Could not detect R at /opt/R/4.1.2/bin/R: Could not run R as rstudio-connect; exit status 1; received output: '/opt/R/4.1.2/bin/R: line 1 93: /usr/bin/sed: No such file or directory
ERROR: option '-e' requires a non-empty argument'
2022/04/06 17:15:18 Detected R version 3.6.3 at /usr/lib/R/bin/R
2022/04/06 17:15:18 Warning: Using system-provided R (/usr/lib/R/bin/R, discovered via Server.RVersionScanning) is not recommended. Installing the desired R versions from source will help avoid unexpected version changes. Use Server.RVersion to enumerate the different R installations on this server. See https://d ocs.rstudio.com/connect/admin/getting-started/#installation.
I assume it is trying to use the R version I specified in the rstudio-connect.gcfg file, but is expecting some directory (usr/bin/sed) that doesn't exist?
I'm not sure if this helps either, but there are a lot more files in /usr/lib/R/bin (which is where RStudio Connect is getting R) than there are in /opt/R/4.1.2/bin/ (which is where I want RStudio Connect to get R from)
It is looking for the sed program in /usr/bin/sed. It is unusual that this file does not exist. Is sed installed? You can test that with which sed and dpkg -l sed. If it is not installed, you can use sudo apt-get install sed to install it.
Here's what I get from running those two commands:
root@inresgb-0002:/# which sed
/bin/sed
and
root@inresgb-0002:/# dpkg -l sed
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-==============-============-============-=================================================
ii sed 4.7-1 amd64 GNU stream editor for filtering/transforming text
It looks like sed is installed at /bin/sed (but not at /usr/bin/sed, where RStudio Connect is looking for it), but perhaps it is also corrupt based upon some of the output from the second command above?
This is really interesting. The script that launches R expects /usr/bin/sed, which is determined when R is configured and built. How was your server provisioned? What R install are you using?
For reference, the ubuntu:20.04 Docker image has /bin as a symbolic link to /usr/bin, meaning /bin/sed and /usr/bin/sed are both valid paths, even though the sed package only installs into /bin/sed.
Creating the symlink solved the issue! I can't thank you enough for the help @aron & @rstub ! This was clearly over my head and a good reminder to always check the logs first...