JuliaPy / PyCall.jl

Package to call Python functions from the Julia language
MIT License
1.47k stars 187 forks source link

Segfault importing numba (reloaded) #903

Open gboehl opened 3 years ago

gboehl commented 3 years ago

Reviving #220, loading numba gives me a segfault:

using PyCall

py"""
import numba
"""

Output:

signal (11): Segmentation fault
in expression starting at /home/gboehl/bla.jl:3
_ZN4llvm16TargetPassConfig7addPassEPNS_4PassEbb at /usr/bin/../lib/libLLVM-10.so (
unknown line)
unknown function (ip: 0x22)
_ZTSN4llvm19MachineRegisterInfo8DelegateE at /usr/bin/../lib/libLLVM-10.so (unknow
n line)
Allocations: 3802472 (Pool: 3801514; Big: 958); GC: 5
[1]    98035 segmentation fault (core dumped)  julia

Running arch linux with Julia version:

Julia Version 1.6.1
Commit 6aaedecc44* (2021-04-23 05:59 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: Intel(R) Core(TM) i7-8650U CPU @ 1.90GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-11.1.0 (ORCJIT, skylake)

with PyCall version:

      Status `~/.julia/environments/v1.6/Project.toml`
  [438e738f] PyCall v1.92.3

Same in Python for

from julia import Main
import numba

Numba version is 0.53.1. on Python 3.9.5.

A similar issue is opened for pyjulia: https://github.com/JuliaPy/pyjulia/issues/443

Any help is much appreciated!

PhilipVinc commented 3 years ago

Numba 0.53.1 uses LLVM 9 (IIRC), while Julia 1.6 uses LLVM 11. In theory numba is statically linked to LLVM and they should interoperate correctly, but evidently they do not. I tried a lot to make the two work together with no avail.

The only fix that works is reverting to Julia 1.5

(There is also a PR open in numba to update to LLVM 11 for the 0.55 release (due in 4 months, I think), but it won't be using the same minor version as Julia so it's entirely possible they won't work together.)

gboehl commented 3 years ago

Thanks a lot for the response, downgrading to Julia 1.5 worked for me.

This seems to be an acceptable workaround, maybe it is a good idea to document it somewhere?

Thanks again.

stevengj commented 3 years ago

See also JuliaLang/julia#12644 — I thought Julia had fixed this by using LLVM symbol versioning?

moble commented 2 years ago

It looks like julia has done all it can to solve this problem, which is really caused by the python side of things. I ran into this problem because I installed numba via conda-forge, but the way conda-forge is building and linking LLVM / llvmlite / numba leads to the segfaults. One way to avoid it is to install numba from the numba channel — as in conda install -c numba llvmlite numba. They build with static linking, which doesn't trigger this problem. It looks like installing from pip would also work.

Anyway, I don't think PyCall can help with this, so I guess this issue should be closed.