Skip to content

PYTHONPATH from shell no longer respected after latest update #1456

@ironhak

Description

@ironhak

Description

After updating to the latest version of ipykernel, the environment variable PYTHONPATH set in my shell is no longer reflected inside Jupyter notebooks.

Previously, I could import my own local modules directly, e.g.:

from my_module import my_function

where my_module.py is located in a custom folder appended to PYTHONPATH in my .bashrc:

export PYTHONPATH="$PYTHONPATH:/path/to/custom/library"

After the update, notebooks in vscode no longer find these modules unless I manually add the path within the notebook using:

import sys
sys.path.append("/path/to/custom/library")

Expected behavior

Jupyter kernels should inherit the PYTHONPATH from the parent shell (as they did prior to the update).

Actual behavior

PYTHONPATH is ignored; sys.path inside the kernel does not contain my custom directory.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions