JuliaPy / JuliaPy/PythonCall.jl

Loading both `juliacall` and `pyjulia` triggers crash

Open
#440 2 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Julia
Stars
1.1k
Forks
86
Avg merge
1d 22h
Merged PRs (30d)
3

Description

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.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.