Open jamblejoe opened 3 years ago
Hmm, I can't reproduce this on my Mac laptop. The first thing I tried was whether it was an issue with PyCall
and not something in SymPy
. Could you try running the following to see if it brings about a similar error?
import PyCall
const sympy = PyCall.pyimport_conda("sympy", "sympy")
a = sympy.symbols("a")
p = sympy.Poly(a^2 + 3*a -2, a)
for i in 0:2; @show p.coeff_monomial(a^i); end
Threads.@threads for i in 0:2; @show p.coeff_monomial(a^i); end
I have to say that I am on WSL 2 Ubuntu 20.04 on Windows 10 Pro 21H1. This is the output:
julia> import PyCall
julia> const sympy = PyCall.pyimport_conda("sympy", "sympy")
PyObject <module 'sympy' from '/home/goran/.julia/conda/3/lib/python3.8/site-packages/sympy/__init__.py'>
julia> a = sympy.symbols("a")
PyObject a
julia> p = sympy.Poly(a^2 + 3*a -2, a)
PyObject Poly(a**2 + 3*a - 2, a, domain='ZZ')
julia> for i in 0:2; @show p.coeff_monomial(a^i); end
p.coeff_monomial(a ^ i) = PyObject -2
p.coeff_monomial(a ^ i) = PyObject 3
p.coeff_monomial(a ^ i) = PyObject 1
julia> Threads.@threads for i in 0:2; @show p.coeff_monomial(a^i); end
signal (11): Segmentation fault
in expression starting at REPL[8]:1
p.coeff_monomial(a ^ i) = PyObject -2
p.coeff_monomial(a ^ i) = PyObject 3
_PyObject_Malloc at /home/goran/.julia/conda/3/lib/libpython3.8.so.1.0 (unknown line)
PyUnicode_New at /home/goran/.julia/conda/3/lib/libpython3.8.so.1.0 (unknown line)
_PyUnicodeWriter_PrepareInternal at /home/goran/.julia/conda/3/lib/libpython3.8.so.1.0 (unknown line)
_PyUnicodeWriter_WriteASCIIString at /home/goran/.julia/conda/3/lib/libpython3.8.so.1.0 (unknown line)
PyUnicode_FromFormatV at /home/goran/.julia/conda/3/lib/libpython3.8.so.1.0 (unknown line)
PyErr_Format at /home/goran/.julia/conda/3/lib/libpython3.8.so.1.0 (unknown line)
PyObject_GetBuffer at /home/goran/.julia/conda/3/lib/libpython3.8.so.1.0 (unknown line)
isbuftype! at /home/goran/.julia/packages/PyCall/BD546/src/pybuffer.jl:134 [inlined]
isbuftype at /home/goran/.julia/packages/PyCall/BD546/src/pybuffer.jl:148 [inlined]
pysequence_query at /home/goran/.julia/packages/PyCall/BD546/src/conversions.jl:759
pytype_query at /home/goran/.julia/packages/PyCall/BD546/src/conversions.jl:773
pytype_query at /home/goran/.julia/packages/PyCall/BD546/src/conversions.jl:806 [inlined]
convert at /home/goran/.julia/packages/PyCall/BD546/src/conversions.jl:831
getproperty at /home/goran/.julia/packages/PyCall/BD546/src/PyCall.jl:312
_jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2237 [inlined]
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2419
macro expansion at ./show.jl:955 [inlined]
macro expansion at ./REPL[8]:1 [inlined]
#4#threadsfor_fun at ./threadingconstructs.jl:81
#4#threadsfor_fun at ./threadingconstructs.jl:48
unknown function (ip: 0x7fd36411cc9c)
_jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2237 [inlined]
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2419
jl_apply at /buildworker/worker/package_linux64/build/src/julia.h:1703 [inlined]
start_task at /buildworker/worker/package_linux64/build/src/task.c:839
unknown function (ip: (nil))
Allocations: 15299065 (Pool: 15294286; Big: 4779); GC: 20
Segmentation fault
julia> versioninfo()
Julia Version 1.6.1
Commit 6aaedecc44 (2021-04-23 05:59 UTC)
Platform Info:
OS: Linux (x86_64-pc-linux-gnu)
CPU: AMD Ryzen Threadripper 3960X 24-Core Processor
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-11.0.1 (ORCJIT, znver2)
On the host OS, Windows 10 PRO 21H1, I don't get segfault but ReadOnlyMemory()
error:
julia> import PyCall
julia> const sympy = PyCall.pyimport_conda("sympy", "sympy")
PyObject <module 'sympy' from 'C:\\Users\\gonak\\.julia\\conda\\3\\lib\\site-packages\\sympy\\__init__.py'>
julia> a = sympy.symbols("a")
PyObject a
julia> p = sympy.Poly(a^2 + 3*a -2, a)
PyObject Poly(a**2 + 3*a - 2, a, domain='ZZ')
julia> for i in 0:2; @show p.coeff_monomial(a^i); end
p.coeff_monomial(a ^ i) = PyObject -2
p.coeff_monomial(a ^ i) = PyObject 3
p.coeff_monomial(a ^ i) = PyObject 1
julia> Threads.@threads for i in 0:2; @show p.coeff_monomial(a^i); end
p.coeff_monomial(a ^ i) = ERROR: PyObject -2TaskFailedException
Stacktrace:
[1] wait
@ .\task.jl:322 [inlined]
[2] threading_run(func::Function)
@ Base.Threads .\threadingconstructs.jl:34
[3] top-level scope
@ .\threadingconstructs.jl:93
nested task error: ReadOnlyMemoryError()
Stacktrace:
[1] macro expansion
@ C:\Users\gonak\.julia\packages\PyCall\BD546\src\exception.jl:95 [inlined]
[2] ^
@ C:\Users\gonak\.julia\packages\PyCall\BD546\src\pyoperators.jl:18 [inlined]
[3] ^(a::PyCall.PyObject, b::Int64)
@ PyCall C:\Users\gonak\.julia\packages\PyCall\BD546\src\pyoperators.jl:21
[4] macro expansion
@ .\show.jl:955 [inlined]
[5] macro expansion
@ .\REPL[14]:1 [inlined]
[6] (::var"#23#threadsfor_fun#2"{UnitRange{Int64}})(onethread::Bool)
@ Main .\threadingconstructs.jl:81
[7] (::var"#23#threadsfor_fun#2"{UnitRange{Int64}})()
@ Main .\threadingconstructs.jl:48
julia> versioninfo()
Julia Version 1.6.1
Commit 6aaedecc44 (2021-04-23 05:59 UTC)
Platform Info:
OS: Windows (x86_64-w64-mingw32)
CPU: AMD Ryzen Threadripper 3960X 24-Core Processor
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-11.0.1 (ORCJIT, znver2)
For WSL:
julia> Conda.list()
[ Info: Running `conda list` in root environment
# packages in environment at /home/goran/.julia/conda/3:
#
# Name Version Build Channel
_libgcc_mutex 0.1 main
anyio 2.2.0 py38h06a4308_1
argon2-cffi 20.1.0 py38h27cfd23_1
async_generator 1.10 pyhd3eb1b0_0
attrs 21.2.0 pyhd3eb1b0_0
babel 2.9.1 pyhd3eb1b0_0
backcall 0.2.0 pyhd3eb1b0_0
blas 1.0 mkl
bleach 3.3.0 pyhd3eb1b0_0
brotlipy 0.7.0 py38h27cfd23_1003
ca-certificates 2021.5.25 h06a4308_1
certifi 2021.5.30 py38h06a4308_0
cffi 1.14.3 py38h261ae71_2
chardet 3.0.4 py38h06a4308_1003
conda 4.10.1 py38h06a4308_1
conda-package-handling 1.7.2 py38h03888b9_0
cryptography 3.2.1 py38h3c74f83_1
cycler 0.10.0 py38_0
dbus 1.13.18 hb2f20db_0
decorator 5.0.9 pyhd3eb1b0_0
defusedxml 0.7.1 pyhd3eb1b0_0
entrypoints 0.3 py38_0
expat 2.4.1 h2531618_2
fontconfig 2.13.1 h6c09931_0
freetype 2.10.4 h5ab3b9f_0
glib 2.68.2 h36276a3_0
gmp 6.2.1 h2531618_2
gmpy2 2.0.8 py38hd5f6e3b_3
gst-plugins-base 1.14.0 h8213a91_2
gstreamer 1.14.0 h28cd5cc_2
icu 58.2 he6710b0_3
idna 2.10 py_0
importlib-metadata 3.10.0 py38h06a4308_0
importlib_metadata 3.10.0 hd3eb1b0_0
intel-openmp 2021.2.0 h06a4308_610
ipykernel 5.3.4 py38h5ca1d4c_0
ipython 7.22.0 py38hb070fc8_0
ipython_genutils 0.2.0 pyhd3eb1b0_1
jedi 0.17.0 py38_0
jinja2 3.0.0 pyhd3eb1b0_0
jpeg 9b h024ee3a_2
json5 0.9.5 py_0
jsonschema 3.2.0 py_2
jupyter-packaging 0.7.12 pyhd3eb1b0_0
jupyter_client 6.1.12 pyhd3eb1b0_0
jupyter_core 4.7.1 py38h06a4308_0
jupyter_server 1.4.1 py38h06a4308_0
jupyterlab 2.3.1 pyhd3eb1b0_0
jupyterlab_pygments 0.1.2 py_0
jupyterlab_server 1.2.0 py_0
kiwisolver 1.3.1 py38h2531618_0
lcms2 2.12 h3be6417_0
ld_impl_linux-64 2.33.1 h53a641e_7
libedit 3.1.20191231 h14c3975_1
libffi 3.3 he6710b0_2
libgcc 7.2.0 h69d50b8_2
libgcc-ng 9.1.0 hdf63c60_0
libpng 1.6.37 hbc83047_0
libsodium 1.0.18 h7b6447c_0
libstdcxx-ng 9.1.0 hdf63c60_0
libtiff 4.2.0 h85742a9_0
libuuid 1.0.3 h1bed415_2
libuv 1.40.0 h7b6447c_0
libwebp-base 1.2.0 h27cfd23_0
libxcb 1.14 h7b6447c_0
libxml2 2.9.10 hb55368b_3
lz4-c 1.9.3 h2531618_0
markupsafe 2.0.1 py38h27cfd23_0
matplotlib 3.3.4 py38h06a4308_0
matplotlib-base 3.3.4 py38h62a2d02_0
mistune 0.8.4 py38h7b6447c_1000
mkl 2021.2.0 h06a4308_296
mkl-service 2.3.0 py38h27cfd23_1
mkl_fft 1.3.0 py38h42c9631_2
mkl_random 1.2.1 py38ha9443f7_2
mpc 1.1.0 h10f8cd9_1
mpfr 4.0.2 hb69a4c5_1
mpmath 1.2.1 py38h06a4308_0
nbclassic 0.2.6 pyhd3eb1b0_0
nbclient 0.5.3 pyhd3eb1b0_0
nbconvert 6.0.7 py38_0
nbformat 5.1.3 pyhd3eb1b0_0
ncurses 6.2 he6710b0_1
nest-asyncio 1.5.1 pyhd3eb1b0_0
nodejs 10.13.0 he6710b0_0
notebook 6.4.0 py38h06a4308_0
numpy 1.20.2 py38h2d18471_0
numpy-base 1.20.2 py38hfae3a4d_0
olefile 0.46 py_0
openssl 1.1.1k h27cfd23_0
packaging 20.9 pyhd3eb1b0_0
pandoc 2.12 h06a4308_0
pandocfilters 1.4.3 py38h06a4308_1
parso 0.8.2 pyhd3eb1b0_0
pcre 8.44 he6710b0_0
pexpect 4.8.0 pyhd3eb1b0_3
pickleshare 0.7.5 pyhd3eb1b0_1003
pillow 8.2.0 py38he98fc37_0
pip 20.2.4 py38h06a4308_0
prometheus_client 0.10.1 pyhd3eb1b0_0
prompt-toolkit 3.0.17 pyh06a4308_0
ptyprocess 0.7.0 pyhd3eb1b0_2
pycosat 0.6.3 py38h7b6447c_1
pycparser 2.20 py_2
pygments 2.9.0 pyhd3eb1b0_0
pyopenssl 19.1.0 pyhd3eb1b0_1
pyparsing 2.4.7 pyhd3eb1b0_0
pyqt 5.9.2 py38h05f1152_4
pyrsistent 0.17.3 py38h7b6447c_0
pysocks 1.7.1 py38h06a4308_0
python 3.8.5 h7579374_1
python-dateutil 2.8.1 pyhd3eb1b0_0
pytz 2021.1 pyhd3eb1b0_0
pyzmq 20.0.0 py38h2531618_1
qt 5.9.7 h5867ecd_1
readline 8.0 h7b6447c_0
requests 2.24.0 py_0
ruamel_yaml 0.15.87 py38h7b6447c_1
send2trash 1.5.0 pyhd3eb1b0_1
setuptools 50.3.1 py38h06a4308_1
sip 4.19.13 py38he6710b0_0
six 1.15.0 py38h06a4308_0
sniffio 1.2.0 py38h06a4308_1
sqlite 3.33.0 h62c20be_0
sympy 1.8 py38h06a4308_0
terminado 0.9.4 py38h06a4308_0
testpath 0.4.4 pyhd3eb1b0_0
tk 8.6.10 hbc83047_0
tornado 6.1 py38h27cfd23_0
tqdm 4.51.0 pyhd3eb1b0_0
traitlets 5.0.5 pyhd3eb1b0_0
urllib3 1.25.11 py_0
wcwidth 0.2.5 py_0
webencodings 0.5.1 py38_1
wheel 0.35.1 pyhd3eb1b0_0
xz 5.2.5 h7b6447c_0
yaml 0.2.5 h7b6447c_0
zeromq 4.3.4 h2531618_0
zipp 3.4.1 pyhd3eb1b0_0
zlib 1.2.11 h7b6447c_3
zstd 1.4.9 haebb681_0
For windows:
julia> Conda.list()
[ Info: Running `conda list` in root environment
# packages in environment at C:/Users/gonak/.julia/conda/3/:
#
# Name Version Build Channel
anyio 2.2.0 py38haa95532_2
argon2-cffi 20.1.0 py38h2bbff1b_1
async_generator 1.10 pyhd3eb1b0_0
attrs 21.2.0 pyhd3eb1b0_0
babel 2.9.1 pyhd3eb1b0_0
backcall 0.2.0 pyhd3eb1b0_0
blas 1.0 mkl
bleach 3.3.0 pyhd3eb1b0_0
brotlipy 0.7.0 py38h2bbff1b_1003
ca-certificates 2021.5.25 haa95532_1
certifi 2021.5.30 py38haa95532_0
cffi 1.14.3 py38hcd4344a_2
chardet 3.0.4 py38haa95532_1003
colorama 0.4.4 pyhd3eb1b0_0
conda 4.10.1 py38haa95532_1
conda-package-handling 1.7.2 py38h76e460a_0
console_shortcut 0.1.1 4
cryptography 3.2.1 py38hcd4344a_1
decorator 5.0.9 pyhd3eb1b0_0
defusedxml 0.7.1 pyhd3eb1b0_0
entrypoints 0.3 py38_0
icu 58.2 ha925a31_3
idna 2.10 py_0
importlib-metadata 3.10.0 py38haa95532_0
importlib_metadata 3.10.0 hd3eb1b0_0
intel-openmp 2021.2.0 haa95532_616
ipykernel 5.3.4 py38h5ca1d4c_0
ipython 7.22.0 py38hd4e2768_0
ipython_genutils 0.2.0 pyhd3eb1b0_1
ipywidgets 7.6.3 pyhd3eb1b0_1
jedi 0.17.0 py38_0
jinja2 3.0.0 pyhd3eb1b0_0
jpeg 9b hb83a4c4_2
json5 0.9.5 py_0
jsonschema 3.2.0 py_2
jupyter 1.0.0 py38_7
jupyter-packaging 0.7.12 pyhd3eb1b0_0
jupyter_client 6.1.12 pyhd3eb1b0_0
jupyter_console 6.4.0 pyhd3eb1b0_0
jupyter_core 4.7.1 py38haa95532_0
jupyter_server 1.4.1 py38haa95532_0
jupyterlab 3.0.14 pyhd3eb1b0_1
jupyterlab_pygments 0.1.2 py_0
jupyterlab_server 2.4.0 pyhd3eb1b0_0
jupyterlab_widgets 1.0.0 pyhd3eb1b0_1
libpng 1.6.37 h2a8f88b_0
libsodium 1.0.18 h62dcd97_0
m2w64-gcc-libgfortran 5.3.0 6
m2w64-gcc-libs 5.3.0 7
m2w64-gcc-libs-core 5.3.0 7
m2w64-gmp 6.1.0 2
m2w64-libwinpthread-git 5.0.0.4634.697f757 2
markupsafe 2.0.1 py38h2bbff1b_0
menuinst 1.4.16 py38he774522_1
mistune 0.8.4 py38he774522_1000
mkl 2021.2.0 haa95532_296
mkl-service 2.3.0 py38h2bbff1b_1
mkl_fft 1.3.0 py38h277e83a_2
mkl_random 1.2.1 py38hf11a4ad_2
mpmath 1.2.1 py38haa95532_0
msys2-conda-epoch 20160418 1
nbclassic 0.2.6 pyhd3eb1b0_0
nbclient 0.5.3 pyhd3eb1b0_0
nbconvert 6.0.7 py38_0
nbformat 5.1.3 pyhd3eb1b0_0
nest-asyncio 1.5.1 pyhd3eb1b0_0
notebook 6.4.0 py38haa95532_0
numpy 1.20.2 py38ha4e8547_0
numpy-base 1.20.2 py38hc2deb75_0
openssl 1.1.1k h2bbff1b_0
packaging 20.9 pyhd3eb1b0_0
pandoc 2.12 haa95532_0
pandocfilters 1.4.3 py38haa95532_1
parso 0.8.2 pyhd3eb1b0_0
pickleshare 0.7.5 pyhd3eb1b0_1003
pip 20.2.4 py38haa95532_0
powershell_shortcut 0.0.1 3
prometheus_client 0.10.1 pyhd3eb1b0_0
prompt-toolkit 3.0.17 pyh06a4308_0
prompt_toolkit 3.0.17 hd3eb1b0_0
pycosat 0.6.3 py38h2bbff1b_0
pycparser 2.20 py_2
pygments 2.9.0 pyhd3eb1b0_0
pyopenssl 19.1.0 pyhd3eb1b0_1
pyparsing 2.4.7 pyhd3eb1b0_0
pyqt 5.9.2 py38ha925a31_4
pyrsistent 0.17.3 py38he774522_0
pysocks 1.7.1 py38haa95532_0
python 3.8.5 h5fd99cc_1
python-dateutil 2.8.1 pyhd3eb1b0_0
pytz 2021.1 pyhd3eb1b0_0
pywin32 227 py38he774522_1
pywinpty 0.5.7 py38_0
pyzmq 20.0.0 py38hd77b12b_1
qt 5.9.7 vc14h73c81de_0
qtconsole 5.0.3 pyhd3eb1b0_0
qtpy 1.9.0 py_0
requests 2.24.0 py_0
ruamel_yaml 0.15.87 py38he774522_1
send2trash 1.5.0 pyhd3eb1b0_1
setuptools 50.3.1 py38haa95532_1
sip 4.19.13 py38ha925a31_0
six 1.15.0 py38haa95532_0
sniffio 1.2.0 py38haa95532_1
sqlite 3.33.0 h2a8f88b_0
sympy 1.8 py38haa95532_0
terminado 0.9.4 py38haa95532_0
testpath 0.4.4 pyhd3eb1b0_0
tornado 6.1 py38h2bbff1b_0
tqdm 4.51.0 pyhd3eb1b0_0
traitlets 5.0.5 pyhd3eb1b0_0
urllib3 1.25.11 py_0
vc 14.1 h0510ff6_4
vs2015_runtime 14.16.27012 hf0eaf9b_3
wcwidth 0.2.5 py_0
webencodings 0.5.1 py38_1
wheel 0.35.1 pyhd3eb1b0_0
widgetsnbextension 3.5.1 py38_0
win_inet_pton 1.1.0 py38haa95532_0
wincertstore 0.2 py38_0
winpty 0.4.3 4
yaml 0.2.5 he774522_0
zeromq 4.3.3 ha925a31_3
zipp 3.4.1 pyhd3eb1b0_0
zlib 1.2.11 h62dcd97_4
I checked quickly on my notebook which is running Windows 10 Enterprise 20H2. In WSL 2 Ubuntu 20.04 I get
julia> import PyCall
julia> const sympy = PyCall.pyimport_conda("sympy", "sympy")
PyObject <module 'sympy' from '/home/goran/.julia/conda/3/lib/python3.8/site-packages/sympy/__init__.py'>
julia> a = sympy.symbols("a")
PyObject a
julia> p = sympy.Poly(a^2 + 3*a -2, a)
PyObject Poly(a**2 + 3*a - 2, a, domain='ZZ')
julia> for i in 0:2; @show p.coeff_monomial(a^i); end
p.coeff_monomial(a ^ i) = PyObject -2
p.coeff_monomial(a ^ i) = PyObject 3
p.coeff_monomial(a ^ i) = PyObject 1
julia> Threads.@threads for i in 0:2; @show p.coeff_monomial(a^i); end
signal (11): Segmentation fault
p.coeff_monomial(a ^ i) = in expression starting at REPL[16]:1
PyObject 1
_PyObject_Malloc at /home/goran/.julia/conda/3/lib/libpython3.8.so.1.0 (unknown line)
_PyObject_GC_New at /home/goran/.julia/conda/3/lib/libpython3.8.so.1.0 (unknown line)
PyCell_New at /home/goran/.julia/conda/3/lib/libpython3.8.so.1.0 (unknown line)
_PyEval_EvalCodeWithName at /home/goran/.julia/conda/3/lib/libpython3.8.so.1.0 (unknown line)
_PyFunction_Vectorcall at /home/goran/.julia/conda/3/lib/libpython3.8.so.1.0 (unknown line)
call_function.lto_priv.1695 at /home/goran/.julia/conda/3/lib/libpython3.8.so.1.0 (unknown line)
_PyEval_EvalFrameDefault at /home/goran/.julia/conda/3/lib/libpython3.8.so.1.0 (unknown line)
_PyEval_EvalCodeWithName at /home/goran/.julia/conda/3/lib/libpython3.8.so.1.0 (unknown line)
_PyFunction_Vectorcall at /home/goran/.julia/conda/3/lib/libpython3.8.so.1.0 (unknown line)
call_function.lto_priv.1695 at /home/goran/.julia/conda/3/lib/libpython3.8.so.1.0 (unknown line)
_PyEval_EvalFrameDefault at /home/goran/.julia/conda/3/lib/libpython3.8.so.1.0 (unknown line)
_PyEval_EvalCodeWithName at /home/goran/.julia/conda/3/lib/libpython3.8.so.1.0 (unknown line)
_PyFunction_Vectorcall at /home/goran/.julia/conda/3/lib/libpython3.8.so.1.0 (unknown line)
_PyObject_FastCall_Prepend at /home/goran/.julia/conda/3/lib/libpython3.8.so.1.0 (unknown line)
call_maybe.constprop.104 at /home/goran/.julia/conda/3/lib/libpython3.8.so.1.0 (unknown line)
slot_nb_power.lto_priv.1956 at /home/goran/.julia/conda/3/lib/libpython3.8.so.1.0 (unknown line)
ternary_op.isra.40.lto_priv.2161 at /home/goran/.julia/conda/3/lib/libpython3.8.so.1.0 (unknown line)
macro expansion at /home/goran/.julia/packages/PyCall/BD546/src/exception.jl:95 [inlined]
^ at /home/goran/.julia/packages/PyCall/BD546/src/pyoperators.jl:18 [inlined]
^ at /home/goran/.julia/packages/PyCall/BD546/src/pyoperators.jl:21
unknown function (ip: 0x7f553c055265)
_jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2237 [inlined]
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2419
macro expansion at ./show.jl:955 [inlined]
macro expansion at ./REPL[16]:1 [inlined]
#23#threadsfor_fun at ./threadingconstructs.jl:81
#23#threadsfor_fun at ./threadingconstructs.jl:48
unknown function (ip: 0x7f553c05a64c)
_jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2237 [inlined]
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2419
jl_apply at /buildworker/worker/package_linux64/build/src/julia.h:1703 [inlined]
start_task at /buildworker/worker/package_linux64/build/src/task.c:839
unknown function (ip: (nil))
Allocations: 13590751 (Pool: 13585686; Big: 5065); GC: 17
Segmentation fault (core dumped)
julia> versioninfo()
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-8665U CPU @ 1.90GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-11.0.1 (ORCJIT, skylake)
julia>
julia> Conda.list()
[ Info: Running `conda list` in root environment
# packages in environment at /home/goran/.julia/conda/3:
#
# Name Version Build Channel
_libgcc_mutex 0.1 main
anyio 2.2.0 py38h06a4308_1
argon2-cffi 20.1.0 py38h27cfd23_1
async_generator 1.10 pyhd3eb1b0_0
attrs 21.2.0 pyhd3eb1b0_0
babel 2.9.1 pyhd3eb1b0_0
backcall 0.2.0 pyhd3eb1b0_0
blas 1.0 mkl
bleach 3.3.0 pyhd3eb1b0_0
brotlipy 0.7.0 py38h27cfd23_1003
ca-certificates 2021.4.13 h06a4308_1
certifi 2020.12.5 py38h06a4308_0
cffi 1.14.5 py38h261ae71_0
chardet 4.0.0 py38h06a4308_1003
conda 4.10.1 py38h06a4308_1
conda-package-handling 1.7.3 py38h27cfd23_1
cryptography 3.4.7 py38hd23ed53_0
cycler 0.10.0 py38_0
dbus 1.13.18 hb2f20db_0
decorator 5.0.9 pyhd3eb1b0_0
defusedxml 0.7.1 pyhd3eb1b0_0
entrypoints 0.3 py38_0
expat 2.4.1 h2531618_2
fontconfig 2.13.1 h6c09931_0
freetype 2.10.4 h5ab3b9f_0
glib 2.68.2 h36276a3_0
gmp 6.2.1 h2531618_2
gmpy2 2.0.8 py38hd5f6e3b_3
gst-plugins-base 1.14.0 h8213a91_2
gstreamer 1.14.0 h28cd5cc_2
icu 58.2 he6710b0_3
idna 2.10 pyhd3eb1b0_0
importlib-metadata 3.10.0 py38h06a4308_0
importlib_metadata 3.10.0 hd3eb1b0_0
intel-openmp 2021.2.0 h06a4308_610
ipykernel 5.3.4 py38h5ca1d4c_0
ipython 7.22.0 py38hb070fc8_0
ipython_genutils 0.2.0 pyhd3eb1b0_1
ipywidgets 7.6.3 pyhd3eb1b0_1
jedi 0.17.0 py38_0
jinja2 3.0.0 pyhd3eb1b0_0
jpeg 9b h024ee3a_2
json5 0.9.5 py_0
jsonschema 3.2.0 py_2
jupyter 1.0.0 py38_7
jupyter-packaging 0.7.12 pyhd3eb1b0_0
jupyter_client 6.1.12 pyhd3eb1b0_0
jupyter_console 6.4.0 pyhd3eb1b0_0
jupyter_core 4.7.1 py38h06a4308_0
jupyter_server 1.4.1 py38h06a4308_0
jupyterlab 2.3.1 pyhd3eb1b0_0
jupyterlab_pygments 0.1.2 py_0
jupyterlab_server 1.2.0 py_0
jupyterlab_widgets 1.0.0 pyhd3eb1b0_1
kiwisolver 1.3.1 py38h2531618_0
lcms2 2.12 h3be6417_0
ld_impl_linux-64 2.33.1 h53a641e_7
libffi 3.3 he6710b0_2
libgcc-ng 9.1.0 hdf63c60_0
libpng 1.6.37 hbc83047_0
libsodium 1.0.18 h7b6447c_0
libstdcxx-ng 9.1.0 hdf63c60_0
libtiff 4.1.0 h2733197_1
libuuid 1.0.3 h1bed415_2
libxcb 1.14 h7b6447c_0
libxml2 2.9.10 hb55368b_3
lz4-c 1.9.3 h2531618_0
markupsafe 2.0.1 py38h27cfd23_0
matplotlib 3.3.4 py38h06a4308_0
matplotlib-base 3.3.4 py38h62a2d02_0
mistune 0.8.4 py38h7b6447c_1000
mkl 2021.2.0 h06a4308_296
mkl-service 2.3.0 py38h27cfd23_1
mkl_fft 1.3.0 py38h42c9631_2
mkl_random 1.2.1 py38ha9443f7_2
mpc 1.1.0 h10f8cd9_1
mpfr 4.0.2 hb69a4c5_1
mpmath 1.2.1 py38h06a4308_0
nbclassic 0.2.6 pyhd3eb1b0_0
nbclient 0.5.3 pyhd3eb1b0_0
nbconvert 6.0.7 py38_0
nbformat 5.1.3 pyhd3eb1b0_0
ncurses 6.2 he6710b0_1
nest-asyncio 1.5.1 pyhd3eb1b0_0
nodejs 12.4.0 he1b5a44_0 conda-forge
notebook 6.4.0 py38h06a4308_0
numpy 1.20.2 py38h2d18471_0
numpy-base 1.20.2 py38hfae3a4d_0
olefile 0.46 py_0
openssl 1.1.1k h27cfd23_0
packaging 20.9 pyhd3eb1b0_0
pandoc 2.12 h06a4308_0
pandocfilters 1.4.3 py38h06a4308_1
parso 0.8.2 pyhd3eb1b0_0
pcre 8.44 he6710b0_0
pexpect 4.8.0 pyhd3eb1b0_3
pickleshare 0.7.5 pyhd3eb1b0_1003
pillow 8.2.0 py38he98fc37_0
pip 21.1.1 py38h06a4308_0
prometheus_client 0.10.1 pyhd3eb1b0_0
prompt-toolkit 3.0.17 pyh06a4308_0
prompt_toolkit 3.0.17 hd3eb1b0_0
ptyprocess 0.7.0 pyhd3eb1b0_2
pycosat 0.6.3 py38h7b6447c_1
pycparser 2.20 py_2
pygments 2.9.0 pyhd3eb1b0_0
pyopenssl 20.0.1 pyhd3eb1b0_1
pyparsing 2.4.7 pyhd3eb1b0_0
pyqt 5.9.2 py38h05f1152_4
pyrsistent 0.17.3 py38h7b6447c_0
pysocks 1.7.1 py38h06a4308_0
python 3.8.10 hdb3f193_7
python-dateutil 2.8.1 pyhd3eb1b0_0
python_abi 3.8 1_cp38 conda-forge
pytz 2021.1 pyhd3eb1b0_0
pyzmq 20.0.0 py38h2531618_1
qt 5.9.7 h5867ecd_1
qtconsole 5.0.3 pyhd3eb1b0_0
qtpy 1.9.0 py_0
readline 8.1 h27cfd23_0
requests 2.25.1 pyhd3eb1b0_0
ruamel_yaml 0.15.100 py38h27cfd23_0
send2trash 1.5.0 pyhd3eb1b0_1
setuptools 52.0.0 py38h06a4308_0
sip 4.19.13 py38he6710b0_0
six 1.15.0 py38h06a4308_0
sniffio 1.2.0 py38h06a4308_1
sqlite 3.35.4 hdfb4753_0
sympy 1.8 py38h06a4308_0
terminado 0.9.4 py38h06a4308_0
testpath 0.4.4 pyhd3eb1b0_0
tk 8.6.10 hbc83047_0
tornado 6.1 py38h27cfd23_0
tqdm 4.59.0 pyhd3eb1b0_1
traitlets 5.0.5 pyhd3eb1b0_0
urllib3 1.26.4 pyhd3eb1b0_0
wcwidth 0.2.5 py_0
webencodings 0.5.1 py38_1
wheel 0.36.2 pyhd3eb1b0_0
widgetsnbextension 3.5.1 py38_0
xz 5.2.5 h7b6447c_0
yaml 0.2.5 h7b6447c_0
zeromq 4.3.4 h2531618_0
zipp 3.4.1 pyhd3eb1b0_0
zlib 1.2.11 h7b6447c_3
zstd 1.4.9 haebb681_0
While on the host OS I get
julia> import PyCall
julia> const sympy = PyCall.pyimport_conda("sympy", "sympy")
PyObject <module 'sympy' from 'C:\\Users\\gnakerst\\.julia\\conda\\3\\lib\\site-packages\\sympy\\__init__.py'>
julia> a = sympy.symbols("a")
PyObject a
julia> p = sympy.Poly(a^2 + 3*a -2, a)
PyObject Poly(a**2 + 3*a - 2, a, domain='ZZ')
julia> for i in 0:2; @show p.coeff_monomial(a^i); end
p.coeff_monomial(a ^ i) = PyObject -2
p.coeff_monomial(a ^ i) = PyObject 3
p.coeff_monomial(a ^ i) = PyObject 1
julia> Threads.@threads for i in 0:2; @show p.coeff_monomial(a^i); end
ERROR: TaskFailedException
Stacktrace:
[1] wait
@ .\task.jl:317 [inlined]
[2] threading_run(func::Function)
@ Base.Threads .\threadingconstructs.jl:34
[3] top-level scope
@ .\threadingconstructs.jl:93
nested task error: $(Expr(:escape, :(ccall(#= C:\Users\gnakerst\.julia\packages\PyCall\BD546\src\pyfncall.jl:43 =# @pysym(:PyObject_Call), PyPtr, (PyPtr, PyPtr, PyPtr), o, pyargsptr, kw)))) failed
Stacktrace:
[1] error(::String, ::String)
@ Base .\error.jl:42
[2] _handle_error(msg::String)
@ PyCall ~\.julia\packages\PyCall\BD546\src\exception.jl:84
julia> Conda.list()
[ Info: Running `conda list` in root environment
# packages in environment at C:\Users\gnakerst\.julia\conda\3:
#
# Name Version Build Channel
anyio 2.2.0 py38haa95532_1
argon2-cffi 20.1.0 py38h2bbff1b_1
async_generator 1.10 pyhd3eb1b0_0
attrs 20.3.0 pyhd3eb1b0_0
babel 2.9.0 pyhd3eb1b0_0
backcall 0.2.0 pyh9f0ad1d_0 conda-forge
backports 1.0 py_2 conda-forge
backports.functools_lru_cache 1.6.1 py_0 conda-forge
blas 1.0 mkl
bleach 3.3.0 pyhd3eb1b0_0
brotlipy 0.7.0 py38he774522_1000
ca-certificates 2021.4.13 haa95532_1
certifi 2020.12.5 py38haa95532_0
cffi 1.14.2 py38h7a1dbc1_0
chardet 3.0.4 py38_1003
colorama 0.4.4 pyh9f0ad1d_0 conda-forge
conda 4.10.1 py38haa95532_1
conda-package-handling 1.6.1 py38h62dcd97_0
console_shortcut 0.1.1 4
cryptography 3.1 py38h7a1dbc1_0
cycler 0.10.0 py38_0
cython 0.29.22 pypi_0 pypi
decorator 4.4.2 py_0 conda-forge
defusedxml 0.7.1 pyhd3eb1b0_0
dill 0.3.3 pypi_0 pypi
dlx 1.0.4 pypi_0 pypi
docplex 2.15.194 pypi_0 pypi
entrypoints 0.3 py38_0
fastcache 1.1.0 py38he774522_0
fastdtw 0.3.4 pypi_0 pypi
fastjsonschema 2.15.0 pypi_0 pypi
freetype 2.10.2 hd328e21_0
h5py 3.2.1 pypi_0 pypi
icu 58.2 ha925a31_3
idna 2.10 py_0
importlib-metadata 3.10.0 py38haa95532_0
importlib_metadata 3.10.0 hd3eb1b0_0
inflection 0.5.1 pypi_0 pypi
intel-openmp 2020.2 254
ipykernel 5.5.0 pypi_0 pypi
ipython 7.21.0 py38hc5df569_0 conda-forge
ipython-genutils 0.2.0 pypi_0 pypi
ipython_genutils 0.2.0 py_1 conda-forge
jedi 0.18.0 py38haa244fe_2 conda-forge
jinja2 2.11.3 pyhd3eb1b0_0
joblib 1.0.1 pypi_0 pypi
jpeg 9b hb83a4c4_2
json5 0.9.5 py_0
jsonschema 3.2.0 py_2
jupyter-client 6.1.11 pypi_0 pypi
jupyter-packaging 0.7.12 pyhd3eb1b0_0
jupyter_client 6.1.12 pyhd3eb1b0_0
jupyter_core 4.7.1 py38haa244fe_0 conda-forge
jupyter_server 1.4.1 py38haa95532_0
jupyterlab 3.0.11 pyhd3eb1b0_1
jupyterlab_pygments 0.1.2 py_0
jupyterlab_server 2.4.0 pyhd3eb1b0_0
jupyterthemes 0.20.0 py_1 conda-forge
kiwisolver 1.2.0 py38h74a9793_0
lesscpy 0.13.0 py_1 conda-forge
libpng 1.6.37 h2a8f88b_0
libsodium 1.0.18 h62dcd97_0
libtiff 4.1.0 h56a325e_1
lxml 4.6.2 pypi_0 pypi
lz4-c 1.9.2 h62dcd97_1
m2w64-gcc-libgfortran 5.3.0 6
m2w64-gcc-libs 5.3.0 7
m2w64-gcc-libs-core 5.3.0 7
m2w64-gmp 6.1.0 2
m2w64-libwinpthread-git 5.0.0.4634.697f757 2
markupsafe 1.1.1 py38he774522_0
matplotlib 3.3.1 0
matplotlib-base 3.3.1 py38hba9282a_0
menuinst 1.4.16 py38he774522_0
mistune 0.8.4 py38he774522_1000
mkl 2020.2 256
mkl-service 2.3.0 py38hb782905_0
mkl_fft 1.1.0 py38h45dec08_0
mkl_random 1.1.1 py38h47e9c7a_0
more-itertools 8.7.0 pypi_0 pypi
mpmath 1.1.0 py38_0
msys2-conda-epoch 20160418 1
multitasking 0.0.9 pypi_0 pypi
nbclassic 0.2.6 pyhd3eb1b0_0
nbclient 0.5.3 pyhd3eb1b0_0
nbconvert 6.0.7 py38_0
nbformat 5.1.3 pyhd3eb1b0_0
nest-asyncio 1.5.1 pyhd3eb1b0_0
networkx 2.5 pypi_0 pypi
nodejs 14.8.0 hd77b12b_0
notebook 6.3.0 py38haa95532_0
ntlm-auth 1.5.0 pypi_0 pypi
numpy 1.19.1 py38h5510c5b_0
numpy-base 1.19.1 py38ha3acd2a_0
olefile 0.46 py_0
openssl 1.1.1k h2bbff1b_0
packaging 20.9 pyhd3eb1b0_0
pandas 1.2.3 pypi_0 pypi
pandoc 2.12 haa95532_0
pandocfilters 1.4.3 py38haa95532_1
parso 0.8.1 pyhd8ed1ab_0 conda-forge
pickleshare 0.7.5 py_1003 conda-forge
pillow 7.2.0 py38hcc1f983_0
pip 20.2.2 py38_0
ply 3.11 pypi_0 pypi
powershell_shortcut 0.0.1 3
prometheus_client 0.10.1 pyhd3eb1b0_0
prompt-toolkit 3.0.17 pyha770c72_0 conda-forge
psutil 5.8.0 pypi_0 pypi
pybind11 2.6.2 pypi_0 pypi
pycosat 0.6.3 py38he774522_0
pycparser 2.20 py_2
pyglet 1.5.11 pypi_0 pypi
pygments 2.8.1 pyhd8ed1ab_0 conda-forge
pyopenssl 19.1.0 py_1
pyparsing 2.4.7 py_0
pyqt 5.9.2 py38ha925a31_4
pyrsistent 0.17.3 py38he774522_0
pysocks 1.7.1 py38_0
python 3.8.5 h5fd99cc_1
python-constraint 1.4.0 pypi_0 pypi
python-dateutil 2.8.1 py_0
python_abi 3.8 1_cp38 conda-forge
pytz 2021.1 pyhd3eb1b0_0
pywin32 227 py38he774522_1
pywinpty 0.5.7 py38_0
pyzmq 22.0.3 pypi_0 pypi
qiskit 0.24.0 pypi_0 pypi
qiskit-aer 0.7.6 pypi_0 pypi
qiskit-aqua 0.8.2 pypi_0 pypi
qiskit-ibmq-provider 0.12.1 pypi_0 pypi
qiskit-ignis 0.5.2 pypi_0 pypi
qiskit-terra 0.16.4 pypi_0 pypi
qt 5.9.7 vc14h73c81de_0
quandl 3.6.1 pypi_0 pypi
requests 2.24.0 py_0
requests-ntlm 1.1.0 pypi_0 pypi
retworkx 0.8.0 pypi_0 pypi
ruamel_yaml 0.15.87 py38he774522_1
scikit-learn 0.24.1 pypi_0 pypi
scipy 1.6.1 pypi_0 pypi
send2trash 1.5.0 pyhd3eb1b0_1
setuptools 49.6.0 py38_0
sip 4.19.13 py38ha925a31_0
six 1.15.0 py_0
sniffio 1.2.0 py38haa95532_1
sqlite 3.33.0 h2a8f88b_0
sympy 1.6.2 py38haa95532_1
terminado 0.9.4 py38haa95532_0
testpath 0.4.4 pyhd3eb1b0_0
threadpoolctl 2.1.0 pypi_0 pypi
tk 8.6.10 he774522_0
tornado 6.1 py38h2bbff1b_0
tqdm 4.48.2 py_0
traitlets 5.0.5 py_0 conda-forge
urllib3 1.25.10 py_0
vc 14.1 h0510ff6_4
vs2015_runtime 14.16.27012 hf0eaf9b_3
wcwidth 0.2.5 pyh9f0ad1d_2 conda-forge
webencodings 0.5.1 py38_1
websockets 8.1 pypi_0 pypi
wheel 0.35.1 py_0
win_inet_pton 1.1.0 py38_0
wincertstore 0.2 py38_0
winpty 0.4.3 4
xz 5.2.5 h62dcd97_0
yaml 0.2.5 he774522_0
yfinance 0.1.55 pypi_0 pypi
zeromq 4.3.3 ha925a31_3
zipp 3.4.1 pyhd3eb1b0_0
zlib 1.2.11 h62dcd97_4
zstd 1.4.5 h04227a9_0
julia> versioninfo()
Julia Version 1.6.0
Commit f9720dc2eb (2021-03-24 12:55 UTC)
Platform Info:
OS: Windows (x86_64-w64-mingw32)
CPU: Intel(R) Core(TM) i7-8665U CPU @ 1.90GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-11.0.1 (ORCJIT, skylake)
julia>
Yeah, my guess is this is something to report to PyCall
. From skimming over https://github.com/JuliaPy/PyCall.jl/issues/882 it seems like a known area for improvement.
That looks relevant. Thanks! So we have to wait until https://github.com/JuliaPy/PyCall.jl/issues/882 is solved and then check again.
While working with polynomials in
SymPy.jl
I encountered segfaults when using Julia threads. MWE:Is this only problematic with some functions or is
SymPy.jl
in general not threadsafe?