-
Notifications
You must be signed in to change notification settings - Fork 183
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
environment PATH inconsistency among s6/rstudio, R, bash execution contexts #626
Comments
Spurious To enable pip package installations that require recompilation ( |
@cboettig Any thoughts on this? |
@eitsupi thanks for the ping and @hute37 thanks for the issue, we do probably need to at least document some of these things better. Additionally, some of these might need fixing or may at least unnecessary. You raise a lot of different issues here, so I'll try and hit on each but we might want to break this out into different threads.
Yes, great question, but unfortunately the answer depends on a handful of things, as @hute37 observes above. Most of these choices are not in our control. Most important of these is if you are configuring environmental variables to be accessed from the RStudio interface or another mechanism (e.g. direct bash or R console from container, not via RStudio, or via the S6 init system). RStudio's R console only gets its environmental variables from R's various .Renviron / Reviron.site and default RStudio settings, not the system environmental variables. We don't control this of course but should probably document it more clearly, along with advice about how to pass environmental variables. Many of the rocker scripts write to $R_HOME/etc/Renviron for this reason. Because Docker users frequently pass environmental variables via docker
I'm not sure why it's surprising that s6 supervisor isn't reading Renviron.site -- Renviron.site is meant to be read by R processes.
Assuming 'the service' here refers to RStudio R console? If so, yes, RStudio R console uses Renviron files, not bash profiles, for env vars.
yes, the call to rserver respects The [
Right, under vanilla ubuntu system python is never bound to If I understand correctly, your main concern is getting pyenv to use non-system python, yes? That's a rather more focused issue than the more general issue of where/how to set environmental variables (which at least does need more documentation). It's been a while since I've tested the |
about "system" pythonI think that the question related to The reason may be historical ... Ubuntu was one of the latest Linux to complete transition to python3, having many critical components in python2 (apt-get, ...), Arch was one of the first to upgrade to python3. Because system components should be placed in Note:
UBUNTU (22.04)
ARCH (Manjaro)
|
(As a somewhat total aside I also relied on just |
TL;DR pyenv/poetry in rstudio PATHNow It seems to work ... Starting from ml-verse base image I noticed that nvidia/cuda PATH directories were correctly set. I've done the same, and it'is working ! ;) Mandatory reference: |
environment references ...Trying to understand the reason why my settings get lost I found some fact that I didn't know.
NOTE:
|
Thanks @hute37 , this is great, glad things are working. We really ought to add a page documenting the use of python (which could also get into this wild west of python environment managers, (conda, pyenv, pipenv, poetry, etc) and the ml images in rocker on https://rocker-project.org/, and maybe a separate one on environmental variables? |
I found this problem when trying to enable
pyenv
+poetry
python support on a keras project based on ml-verse image.I wrote a couple of scripts,
based on standard rocker project versions
The main question is:
Following the examples, I put setting in
The
Renviron
file cannot execute bash code, so i manually expand settings given byeval
sso far, so good ...
running /bin/bash interactively in container triggers
/etc/bash.bashrc
eval
s,while running R repl can find pyenv, poetry in path:
In this setting, the right version is selected via pyenv (
.python-version
project file)Sys.which('python')
In rstudio-server session instead, I cannot configure correctly.
There is a mix of conflicting setting ...
/etc/bash.bashrc is ignored by the service. I tried to move everything under
/etc/profile.d
scripts but neither bash.bashrc nor /etc/profile get sourced.$R_HOME/etc/Renviron.site is not read by s6 supervisor but is written (!) by /etc/cont-init.d/01_set_env
/etc/services.d/rstudio/run
rewrites environment from '/etc/environment'there is also a rsession.sh that could be used un starting internal R sessions
Then:
/usr/local/bin
there is a link to system python3:In rstudio R console, i get:
in rstudio terminal, i get
Which is wrong because the paths
/usr/local/bin:/usr/lib/rstudio-server/resources/terminal/bash/.local/bin
were prepended to system path and a spurious/usr/local/bin/python
override pyenv version, under/opt/pyenv/shims
Running /bin/bash in container
Running R in container
Maybe what is missing here i a right initialization for s6 supervisor/rstudio-server configuration ...
The text was updated successfully, but these errors were encountered: