JuliaPy / JuliaPy/PythonCall.jl

Loading both `juliacall` and `pyjulia` triggers crash

オープン
#440 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る
bug
主要言語
Julia
スター
1.1k
フォーク
86
平均マージ
1日 22時間
マージ済み PR(30日)
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 を短くまとめたダイジェスト。