Skip to content

Python: wrapped python packages don't propagate their PYTHONPATH #23676

@copumpkin

Description

@copumpkin

Related to #23639 but not quite the same.

If a python package launches python, the child's PYTHONPATH will know nothing of the dependencies of the parent. This is almost never what you want. I think this is because rather than setting PYTHONPATH, we use site inside python to set the path for the current interpreter. Spawning new child interpreters won't get any of that stuff.

My current inclination would be to add a very simple line to the wrapper shim we have today:

os.environ['PYTHONPATH'] = ":".join(sys.path)

Right after we call reduce to add all the paths. That would ensure that all children inherit the right environment. Any thoughts?

cc @FRidh

Metadata

Metadata

Assignees

No one assigned

    Labels

    0.kind: bugSomething is broken6.topic: pythonPython is a high-level, general-purpose programming language.9.needs: community feedbackThis needs feedback from more community members.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions