I am trying to work with jupyterlab on a remote server that I don't manage, and I want to add my custom libraries to the path so that I can import and use them. Normally, I would go into .bashrc and add to PYTHONPATH there using
export PYTHONPATH="/home/username/path/to/module:$PYTHONPATH"
but this hasn't worked. I have tried this in .bashrc and .bash_profile to no fortune. I have also tried
export JUPYTER_PATH="/home/username/path/to/module:$JUPYTER_PATH"
as I read that somewhere else, and tried it in both the files named above.
What else can I try?
Ideally I'd like to put in some line in jupyterlab that returns the file it is using to add to the path, is that possible?
Or perhaps there is some command I can type directly into a terminal that I can access through jupyterlab that would allow me to add things to my path perminantley. I know that I can use os.path.insert (or similar) at the start of a notebook but as there are certain things I will want to use in every notebook this is a less than ideal solution for me.
Thanks
".PYTHONPATHis the correct variable to modify. This answer might be of your interest: stackoverflow.com/a/69399208/6646912"is a typo in the question by me, I have that correct in my files. ChangingPYTHONPATHhasn't worked, and I've tried changing it in.bashrcandbash_profile, is there a different file that I should change, or a way to print out what file jupyterlab is using? Your suggested thread doesn't solve my issue entirely, as I have a few different files in different locations, so changing to one working directory doesn't really work for me, I really want to be able to multiple things to pythonpath, and don't want to insert to the path for each new notebook./home/username/path/to/moduleis off? Have you tried running jupyterlab withPYTHONPATH=/path/to/your/modules:$PYTHONPATH jupyter lab(instead of using export)?exporthas no effect because thePYTHONPATHhas to be set prior to starting JupyterLab. You could potentially have a serve extension which modifies the PYTHONPATH for the server/all kernels in flight, but that would again require you to be able to load the extension prior to server startup. It is not clear from the question how much control you have.exportline before hand and try that? Is there anipython_profilefile that maybe I can use theinsertcommand in to add to the pythonpath that way?