PythonCall.jl icon indicating copy to clipboard operation
PythonCall.jl copied to clipboard

juliacall segfaults when loading a package that uses PythonCall

Open oschulz opened this issue 3 years ago • 5 comments

juliacall always segfaults on me when I try to load a package that uses PythonCall.

This should reproduce the error:

import juliapkg

juliapkg.add("BATPythonCall", "dc6699a0-bee0-4ed4-84d6-ad34e0e2513f", rev = "loaddebug", url = "https://github.com/bat/BATPythonCall.jl.git")

juliapkg.resolve()
juliapkg.status()

from juliacall import Main as jl

jl.seval("using BATPythonCall")

results in

free(): invalid pointer

signal (6): Aborted
in expression starting at none:1
gsignal at /lib/x86_64-linux-gnu/libc.so.6 (unknown line)
abort at /lib/x86_64-linux-gnu/libc.so.6 (unknown line)

BATPythonCall.jl (on branch "loaddebug") is basically an empty package that only does using PythonCall. Removing using PythonCall makes the segfault disappear.

CC @philippeller

oschulz avatar Aug 09 '22 22:08 oschulz

That's very odd. I can't reproduce it on Linux in a fresh Conda environment like this:

conda create -n temp -c conda-forge python pip
conda activate temp
pip install juliapkg juliacall
python
# then enter your python code above

Can you please ensure you are on the latest versions of JuliaPkg and JuliaCall? Preferably in a fresh environment (venv/conda/poetry/whatever). And if that doesn't fix it, we'll have to drill down into what's different about your system - please send the output from juliapkg.status(), pip list, conda list, conda info, etc.

cjdoris avatar Aug 10 '22 10:08 cjdoris

Can you please ensure you are on the latest versions of JuliaPkg and JuliaCall?

Will try!

oschulz avatar Aug 10 '22 15:08 oschulz

It's weird - I can reproduce the error with the juliapkg-0.1.9, juliacall-0.9.4, Julia 1.8.0-rc4 running in an Ubuntu Apptainer container (our standard computing environment). But when I run with the same container and same package/Julia versions under Docker, the segfault disappears.

I'll try more computing environment combinations ...

oschulz avatar Aug 11 '22 07:08 oschulz

This issue has been marked as stale because it has been open for 30 days with no activity. If the issue is still relevant then please leave a comment, or else it will be closed in 7 days.

github-actions[bot] avatar Sep 08 '23 01:09 github-actions[bot]

This issue has been closed because it has been stale for 7 days. If it is still relevant, please re-open it.

github-actions[bot] avatar Sep 15 '23 01:09 github-actions[bot]