Skip to content

Commit

Permalink
Merge pull request #4269 from minrk/document-jupyter-env
Browse files Browse the repository at this point in the history
Document JUPYTER_PREFER_ENV_PATH=0 for shared user environments
  • Loading branch information
manics committed Dec 15, 2022
2 parents 3491ad6 + 15a7e94 commit afe50ef
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions docs/source/reference/config-user-env.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,24 @@ The typical locations for these config files are:
- **system-wide** in `/etc/{jupyter|ipython}`
- **env-wide** (environment wide) in `{sys.prefix}/etc/{jupyter|ipython}`.

### Jupyter environment configuration priority

When Jupyter runs in an environment (conda or virtualenv), it prefers to load configuration from the environment over each user's own configuration (e.g. in `~/.jupyter`).
This may cause issues if you use a _shared_ conda environment or virtualenv for users, because e.g. jupyterlab may try to write information like workspaces or settings to the environment instead of the user's own directory.
This could fail with something like `Permission denied: $PREFIX/etc/jupyter/lab`.

To avoid this issue, set `JUPYTER_PREFER_ENV_PATH=0` in the user environment:

```python
c.Spawner.environment.update(
{
"JUPYTER_PREFER_ENV_PATH": "0",
}
)
```

which tells Jupyter to prefer _user_ configuration paths (e.g. in `~/.jupyter`) to configuration set in the environment.

### Example: Enable an extension system-wide

For example, to enable the `cython` IPython extension for all of your users, create the file `/etc/ipython/ipython_config.py`:
Expand Down

0 comments on commit afe50ef

Please sign in to comment.