JuliaPy / JuliaPy/PythonCall.jl

Loading both `juliacall` and `pyjulia` triggers crash

未关闭
#440 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
bug
主要语言
Julia
星标
1.1k
派生
86
平均合并
1 天 22 小时
30 天内合并 PR
3

描述

I would not expect this to work anyways but just wanted to point it out:

```python
[ins] In [1]: from julia import Main as pyjulia_jl

[ins] In [2]: from juliacall import Main as juliacall_jl
Fatal Python error: PyThreadState_Get: the function must be called with the GIL held, but the GIL is released (the current Python thread state is NULL)
Python runtime state: initialized

Thread 0x000000016e883000 (most recent call first):
File "/Users/mcranmer/.pyenv/versions/3.10.10/lib/python3.10/threading.py", line 320 in wait
File "/Users/mcranmer/.pyenv/versions/3.10.10/lib/python3.10/threading.py", line 607 in wait
File "/Users/mcranmer/.pyenv/versions/3.10.10/lib/python3.10/site-packages/IPython/core/history.py", line 884 in run
File "/Users/mcranmer/.pyenv/versions/3.10.10/lib/python3.10/site-packages/IPython/core/history.py", line 60 in only_when_enabled
File "/Users/mcranmer/.pyenv/versions/3.10.10/lib/python3.10/site-packages/decorator.py", line 232 in fun
File "/Users/mcranmer/.pyenv/versions/3.10.10/lib/python3.10/threading.py", line 1016 in _bootstrap_inner
File "/Users/mcranmer/.pyenv/versions/3.10.10/lib/python3.10/threading.py", line 973 in _bootstrap

Current thread 0x00000001e0935ec0 (most recent call first):
File "/Users/mcranmer/PermaDocuments/PySR/.venv/lib/python3.10/site-packages/juliacall/__init__.py", line 222 in init
File "/Users/mcranmer/PermaDocuments/PySR/.venv/lib/python3.10/site-packages/juliacall/__init__.py", line 228 in
File "", line 241 in _call_with_frames_removed
File "", line 883 in exec_module
File "", line 688 in _load_unlocked
File "", line 1006 in _find_and_load_unlocked
File "", line 1027 in _find_and_load
File "", line 1 in
File "/Users/mcranmer/.pyenv/versions/3.10.10/lib/python3.10/site-packages/IPython/core/interactiveshell.py", line 3508 in run_code
File "/Users/mcranmer/.pyenv/versions/3.10.10/lib/python3.10/site-packages/IPython/core/interactiveshell.py", line 3448 in run_ast_nodes
File "/Users/mcranmer/.pyenv/versions/3.10.10/lib/python3.10/site-packages/IPython/core/interactiveshell.py", line 3269 in run_cell_async
File "/Users/mcranmer/.pyenv/versions/3.10.10/lib/python3.10/site-packages/IPython/core/async_helpers.py", line 129 in _pseudo_sync_runner
File "/Users/mcranmer/.pyenv/versions/3.10.10/lib/python3.10/site-packages/IPython/core/interactiveshell.py", line 3064 in _run_cell
File "/Users/mcranmer/.pyenv/versions/3.10.10/lib/python3.10/site-packages/IPython/core/interactiveshell.py", line 3009 in run_cell
File "/Users/mcranmer/.pyenv/versions/3.10.10/lib/python3.10/site-packages/IPython/terminal/interactiveshell.py", line 881 in interact
File "/Users/mcranmer/.pyenv/versions/3.10.10/lib/python3.10/site-packages/IPython/terminal/interactiveshell.py", line 888 in mainloop
File "/Users/mcranmer/.pyenv/versions/3.10.10/lib/python3.10/site-packages/IPython/terminal/ipapp.py", line 318 in start
File "/Users/mcranmer/.pyenv/versions/3.10.10/lib/python3.10/site-packages/traitlets/config/application.py", line 1043 in launch_instance
File "/Users/mcranmer/.pyenv/versions/3.10.10/lib/python3.10/site-packages/IPython/__init__.py", line 129 in start_ipython
File "/Users/mcranmer/.pyenv/versions/3.10.10/bin/ipython", line 8 in

[64935] signal (6): Abort trap: 6
in expression starting at none:2
__pthread_kill at /usr/lib/system/libsystem_kernel.dylib (unknown line)
Allocations: 596578 (Pool: 595526; Big: 1052); GC: 1
[1] 64935 abort ipython
```

This will not be an issue if everyone moves to `juliacall`, but the transition period where some packages use PyCall (like PyPlot) and some packages use PythonCall may cause some of these issues.

Maybe there is a safety switch to get around this issue temporarily.

贡献指南

这个仓库没有索引到贡献指南

调研方向

Reproduce the two imports in an IPython session and inspect juliacall/__init__.py around the init call at line 222, together with the PyCall/PythonCall interaction described in the report. Determine whether a safe transition-period behavior or safety switch is feasible, and verify that the import sequence no longer causes a fatal crash or that its limitation is clearly documented.

由索引模型根据 Issue 内容生成。

评估

技术栈
julia, python
领域
backend
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
需要澄清
新手友好度
25/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。