Hacktoberfest 2026: as issues que os mantenedores marcaram para outubro, abertas e boas para iniciantes. Ver issues do Hacktoberfest

Freeze the resolved interpreter for child processes

Aberta
#796 0 comentários 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 1 dia

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
3/5
Tempo estimado
1-2 dias
Facilidade para iniciantes
68/100
Tipo de issue
Bug
Clareza
Razoavelmente clara
Status de atividade
Pouca atividade
Stack de tecnologia
python
Domínio
backend

Direção de pesquisa

Comece em src/C/context.jl e rastreie como getpref_exe e CTX.which lidam com CondaPkg durante a inicialização de processos filhos. Verifique o comportamento existente condicionado pela CI e as convenções de preferências; em seguida, confirme que os processos iniciados herdam o executável resolvido sem resolver CondaPkg novamente e que um JULIA_PYTHONCALL_EXE definido pelo usuário permanece inalterado.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

enhancement

When PythonCall resolves its interpreter via CondaPkg, each child process that loads
PythonCall re-resolves the same CondaPkg environment from scratch. Spawn several at once —
e.g. Distributed workers for parallel data loading (MLUtils DataLoader(...; num_workers=N)
over a PythonCall-backed dataset) — and they serialize on CondaPkg's lock, spamming
CondaPkg: Waiting for lock to be freed and redoing work the parent already did.

PythonCall already has the fix, but gates it behind CI=true and flags it as a hack
(src/C/context.jl, v0.9.35):

# HACK: If we are using CondaPkg, prevent child processes from using it by explicitly
# setting the executable. ...
# A better solution may be to use some environment variable to "freeze" CondaPkg in
# child processes.
# Only done when CI=true since it's a hack.
if (get(ENV, "CI", "false") == "true") && (CTX.which === :CondaPkg)
    ENV["JULIA_PYTHONCALL_EXE"] = CTX.exe_path::String
end

Since JULIA_PYTHONCALL_EXE is exactly the "freeze" env var the comment asks for (child
processes inherit ENV, and getpref_exe reads it), the same line solves the general case.

Proposal

Set JULIA_PYTHONCALL_EXE whenever CTX.which === :CondaPkg, not only under CI — ideally
behind a preference (e.g. freeze_child_processes, default true) so it can be disabled.
get! already leaves a user-set value untouched.

Workaround

A downstream package can do this itself after init:

if PythonCall.C.CTX.which === :CondaPkg
    get!(ENV, "JULIA_PYTHONCALL_EXE", PythonCall.python_executable_path()::String)
end

I've done this in https://github.com/JuliaGenAI/HuggingFaceDatasets.jl/pull/64

Linguagem predominante
Julia
Estrelas
1.1k
Forks
89
Merge médio
2d 15h
PRs com merge (30d)
7

Preparar o ambiente

Este projeto não oferece contêiner de desenvolvimento, Dockerfile nem guia de contribuição, então a configuração fica por sua conta: comece pelo README e veja nosso guia da primeira contribuição para os passos gerais.

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de JuliaPy/PythonCall.jl

Todas as issues de JuliaPy/PythonCall.jl

Issues semelhantes

Mais issues de Julia

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.