pyjulia icon indicating copy to clipboard operation
pyjulia copied to clipboard

Broken pipe when running script in Anaconda

Open redransil opened this issue 5 years ago • 5 comments

This line:

jl.eval('run_ac_opf("pglib_opf_case5_pjm.m", IpoptSolver())')

gives a broken pipe error:

JuliaError: Exception 'IOError: write: broken pipe (EPIPE)' occurred while calling julia code: run_ac_opf("pglib_opf_case5_pjm.m", IpoptSolver())

But only if I've already run the script. After restarting the terminal everything runs ok the first time. Looking at other issues I think this has something to do with precompilation? Is there some way I can kill Julia every time I run the script without having to manually restart the terminal?

I'm using Spyder/Anaconda/Ubuntu with Julia(compiled_modules=False)

redransil avatar Apr 18 '19 16:04 redransil

It looks like PyJulia is just propagating an error in Julia. Does it occure when you run code in pure-Julia without using PyJulia?

this has something to do with precompilation

No, I don't think so. It looks like a normal Julia error.

tkf avatar Apr 18 '19 19:04 tkf

No, it doesn't occur when I'm running in pure-Julia.

It does happen every time I re-run a script using PyJulia, unless I use a new terminal. I can also call that function multiple times in the same script, or turn it into a class and call the function multiple times from another script using that class. But once it's done running I have to close the terminal.

redransil avatar Apr 18 '19 22:04 redransil

Hmm... That's very odd. I can't come up with any hypothesis ATM. Is it specific to the terminal in Spyder?

tkf avatar Apr 18 '19 22:04 tkf

Hi,

I wanted to ask whether there was a solution to that Problem as I experience the same problem. I can run my script the first time, where Julia is invoked several times without any issue, but when I try to run the same script again, I get an EPIPE error and the script stops working. Also my processor keeps working at high rates, what in my opinion is proof that some Julia instance is still running in the background. I am using Julia 1.3, Python 3.6.7 and Spyder 4.1.0

wenglerjoe avatar Mar 21 '20 09:03 wenglerjoe

This problem only happens to me if I start a Spyder kernel in the terminal and connect to it in the editor. The default kernel works.

That is, if I run

python3 -m spyder_kernels.console

and connect to this kernel in Spyder (v.4.1.4) then every Julia output results in a EPIPE error. The following example would not work:

from julia.api import Julia
Julia(compiled_modules = False)
from julia import Main
Main.eval('println("Hello World")')

Using ipython kernel instead solves my problem. This is curious because according to the documentation such a kernel should not work.

For the time being I will thus continue using ipython kernel in my container.

manuelbb-upb avatar Jul 15 '20 13:07 manuelbb-upb