JuliaPy / JuliaPy/PythonCall.jl
JuliaCall with Ubuntu Python-3.10 and import PyCall results in `free(): invalid pointer`
- Ngôn ngữ chính
- Julia
- Star
- 1.1k
- Fork
- 86
- Merge trung bình
- 1 ngày 22 giờ
- Pull request đã merge (30 ngày)
- 3
Mô tả
**Affects:** JuliaCall
**Describe the bug**
Using JuliaCall with Ubuntu 22.04 system python (python-3.10) results in `free(): invalid pointer` crash if a Julia package is imported that also imports/uses PyCall. I suspect this is related to the long standing problem where PyJulia cannot use statically linked python (https://github.com/JuliaPy/pyjulia/issues/185). I have confirmed that installing python compiled with dynamically linked libpython resolves the issue. If so, ultimately it is a bug of PyJulia, but I am reporting it here to alert others who might encounter it. Perhaps a warning or documentation is merited.
```
julia> versioninfo()
Julia Version 1.9.4
Commit 8e5136fa297 (2023-11-14 08:46 UTC)
Build Info:
Official https://julialang.org/ release
Platform Info:
OS: Linux (x86_64-linux-gnu)
CPU: 52 × Intel(R) Xeon(R) Gold 6230R CPU @ 2.10GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-14.0.6 (ORCJIT, cascadelake)
Threads: 1 on 52 virtual cores
Environment:
JULIA_CONDAPKG_BACKEND = Null
JULIA_PYTHONCALL_EXE = @PyCall
JULIA_PKG_USE_CLI_GIT = true
julia> ENV["PYTHON"]
"/usr/bin/python3.10"
(@v1.9) pkg> st
Status `~/.julia/environments/v1.9/Project.toml`
[438e738f] PyCall v1.96.2
[6099a3de] PythonCall v0.9.15
$ ldd /usr/bin/python3.10
linux-vdso.so.1 (0x00007ffe3d1e1000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f2fb3f19000)
libexpat.so.1 => /lib/x86_64-linux-gnu/libexpat.so.1 (0x00007f2fb3ee8000)
libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f2fb3ecc000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f2fb3c00000)
/lib64/ld-linux-x86-64.so.2 (0x00007f2fb4604000)
$ /usr/bin/pip3.10 list | grep julia
julia 0.6.1
juliacall 0.9.15
juliapkg 0.1.10
$ /usr/bin/python3.10
Python 3.10.12 (main, Jun 11 2023, 05:26:28) [GCC 11.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from juliacall import Main as jl
>>> jl.Pkg.status()
Status `~/.julia/environments/pyjuliapkg/Project.toml`
[438e738f] PyCall v1.96.2
[6099a3de] PythonCall v0.9.15
>>> jl.seval("import PyCall")
free(): invalid pointer
Aborted (core dumped)
```
With dynamically linked libpython:
```
julia> ENV["PYTHON"]
"/usr/local/bin/python3.11"
$ ldd /usr/local/bin/python3.11
linux-vdso.so.1 (0x00007ffcb2713000)
libpython3.11.so.1.0 => /usr/local/lib/libpython3.11.so.1.0 (0x00007f3b1aa00000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f3b1a600000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f3b1a919000)
/lib64/ld-linux-x86-64.so.2 (0x00007f3b1b0b5000)
$ /usr/local/bin/pip3.11 list | grep julia
julia 0.6.1
juliacall 0.9.15
juliapkg 0.1.10
$ /usr/local/bin/python3.11
Python 3.11.5 (main, Nov 25 2023, 15:23:23) [GCC 11.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from juliacall import Main as jl
>>> jl.Pkg.status()
Status `~/.julia/environments/pyjuliapkg/Project.toml`
[438e738f] PyCall v1.96.2
[6099a3de] PythonCall v0.9.15
>>> jl.seval("import PyCall")
>>> jl.seval('PyCall.py"print(1+1)"')
2
```
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Hướng nghiên cứu
Start with the reported PythonCall/PyCall setup and the `jl.seval("import PyCall")` reproduction on Ubuntu 22.04 with Python 3.10; compare it with the dynamically linked Python 3.11 case using the supplied `ldd` output. Trace the failure boundary between PythonCall and PyCall, and consider the issue done only when the failure is explained or a documented warning or workaround is validated.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- julia, python
- Lĩnh vực
- backend
- Loại issue
- Lỗi
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Cần làm rõ
- Mức phù hợp với người mới
- 35/100