Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The way that the python environment is set up for scripts/entrypoints (by modifying sys.path with site.addsitedir) is not inherited with multiprocessing (when spawn is used) #1793

Open
colonelpanic8 opened this issue Sep 4, 2024 · 1 comment

Comments

@colonelpanic8
Copy link

The way that the python environment is set up for scripts/entrypoints (by modifying sys.path with site.addsitedir) is not inherited with multiprocessing (when spawn is used)

Basically, because the modification to sys.path only happen within the process, it does not seem that the child process properly inherits all of those modifications.

Looking in to a bit more, it may be that this is actually more of a nixpkgs issue than anything else, because this happens here:

https://github.com/NixOS/nixpkgs/blob/bd346e9f29610cbedaa56104174ff1e656efe521/pkgs/development/interpreters/python/wrap-python.nix#L39

but I do basically think that we need to properly wrap the binary or set something in the environment so that this works properly.

@adisbladis
Copy link
Member

I've been creating a new fully featured editable implementation in NixOS/nixpkgs#339228.
I think the right way to go about this is how I'm implementing it in uv2nix: https://github.com/adisbladis/uv2nix/pull/8/files#diff-b0ed524beda0c5e24aaf8c9a4fb8fc81c4686041096ed006c52add697d9f29b1.

Basically: Add your leaf-package to the overlay created and override it to be editable. This takes all scripts & entrypoints into account.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants