-
Notifications
You must be signed in to change notification settings - Fork 341
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
Document how to set environment variables for user notebooks #308
Comments
Apologies for the delayed response, and thank you for opening this issue. You can put standard JupyterHub config directives under c.Spawner.environment = {
'TEST': 'blah'
} This should put the environment variables in your users' notebook servers. |
Wow, thank you so much for pointing out how to set env variables. I've lost hours over it, too. For the record and for future reference: sagemath (called "sage" in conda) requires two environment variables. Putting the following in /opt/tljh/config/jupyterhub_config.d/environment.py makes sage stop complaining:
Well, sage is still not working, due to some very troublesome prompt_toolkit related breakage that I'm trying to figure out, but at least I'm that one step closer. (It's somewhat frustrating.) |
Dear @yuvipanda, this solution does not work for me. As mentioned above, I've created the
However, after logging in with one of the TLJH users, I do not see the Thank you. |
Hello @filippo82! You should restart TLJH after adding it - the config is only read on startup. After that, you need to stop & start the user server again. Try that out and see if that works? |
Hi @yuvipanda, thanks! Yes,
did the trick! Since I have your attention ... :) I would also need to source a file to set some variables, like this one to set up the Intel compiler:
Is there a way to do that within TLJH? Thank you. |
@filippo82 unfortunately there isn't a clean way to do that - Also you probably don't need the |
OK, thanks! |
@yuvipanda I want to set env vars per user. How can I do that? |
Is this also the way to update the PATH variable ? I would like to add a new path in the PATH variable without overriding, how can I do this using this method ? (Or there is another way to do so)? Related to evcxr/evcxr#140 |
I tend to add multi-user PATH variables via |
This issue has been mentioned on Jupyter Community Forum. There might be relevant details there: |
I managed to modify PATH as below configuration in values.yaml
|
This issue has been mentioned on Jupyter Community Forum. There might be relevant details there: |
sorry for this comment because the issue is already closed, but really I need your help for my issue: #805 |
I'm having an issue where I update the edit: The only thing that would work to refresh the environment variables was to restart the instance (we're running on AWS EC2). |
So I really wanted environmental variables on a per user instead of global (/opt/tljh/config/jupyterhub_config.d/environment.py) level. The way that I found to do it per user is in a file /home/jupyter-/.ipython/profile_default/startup/00-env.py like so: import os
os.environ["VAR1"] = "FOO"
os.environ["VAR2"] = "BAR" |
Hopefully this will help someone else-- after making a change to the config, I kept reloading the tljh config, as well as the user's kernel, but the change would not take affect. Turns out you need to restart the user's Jupyter "server". As in: Edit: To clarify, seems like the minimal required steps after updating the
|
Hi,
First of all, thank you for your great work on this project! It really is a pleasure to work with it.
I am trying to set an environment variable, so I can access it using
%env MY_ENVIRONMENT_VARIABLE
within Jupyter notebooks. Despite trying for several hours, I have not been able to achieve this simple task.I tried the following approaches:
.bashrc
.profile
/opt/tljh/config/jupyterhub_config.d
sudo tljh-config set user_environment.MY_ENVIRONMENT_VARIABLE my_value
I would be most grateful if somebody could tell me the correct way to set an environment variable on the Linux system so that I could use it within my notebooks. Thank you!
The text was updated successfully, but these errors were encountered: