jupyter / jupyter/notebook

Notebook non-Python packages are affected by which env was active when calling notebook

Open
#4,518 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Jupyter Notebook
Stars
13.3k
Forks
5.8k
Avg merge
6d 11h
Merged PRs (30d)
7

Description

## Background
I've created a new environment, e.g. `foo`, and installed it as a kernel with

```
source activate foo
conda install nodejs
python -m ipykernel install --user --name foo --display-name "py36 foo"
```

## Expectation
I expected these series of commands to be the same:

- No conda environment active: `jupyter notebook` # or
- `foo` environment active: `jupyter notebook`

1. Open new notebook
2. Set kernel to `py36 foo`
3. Execute code

At first it seems this is the same, whether `jupyter notebook` is called with or without active environment, because in both cases the output of this code is the same:

```
import sys
sys.executable
# '/home/*user*/anaconda3/envs/foo/bin/python'
```

However, when non-Python packages are involved, such as NodeJS, somehow the system environment is different?

If NodeJS is only installed in the env `foo` (`conda install nodejs`), calling `jupyter notebook` with `foo` active in a terminal gives:

```
!node --version
# v10.13.0
```

However, if `jupyter notebook` is called without environment active (and node not installed system wide):

```
!node --version
# /bin/sh: 1: node: not found
```

See for the full issue and all details: https://groups.google.com/a/continuum.io/forum/#!topic/bokeh/XPba9Gcnhoo

## System

- OS: Ubuntu: 18.04.2 LTS 64-bit
- GNOME: 3.28.2
- Browser: Firefox Quantum 66.0 (64-bit)
- python 3.6.8
- bokeh 1.1.0dev11
- ipykernel 5.1.0
- ipython 7.3.0
- notebook 5.7.6
- nodejs 10.13.0

Contributor guide

Open the contributing guide

Research direction

Reproduce the two `jupyter notebook` launch cases with NodeJS installed only in the `foo` environment, then trace how the notebook server launches commands from a selected kernel. Done means `!node --version` resolves consistently for the `py36 foo` kernel regardless of which environment started the notebook.

Written by the indexing model from the issue text.

Assessment

Tech stack
jupyter-notebook, nodejs, python
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.