[TLJH] Environment PATH different in notebook than terminal

What am I missing?
in the notebook:
! echo $PATH


open a terminal from launcher and type echo $PATH


the terminal pickup my .profile export PATH cmd and cuda BUT NOT the notebook
What gives ?

I can provide more details later, but this comment might get you going in the right direction (it’s not exactly the same issue, but the underlying mechanisms apply similarly in your case).

1 Like

Thank-you for the read fperez - but it did not change anything -

  • yes, i have restarted server even rebooted

There is a configuration somewhere that add “/opt/tljh/user/bin” to the PATH variable
I even ran
root@jupyterhub:/opt/tljh# grep -r “/opt/tljh/user/bin” *
but nothing indicative showed-up

Here’s a trick you can use to debug this… Add an environment variable in each of your startup files (say $RAN_BASHRC in .bashrc, $RAN_BASH_PROFILE in .bash_profile, etc.). Then search for these variables in your environment both via !env grep RAN and in the keys of os.env, and also in a normal terminal.

This will help you pin down exactly which files are getting run in each case… You can then try to organize the layout of your configuration in the files that get loaded…

I found my solution
jupyter kernelspec list
Available kernels:
python3 /opt/tljh/user/share/jupyter/kernels/python3

add this line:
“env”: {“LD_LIBRARY_PATH”:"/usr/local/cuda/lib64",“PATH”:"/usr/local/cuda/bin:${PATH}"} ,

“argv”: [
“env”: {“LD_LIBRARY_PATH”:"/usr/local/cuda/lib64",“PATH”:"/usr/local/cuda/bin:${PATH}"} ,
“display_name”: “Python 3”,
“language”: “python”

now nvcc --version works


That does it too, great! :slight_smile: Thanks for sharing this solution, it will help others in the future!

It’s a hub - it needed to be global :wink:

1 Like

Thanks bro, it’s very useful!!!
But I have to use the absolute path for some environments, strange, but that’s all fine :rofl: