What determines path when you start rstudio-server?

rstudio
rstudioserver
anaconda

#1

I do not understand this behavior:
In bash terminal:

balter@spectre:~/microbiome$ which R
/home/balter/conda/bin/R
balter@spectre:~/microbiome$ which python
/home/balter/conda/bin/python

In Rstudio terminal:

> system('echo hello')
hello
> system('whoami')
balter
> system('echo $PATH')
/sbin:/usr/sbin:/bin:/usr/bin
> system('which python')
/usr/bin/python
> system('which R')
> system('which conda')

I am starting rstudio server with sudo rstudio-server start.


#2

I'm not an expert in RStudio Server, but it's my understanding that it runs as its own user (by default rstudio-server). So that probably explains why it has a different PATH variable to you, sitting in an interactive bash session. You can also override the R used by RStudio Server, although I don't think that's what you're looking for.

This conversation on setting the environment variables might help, though!


#3

I think you really hit on something. I creating a .bash_profile for the rstudio-server user to set the path. That didn't work. I also tried using the server-user=myuser method for my user name as done here. Neither loaded the environment. So, I'm still working on it. But I think you correctly identified the problem.


#4

This answer says that you can use either a .Renviron or .Renviron.site file in lieu of .bash_profile :slight_smile: