Gast
December 5, 2023, 2:43pm
1
Importing the Python module Scipy
instantly crashes and closes VSCode Julia REPL before I can see the error message.
For instance, the following code crashes my REPL every time:
julia> using PyCall
julia> mv = pyimport("scipy.stats.mvn")
Interestingly, importing the module Math
does not crash my REPL:
julia> using PyCall
julia> math= pyimport("math")
PyObject <module 'math' from '/Users/gaston/.julia/conda/3/lib/python3.10/lib-dynload/math.cpython-310-darwin.so'>
In VSCode, I am using:
Version: 1.84.2 (Universal)
Commit: 1a5daa3a0231a0fbba4f14db7ec463cf99d7768e
Date: 2023-11-09T10:52:33.687Z
Electron: 25.9.2
ElectronBuildId: 24603566
Chromium: 114.0.5735.289
Node.js: 18.15.0
V8: 11.4.183.29-electron.0
OS: Darwin arm64 20.6.0
And I have v1.60.2
of the Julia language extension. This is all on MacOS Big Sur 11.6 (M1, 16GB)
Does that happen in the terminal too (just trying to get VSCode out of the equation)?
Gast
December 5, 2023, 4:41pm
3
It does.
Calling Scipy
it crashes:
julia> using PyCall
julia> pyimport("scipy")
zsh: killed /Applications/Julia-1.9.app/Contents/Resources/julia/bin/julia
Saving session...
...copying shared history...
...saving history...truncating history files...
...completed.
Deleting expired sessions...none found.
[Process completed]
while calling the module Math
it does not crash:
julia> pyimport("math")
PyObject <module 'math' from '/Users/gaston/.julia/conda/3/lib/python3.10/lib-dynload/math.cpython-310-darwin.so'>
Julia Version 1.9.4
It is probably worth checking that you are using the right Python version with scipy installed. Try typing ENV["PYTHON"]
at the Julia REPL command line and see what Python it’s pointing too and make sure it’s the one you want.
Side note: I think it is generally recommended to use the PythonCall.jl
package these days rather than PyCall.jl
.
2 Likes
Gast
December 5, 2023, 9:55pm
5
Making use of the PythonCall
package instead of PyCall
solved the issue!
I am not sure why but now the Julia REPL does not crash (nor in the terminal).
Thanks for hinting this out.
2 Likes