Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Package Manager - unable to find R #523

Open
SamEdwardes opened this issue Apr 17, 2023 · 10 comments
Open

Package Manager - unable to find R #523

SamEdwardes opened this issue Apr 17, 2023 · 10 comments
Labels
package-manager Specific to Package Manager images

Comments

@SamEdwardes
Copy link

SamEdwardes commented Apr 17, 2023

Background

When using the Helm charts I was having trouble with Package Manager. After doing some research:

  • The helm charts and docker image expect R 3.6.2
  • The docker image has R 4.2.0
docker run -it --rm rstudio/rstudio-package-manager:jammy-2022.11.4 /bin/sh
ls -la /opt/R
# drwxr-xr-x 5 root root 4096 Apr  3 00:37 4.2.0

Reprex

docker run -it \
    -p 4242:4242 \
    -e RSPM_LICENSE=$RSPM_LICENSE \
    rstudio/rstudio-package-manager:jammy-2022.11.4
WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
+ trap deactivate EXIT
+ RSPM_LICENSE_FILE_PATH=/etc/rstudio-pm/license.lic
+ /opt/rstudio-pm/bin/license-manager initialize --userspace
TTY detected. Printing informational message about logging configuration. Logging configuration loaded from '/etc/rstudio/logging.conf'. Logging to ''.
Error beginning a trial: (51): The trial has expired. You must request a trial extension from RStudio customer support.
+ true
+ '[' -z ES3X-AD28-92YJ-PBKR-FCN3-G2M8-GSTA ']'
+ /opt/rstudio-pm/bin/license-manager activate ES3X-AD28-92YJ-PBKR-FCN3-G2M8-GSTA --userspace
TTY detected. Printing informational message about logging configuration. Logging configuration loaded from '/etc/rstudio/logging.conf'. Logging to ''.

Status: Activated
Product-Key: ES3X-AD28-92YJ-PBKR-FCN3-G2M8-GSTA
Has-Key: Yes
Has-Trial: Yes
Max-Repo-Count: 0
Expiration: 2024-03-03 00:00:00
Days-Left: 321
License-Engine: 4.4.3.0
License-Scope: User

+ unset RSPM_LICENSE
+ unset RSPM_LICENSE_SERVER
+ /opt/rstudio-pm/bin/rstudio-pm --config /etc/rstudio-pm/rstudio-pm.gcfg
time="2023-04-17T19:30:49.032Z" level=info msg="Resource limits: {\"nofile\":{\"soft\":1048576,\"hard\":1048576}}"
2023/04/17 19:30:49 Starting Posit Package Manager v2022.11.4-20
2023/04/17 19:30:49 Using cache version 11
2023/04/17 19:30:49 Using metrics cache version 1
time="2023-04-17T19:30:49.046Z" level=info msg="Loading server configuration from /etc/rstudio-pm/rstudio-pm.gcfg"
2023/04/17 19:30:49 Using data directory: /var/lib/rstudio-pm
2023/04/17 19:30:49 Creating database directory: /var/lib/rstudio-pm/db
2023/04/17 19:30:49 Creating packages directory: /var/lib/rstudio-pm/packages
2023/04/17 19:30:49 Creating cran directory: /var/lib/rstudio-pm/cran
2023/04/17 19:30:49 Creating bioconductor directory: /var/lib/rstudio-pm/bioconductor
2023/04/17 19:30:49 Creating binaries directory: /var/lib/rstudio-pm/binaries
2023/04/17 19:30:49 Creating pypi directory: /var/lib/rstudio-pm/pypi
2023/04/17 19:30:49 Creating cache directory: /var/lib/rstudio-pm/cache
2023/04/17 19:30:49 Creating launcher directory: /var/lib/rstudio-pm/launcher
2023/04/17 19:30:49 Creating metrics directory: /var/lib/rstudio-pm/metrics
2023/04/17 19:30:49 Creating launcher directory: /var/lib/rstudio-pm/launcher_internal
2023/04/17 19:30:49 Using launcher directory: /var/lib/rstudio-pm/launcher
2023/04/17 19:30:49 Creating launcher_logs directory: /var/lib/rstudio-pm/launcher_internal/custom_logs
2023/04/17 19:30:49 Creating launcher_logs_user directory: /var/lib/rstudio-pm/launcher_internal/custom_logs/rstudio-pm
2023/04/17 19:30:50 Creating git directory: /var/lib/rstudio-pm/git
2023/04/17 19:30:50 Creating staging directory: /var/lib/rstudio-pm/packages/staging
2023/04/17 19:30:50 Warning: SSL is not configured. Using Package Manager over insecure HTTP is not recommended.
2023/04/17 19:30:50 A new PPM encryption key was created at '/var/lib/rstudio-pm/rstudio-pm.key'.
2023/04/17 19:30:50 Using HTTP access log: /var/log/rstudio/rstudio-pm/rstudio-pm.access.log
2023/04/17 19:30:50 No Server.Address configured, so we won't be able to direct your users back to this server.
2023/04/17 19:30:50 API Token authentication disabled
2023/04/17 19:30:50 Fetched package retention is on for CRAN
2023/04/17 19:30:50 Fetched package retention is on for Bioconductor
2023/04/17 19:30:50 Fetched package retention is on for PyPI
2023/04/17 19:30:50 Starting HTTP listener on :4242
2023/04/17 19:30:50 Starting admin service using sock file /var/run/rstudio-pm/rstudio-pm.sock
2023/04/17 19:30:50 Service ready to listen for requests
2023/04/17 19:30:50 Service mode file not found
2023/04/17 19:30:50 Starting Posit Package Manager Services
2023/04/17 19:30:50 Starting licensing...
2023/04/17 19:30:51 Usage data enabled
2023/04/17 19:30:51 Info: Unable to use user namespace sandboxing: "Error running the reexec.Command for [nsParent  echo]: fork/exec /proc/self/exe: invalid argument"
2023/04/17 19:30:51 Operating system:         ubuntu
2023/04/17 19:30:51 Operating system version: 22.04
2023/04/17 19:30:51 Kernel version:           5.15.49-linuxkit
2023/04/17 19:30:51 You are using a supported kernel (5.15.49-linuxkit), but user namespaces are not supported: reason unknown.
2023/04/17 19:30:51 Info: User namespaces are not supported on this system so Git builds will be run without process isolation/sandboxing.
2023/04/17 19:30:51 R version specified in Server.RVersion cannot be analyzed: /opt/R/3.6.2/: stat /opt/R/3.6.2/: no such file or directory
2023/04/17 19:30:51 Stopping: metrics janitor...
2023/04/17 19:30:51 Stopping: license manager...
2023/04/17 19:30:51 Stopping: metrics buffer...
2023/04/17 19:30:51 Done Stopping: license manager
2023/04/17 19:30:51 Done Stopping: metrics janitor
2023/04/17 19:30:51 Done Stopping: metrics buffer
2023/04/17 19:30:51 Stopped Posit Package Manager Online Services
2023/04/17 19:30:51 Error running services: Error: Unable to use R on this system: Could not locate an R installation
2023/04/17 19:30:51 Gracefully shutting down, received signal to terminate
2023/04/17 19:30:51 Stopping: signal dumper...
2023/04/17 19:30:51 Done Stopping: signal dumper
2023/04/17 19:30:51 Exited Posit Package Manager
+ deactivate
+ echo 'Deactivating license ...'
Deactivating license ...
+ is_deactivated=0
+ retries=0
+ [[ 0 -ne 1 ]]
+ [[ 0 -le 3 ]]
+ /opt/rstudio-pm/bin/license-manager deactivate --userspace
+ is_deactivated=1
+ (( retries+=1 ))
++ ls -A /home/rstudio-pm/.local
+ for file in $(ls -A /home/rstudio-pm/.local)
+ '[' -s /home/rstudio-pm/.local/.c773c155981f38032a617.51222781 ']'
+ [[ 1 -ne 1 ]]
@tnederlof
Copy link

I see this is in the config hard coded, does this need to be updated along with the actual version installed into /opt/R?

https://github.com/rstudio/rstudio-docker-products/blob/dev/package-manager/rstudio-pm.gcfg#L14

@SamEdwardes
Copy link
Author

The actual version installed into /opt/R is 4.2.0. So I think we should:

  • Update the docker image to hard code in 4.2.0
  • Update the helm values.yaml to not override this value

@bdeitte
Copy link
Contributor

bdeitte commented Apr 22, 2023

Heads up @tylfin and @rodrigobrim if you have any thoughts on this

@rodrigobrim
Copy link

Hi, @SamEdwardes.

Can you try setting the R version on your Helm values.yaml?

  config:
    Server:
      RVersion: /opt/R/4.2.0

@SamEdwardes
Copy link
Author

Yes, I can confirm it works if you override the default with:

config:
    Server:
      RVersion: /opt/R/4.2.0

But the default config in the Dockerfile points to an old version of R:

$ docker run -it --rm rstudio/rstudio-package-manager:jammy-2022.11.4 /bin/sh

$ cat /etc/rstudio-pm/rstudio-pm.gcfg
; RStudio Package Manager configuration file

[Server]
; Address is a public URL for this RStudio Package Manager server. Must be configured
; to enable features like including links to your content in emails. If
; Package Manager is deployed behind an HTTP proxy, this should be the URL for Package Manager
; in terms of that proxy.
;
; Address = https://rstudio-pm.company.com
Address =
;
; Git sources require a configured R installation. R is often installed at `/usr/lib/R`
; or `/usr/lib64/R`.
RVersion = /opt/R/3.6.2/
;
; Customize the data directory if necessary. This is where all packages and metadata are
; stored by default. Refer to Admin Guide for details.
;DataDir = /mnt/rspm/data
;
; Use a consistent location for the Launcher directory. The default location
; is based on the hostname, and the hostname may be different in each container.
; When customizing the data directory, this should be set to {DataDir}/launcher_internal
LauncherDir = /var/lib/rstudio-pm/launcher_internal

[HTTP]
; RStudio Package Manager will listen on this network address for HTTP connections.
Listen = :4242

[HTTPS]
; Path to a TLS certificate file. If the certificate is signed by a certificate authority, the
; certificate file should be the concatenation of the server's certificate followed by the CA's
; certificate. Must be paired with `HTTPS.Key`.
;Certificate = ""
;
; Path to a private key file corresponding to the certificate specified with `HTTPS.Certificate`.
; Required when `HTTPS.Certificate` is specified.
;Key = ""

[CRAN]
; Customize the default schedule for CRAN sync.
;SyncSchedule = "0 0 * * *"

[Bioconductor]
; Customize the default schedule for Bioconductor syncs.
;SyncSchedule = "0 2 * * *"

[PyPI]
; Customize the default schedule for PyPI syncs.
;SyncSchedule = "0 1 * * *"

; Configure Git if you are intending to build and share packages stored in Git repositories.
[Git]
; The amount of time to wait between polling git repos to look for package changes.
;PollInterval = 5m
;
; The maximum number of times to attempt building a git package when the build fails.
;BuildRetries = 3
AllowUnsandboxedGitBuilds = true

@bschwedler
Copy link
Contributor

Docker image fixes have been implemented. Just need helm chart released in rstudio/helm#402

@fh-mthomson
Copy link
Contributor

Any updates on including this in the Helm chart? thank you!

@jvroberts
Copy link

@tylfin @shepherdjerred
Now that PPM has autodetection of R/Python, should our Helm charts default to relying on that, rather than hard-coding paths as the default, to make them more reliable/future-proof?

@shepherdjerred
Copy link
Contributor

That would make sense, Joe. We can remove the Server.RVersion in our values.yaml file. This will cause the property to be unset, which will default to auto-detection.

The Docker image has R installed, so it would be successfully detected. We already take the auto-detection approach for the vanilla Docker image.

@SamEdwardes
Copy link
Author

SamEdwardes commented Mar 1, 2024

I made a PR to the helm chart that will by default, have PPM use the R and Python auto-detection (rstudio/helm#474).

However, we should also make changes to this repo. The two PPM config files:

Should be updated to use these settings:

[Server]
# An empty string will configure Package Manager to autodetect Python
PythonVersion = 
# An empty string will configure Package Manager to autodetect R
RVersion =

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package-manager Specific to Package Manager images
Projects
None yet
Development

No branches or pull requests

8 participants