TLJH permanent global PYTHONPATH environment variable

We have implemented TLJH no problem. The object is to share .ipynb files but most required importing python code that is in a “/home/py/ director. What I have learned is that if I can start a program using the terminal, python will use the PYTHONPATH variable. However when using TLJH the environment is NOT setup by reading a .bashrc file. This means that PYTHONPATH=”/home/py/" is not available so the ,py files in /home/py/ can’t be imported without editing every .ipynb file. I really want to avoid having to add
import sys
sys.path.append(’/home/py’)
to every .ipynb file

I need to know were to add PYTHONPATH to the jupyterhub environment so that everyone can use it. If this is not possible then how can PYTHONPATH be added to os.environ or /home/py/ added to sys.path permanently.
I have look at changing many of the configuration files but haven’t found the right one.

BTW, the documentation of TLJH is sparse. The bigger docker version seems to be more supportable in the long run even if you don’t have 100 people.

Also, the default interface is tree. This should be changed to lab. The Jupiterlab interface is OK. The tree interface is crude.

Solution found!
We tried adding PYTHONPATH in several places but it seems that TLJH creates its own environment for each user so we could never get PYTHONPATH to show in the user environment. The IT guys could ssh in and see the linux environment had PYTHONPATH set in from /etc/environment but this didn’t help the TLJH users. Finally we found a startup directory were one can add python startup files. We did and we are able to make a startup.py file with
import sys
sys.path.append(’/home/py/’)
This works but if the user types
import sys
sys.path
he still doesn’t see /home/py/ in his path but some how python or TLJH will still search there so good enough. Each user has his own startup directory so the startup.py file had to be copied to all the existing users. However, the IT guys said there is a skeleton directory that is used to create new users and the startup.py was copied there so all new users will have access to /home/py/

Hello pnachtwey, may I ask where is the startup directory? I meet the same issue :rofl: Thanks.