-
Notifications
You must be signed in to change notification settings - Fork 0
/
.Rprofile
31 lines (22 loc) · 1.25 KB
/
.Rprofile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# This file configures the virtualenv and Python paths differently depending on
# the environment the app is running in (local vs remote server).
# Edit this name if desired when starting a new app
VIRTUALENV_NAME = 'python_env'
# ------------------------- Settings (Do not edit) -------------------------- #
if (Sys.info()[['user']] == 'shiny'){
# Running on shinyapps.io
Sys.setenv(PYTHON_PATH = 'python3')
Sys.setenv(VIRTUALENV_NAME = VIRTUALENV_NAME) # Installs into default shiny virtualenvs dir
Sys.setenv(RETICULATE_PYTHON = paste0('/home/shiny/.virtualenvs/', VIRTUALENV_NAME, '/bin/python'))
} else if (Sys.info()[['user']] == 'rstudio-connect'){
# Running on remote server
Sys.setenv(PYTHON_PATH = '/opt/python/3.7.7/bin/python3')
Sys.setenv(VIRTUALENV_NAME = paste0(VIRTUALENV_NAME, '/')) # include '/' => installs into rstudio-connect/apps/
Sys.setenv(RETICULATE_PYTHON = paste0(VIRTUALENV_NAME, '/bin/python'))
} else {
# Running locally
options(shiny.port = 7450)
Sys.setenv(PYTHON_PATH = 'python')
Sys.setenv(VIRTUALENV_NAME = VIRTUALENV_NAME) # exclude '/' => installs into ~/.virtualenvs/
# RETICULATE_PYTHON is not required locally, RStudio infers it based on the ~/.virtualenvs path
}