jupyter_core icon indicating copy to clipboard operation
jupyter_core copied to clipboard

FeatureRequest: Allow disabling system paths

Open dkumor opened this issue 4 years ago • 1 comments

I am trying to run a Jupyter server instance inside a venv, which is completely isolated from the main system Jupyter. It was my understanding that I could set JUPYTER_CONFIG_DIR and JUPYTER_DATA_DIR to replace all search paths, so that it no longer touches global configuration. However, it looks like the system paths are added to the search paths no matter what is done:

https://github.com/jupyter/jupyter_core/blob/master/jupyter_core/paths.py#L174 https://github.com/jupyter/jupyter_core/blob/master/jupyter_core/paths.py#L228

This means, for example, that if I have jupyter lab installed globally, but not in the venv, running jupyter-notebook in the venv will give ModuleNotFoundError: No module named 'jupyterlab' during startup, no matter what.

Is there a way to isolate jupyter server inside a venv? Ideally, there would be a NO_SYSTEM_CONFIG_PATH environmental variable that, when set, does not add the system config directories.

I would be very happy to create a PR with this fix, so long as I know that something like this would be considered.

dkumor avatar Jan 25 '21 19:01 dkumor

This sounds like a really good idea to make sure an environment is truly encapsulated.

rgbkrk avatar Mar 03 '21 18:03 rgbkrk