Repository navigation
Segfault in REPL when importing a library #707
Description
Affects: PythonCall
Describe the bug
$ julia --project=@temp
julia> import Pkg; Pkg.activate(temp = true); Pkg.add(["CondaPkg", "PythonCall"]);using CondaPkg; CondaPkg.add("python", version="3.13.*");CondaPkg.add("numpy");using PythonCall;
np = pyimport("numpy")
julia> np.
[33140] signal 11 (1): Segmentation fault```Here is the full dump:
Details
[33140] signal 11 (1): Segmentation fault in expression starting at REPL[2]:1 _PyInterpreterState_GET at /usr/local/src/conda/python-3.13.9/Include/internal/pycore_pystate.h:214 [inlined] _PyType_LookupRef at /usr/local/src/conda/python-3.13.9/Objects/typeobject.c:5234 [inlined] _PyObject_LookupSpecial at /usr/local/src/conda/python-3.13.9/Objects/typeobject.c:2506 _dir_object at /usr/local/src/conda/python-3.13.9/Objects/object.c:1977 [inlined] PyObject_Dir at /usr/local/src/conda/python-3.13.9/Objects/object.c:2009 PyObject_Dir at /home/kjwiik/.julia/packages/PythonCall/mkWc2/src/C/pointers.jl:300 [inlined] macro expansion at /home/kjwiik/.julia/packages/PythonCall/mkWc2/src/Core/Py.jl:118 [inlined] pydir at /home/kjwiik/.julia/packages/PythonCall/mkWc2/src/Core/builtins.jl:191 propertynames at /home/kjwiik/.julia/packages/PythonCall/mkWc2/src/Core/Py.jl:270 unknown function (ip: 0x7b8401753beb) at (unknown file) #complete_symbol!#6 at /cache/build/tester-amdci4-14/julialang/julia-release-1-dot-12/usr/share/julia/stdlib/v1.12/REPL/src/REPLCompletions.jl:230 complete_symbol! at /cache/build/tester-amdci4-14/julialang/julia-release-1-dot-12/usr/share/julia/stdlib/v1.12/REPL/src/REPLCompletions.jl:184 unknown function (ip: 0x7b840174bfd6) at (unknown file) completions at /cache/build/tester-amdci4-14/julialang/julia-release-1-dot-12/usr/share/julia/stdlib/v1.12/REPL/src/REPLCompletions.jl:1150 #complete_line#66 at /cache/build/tester-amdci4-14/julialang/julia-release-1-dot-12/usr/share/julia/stdlib/v1.12/REPL/src/REPL.jl:809 complete_line at /cache/build/tester-amdci4-14/julialang/julia-release-1-dot-12/usr/share/julia/stdlib/v1.12/REPL/src/REPL.jl:807 unknown function (ip: 0x7b840170e77c) at (unknown file) #complete_line_named#17 at /cache/build/tester-amdci4-14/julialang/julia-release-1-dot-12/usr/share/julia/stdlib/v1.12/REPL/src/LineEdit.jl:401 complete_line_named at /cache/build/tester-amdci4-14/julialang/julia-release-1-dot-12/usr/share/julia/stdlib/v1.12/REPL/src/LineEdit.jl:400 [inlined] macro expansion at /cache/build/tester-amdci4-14/julialang/julia-release-1-dot-12/usr/share/julia/stdlib/v1.12/REPL/src/LineEdit.jl:442 [inlined] macro expansion at ./lock.jl:376 [inlined] #check_show_hint##2 at /cache/build/tester-amdci4-14/julialang/julia-release-1-dot-12/usr/share/julia/stdlib/v1.12/REPL/src/LineEdit.jl:439 jfptr_YY.check_show_hintYY.YY.2_17954.1 at /home/kjwiik/.julia/juliaup/julia-1.12.1+0.x64.linux.gnu/share/julia/compiled/v1.12/REPL/u0gqU_UDl4g.so (unknown line) jl_apply at /cache/build/tester-amdci4-14/julialang/julia-release-1-dot-12/src/julia.h:2391 [inlined] start_task at /cache/build/tester-amdci4-14/julialang/julia-release-1-dot-12/src/task.c:1249 Allocations: 29426553 (Pool: 29424566; Big: 1987); GC: 22 Segmentation fault (core dumped)
julia> versioninfo()
Julia Version 1.12.1
Commit ba1e628ee49 (2025-10-17 13:02 UTC)
Build Info:
Official https://julialang.org release
Platform Info:
OS: Linux (x86_64-linux-gnu)
CPU: 4 × Intel(R) Core(TM) i5-4310U CPU @ 2.00GHz
WORD_SIZE: 64
LLVM: libLLVM-18.1.7 (ORCJIT, haswell)
GC: Built with stock GC
Threads: 1 default, 1 interactive, 1 GC (on 4 virtual cores)
julia> CondaPkg.status()
CondaPkg Status /tmp/jl_UfA8Vd/CondaPkg.toml
Environment
/tmp/jl_UfA8Vd/.CondaPkg/.pixi/envs/default
Packages
numpy v2.3.4
python v3.13.9 (3.13.*)
julia> PythonCall.C.CTX
IOContext{REPL.LimitIO{Base.TTY}}:
is_embedded = false
is_initialized = true
is_preinitialized = false
lib_ptr = Ptr{Nothing}(0x00000000159f6d10)
exe_path = "/tmp/jl_UfA8Vd/.CondaPkg/.pixi/envs/default/bin/python"
lib_path = "/tmp/jl_UfA8Vd/.CondaPkg/.pixi/envs/default/lib/libpython3.13.so.1.0"
dlopen_flags = 0x00000046
pyprogname = "/tmp/jl_UfA8Vd/.CondaPkg/.pixi/envs/default/bin/python"
pyprogname_w = MemoryRef{Int32}(Ptr{Nothing}(0x000070c8b541d520), Int32[47, 116, 109, 112, 47, 106, 108, 95, 85, 102 … -1441332048, 28872, -599587392, 28872, -514150800, 28872, -514150800, 28872, -444150752, 28872])
pyhome = "/tmp/jl_UfA8Vd/.CondaPkg/.pixi/envs/default:/tmp/jl_UfA8Vd/.CondaPkg/.pixi/envs/default"
pyhome_w = MemoryRef{Int32}(Ptr{Nothing}(0x000070c8a23249e0), Int32[47, 116, 109, 112, 47, 106, 108, 95, 85, 102 … 0, 0, 0, -514153520, 28872, -677031280, 28872, 19, 0, 0])
which = :CondaPkg
version = v"3.13.9"
Occurs with both Python 3.13 and 3.14 and only in REPL. In script, everything works fine:
$ julia --project=@temp pythoncall.jl
Activating new project at `/tmp/jl_RvnsQJ`
Resolving package versions...
Updating `/tmp/jl_RvnsQJ/Project.toml`
[992eb4ea] + CondaPkg v0.2.33
[6099a3de] + PythonCall v0.9.28
Updating `/tmp/jl_RvnsQJ/Manifest.toml`
[992eb4ea] + CondaPkg v0.2.33
[9a962f9c] + DataAPI v1.16.0
[e2d170a0] + DataValueInterfaces v1.0.0
[82899510] + IteratorInterfaceExtensions v1.0.0
[692b3bcd] + JLLWrappers v1.7.1
[0f8b85d8] + JSON3 v1.14.3
[1914dd2f] + MacroTools v0.5.16
[0b3b1443] + MicroMamba v0.1.14
[bac558e1] + OrderedCollections v1.8.1
[69de0a69] + Parsers v2.8.3
[fa939f87] + Pidfile v1.3.0
[aea7be01] + PrecompileTools v1.3.3
[21216c6a] + Preferences v1.5.0
[6099a3de] + PythonCall v0.9.28
[6c6a2e73] + Scratch v1.3.0
[856f2bd8] + StructTypes v1.11.0
[3783bdb8] + TableTraits v1.0.1
[bd369af6] + Tables v1.12.1
[e17b2a0c] + UnsafePointers v1.0.0
⌅ [f8abcde7] + micromamba_jll v1.5.12+0
[4d7b5844] + pixi_jll v0.41.3+0
[0dad84c5] + ArgTools v1.1.2
[56f22d72] + Artifacts v1.11.0
[2a0f44e3] + Base64 v1.11.0
[ade2ca70] + Dates v1.11.0
[f43a241f] + Downloads v1.6.0
[7b1f6079] + FileWatching v1.11.0
[b77e0a4c] + InteractiveUtils v1.11.0
[ac6e5ff7] + JuliaSyntaxHighlighting v1.12.0
[4af54fe1] + LazyArtifacts v1.11.0
[b27032c2] + LibCURL v0.6.4
[76f85450] + LibGit2 v1.11.0
[8f399da3] + Libdl v1.11.0
[56ddb016] + Logging v1.11.0
[d6f4376e] + Markdown v1.11.0
[a63ad114] + Mmap v1.11.0
[ca575930] + NetworkOptions v1.3.0
[44cfe95a] + Pkg v1.12.0
[de0858da] + Printf v1.11.0
[9a3f8284] + Random v1.11.0
[ea8e919c] + SHA v0.7.0
[9e88b42a] + Serialization v1.11.0
[f489334b] + StyledStrings v1.11.0
[fa267f1f] + TOML v1.0.3
[a4e569a6] + Tar v1.10.0
[8dfed614] + Test v1.11.0
[cf7118a7] + UUIDs v1.11.0
[4ec0a83e] + Unicode v1.11.0
[deac9b47] + LibCURL_jll v8.11.1+1
[e37daf67] + LibGit2_jll v1.9.0+0
[29816b5a] + LibSSH2_jll v1.11.3+1
[14a3606d] + MozillaCACerts_jll v2025.5.20
[458c3c95] + OpenSSL_jll v3.5.1+0
[83775a58] + Zlib_jll v1.3.1+2
[8e850ede] + nghttp2_jll v1.64.0+1
[3f19e933] + p7zip_jll v17.5.0+2
Info Packages marked with ⌅ have new versions available but compatibility constraints restrict them from upgrading. To see why use `status --outdated -m`
CondaPkg Found dependencies: /tmp/jl_RvnsQJ/CondaPkg.toml
CondaPkg Found dependencies: /home/kjwiik/.julia/packages/PythonCall/mkWc2/CondaPkg.toml
CondaPkg Found dependencies: /home/kjwiik/.julia/packages/CondaPkg/0UqYV/CondaPkg.toml
CondaPkg Resolving changes
+ libstdcxx
+ libstdcxx-ng
+ openssl
+ python
CondaPkg Initialising pixi
│ /home/kjwiik/.julia/artifacts/cefba4912c2b400756d043a2563ef77a0088866b/bin/pixi
│ init
│ --format pixi
└ /tmp/jl_RvnsQJ/.CondaPkg
✔ Created /tmp/jl_RvnsQJ/.CondaPkg/pixi.toml
CondaPkg Wrote /tmp/jl_RvnsQJ/.CondaPkg/pixi.toml
│ [dependencies]
│ openssl = ">=3, <3.6"
│ libstdcxx = ">=3.4,<15.0"
│ libstdcxx-ng = ">=3.4,<15.0"
│
│ [dependencies.python]
│ channel = "conda-forge"
│ build = "*cp*"
│ version = "3.13.*, >=3.9,<4"
│
│ [project]
│ name = ".CondaPkg"
│ platforms = ["linux-64"]
│ channels = ["conda-forge"]
│ channel-priority = "strict"
└ description = "automatically generated by CondaPkg.jl"
CondaPkg Installing packages
│ /home/kjwiik/.julia/artifacts/cefba4912c2b400756d043a2563ef77a0088866b/bin/pixi
│ install
└ --manifest-path /tmp/jl_RvnsQJ/.CondaPkg/pixi.toml
✔ The default environment has been installed.
CondaPkg Found dependencies: /tmp/jl_RvnsQJ/CondaPkg.toml
CondaPkg Found dependencies: /home/kjwiik/.julia/packages/PythonCall/mkWc2/CondaPkg.toml
CondaPkg Found dependencies: /home/kjwiik/.julia/packages/CondaPkg/0UqYV/CondaPkg.toml
CondaPkg Resolving changes
+ numpy
CondaPkg Initialising pixi
│ /home/kjwiik/.julia/artifacts/cefba4912c2b400756d043a2563ef77a0088866b/bin/pixi
│ init
│ --format pixi
└ /tmp/jl_RvnsQJ/.CondaPkg
✔ Created /tmp/jl_RvnsQJ/.CondaPkg/pixi.toml
CondaPkg Wrote /tmp/jl_RvnsQJ/.CondaPkg/pixi.toml
│ [dependencies]
│ openssl = ">=3, <3.6"
│ libstdcxx = ">=3.4,<15.0"
│ libstdcxx-ng = ">=3.4,<15.0"
│ numpy = "*"
│
│ [dependencies.python]
│ channel = "conda-forge"
│ build = "*cp*"
│ version = "3.13.*, >=3.9,<4"
│
│ [project]
│ name = ".CondaPkg"
│ platforms = ["linux-64"]
│ channels = ["conda-forge"]
│ channel-priority = "strict"
└ description = "automatically generated by CondaPkg.jl"
CondaPkg Installing packages
│ /home/kjwiik/.julia/artifacts/cefba4912c2b400756d043a2563ef77a0088866b/bin/pixi
│ install
└ --manifest-path /tmp/jl_RvnsQJ/.CondaPkg/pixi.toml
✔ The default environment has been installed.
[1 2 3 4 5]Script:
import Pkg; Pkg.activate(temp = true); Pkg.add(["CondaPkg", "PythonCall"]);using CondaPkg; CondaPkg.add("numpy");using PythonCall;
np = pyimport("numpy")
println( np.array([1, 2, 3, 4, 5]))
Activity
KajWiik commentedon Nov 1, 2025
I noticed that when using OhMyREPL I do not get a segfault. Is the bug in REPL?
cjdoris commentedon Nov 14, 2025
I believe this is now fixed and released - please try with PythonCall 0.9.29.
KajWiik commentedon Nov 15, 2025
I am sorry to report that it still segfaults when hitting after period (.)...
cjdoris commentedon Nov 15, 2025
Actually now you're seeing a different issue #694 which is caused by some internal changes in python 3.14. For now you can work around it by restricting to python 3.13 or older (
CondaPkg.add("python", version="<3.14")).KajWiik commentedon Nov 15, 2025
Hm, with 3.13.9 (should I try 3.13.0?) I get right after pyimport():
KajWiik commentedon Nov 15, 2025
Hm, the error message has references to
libpython3.14.so.1.0even whenconda stgives 3.13.9, maybe 3.14 is still used? How to ensure <3.14?cjdoris commentedon Nov 16, 2025
You need to do the CondaPkg commands before importing PythonCall otherwise you'll get the old Python version.
KajWiik commentedon Nov 16, 2025
Doh! Indeed, now it is working fine, many thanks! This makes my life so much easier :-)!