Skip to content

Conda environment not fully set in Jupyter #2043

@nthiery

Description

@nthiery

What docker image(s) are you using?

minimal-notebook

Host OS system

CentOS

Host architecture

x86_64

What Docker command are you running?

sudo docker run -p8888:8888 --rm docker.io/jupyter/minimal-notebook:latest

(or standard run from JupyterHub)

How to Reproduce the problem?

Start a Python or C++ kernel, e.g. from a notebook and run the following
command:

!env | grep CONDA 

Command output

CONDA_DIR=/opt/conda

Expected behavior

See all the usual environment variables that are set when a conda
environment is set; e.g.:

CONDA_EXE=/opt/conda/bin/conda
CONDA_PREFIX=/opt/conda
CONDA_PROMPT_MODIFIER=(base) 
_CE_CONDA=
CONDA_SHLVL=1
CONDA_DIR=/opt/conda
CONDA_PYTHON_EXE=/opt/conda/bin/python
CONDA_DEFAULT_ENV=base

Actual behavior

If a barebone shell is launched from Jupyter (e.g. through shebang calls in a notebook), the conda environment variables are not set.

Anything else?

Suggestion

Launch Jupyter itself within an activated conda environment. Maybe by using an entry
point such as conda run jupyter ....

For now I am using as workaround:

%bash --login
...

but this is tricky to find for end users.

Use case

In a C++ course, we include calls to compilation commands in the course
narrative to explain how to compile; students also include them
in the support of their presentation to run the compilation and execution
of their programs. These compilation commands often need a fully
configured conda environment.

Latest Docker version

  • I've updated my Docker version to the latest available, and the issue persists

Metadata

Metadata

Assignees

No one assigned

    Labels

    type:BugA problem with the definition of one of the docker images maintained here

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions