Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"IOError: stream is closed or unusable" when using parse_file() in Pluto.jl #830

Open
samtalki opened this issue Jul 4, 2022 · 7 comments

Comments

@samtalki
Copy link

samtalki commented Jul 4, 2022

Hello all,

I have encountered a new bug on my machine over the past few months when attempting to use parse_file() within a Pluto.jl notebook.. This is one of those tricky issues where it's not clear which package is causing the bug, so I apologize in advance for the confusion. I looked into the source of both packages to try to seek out the root cause, but unfortunately I couldn't figure it out on my own. Please let me know if you agree that I should also open an issue with Pluto.

Info on my machine:

  • Julia Version: 1.7.3 (2022-05-06) Fedora 36 Build
  • OS: Fedora 36
  • CPU: Ryzen 4750U

Step 1: setup environment to reproduce:

For convenience, you could skip this step and clone my repository I made to demonstrate this issue (available here).

Alternatively, make a fresh Julia environment >=1.7 and load your favorite test case into the root directory. Run these commands in the REPL:

pkg> generate PlutoPowerModelsTest
shell> cd PlutoPowerModelsTest
pkg> activate .
pkg> add Pluto
julia> import Pluto
julia> Pluto.run()

Step 2: run parse_file() in a Pluto.jl notebook

Within the Pluto landing page, create a new notebook. Drop your case14.m or other file into the same directory as the notebook and then run the following commands within the notebook to reproduce the error.

using PowerModels
case14 = parse_file("case14.m")

You should receive the following error:
image

@ccoffrin
Copy link
Member

ccoffrin commented Jul 5, 2022

@samtalki, thanks for reporting this issue. Given that parse_file is a very well tested feature of PowerModels and that I have never encountered the error that you are seeing here, I think this has to be an issue with Pluto and I would recommend posting to their GitHub repo or raising this question on Julia Discourse for discussion. Maybe other Pluto users are familiar with this?

If you can build a MWE that produces this error without using Pluto, then please post that here and I can explore how to fix it.

@ccoffrin
Copy link
Member

I am going to close this as it is not reproducible in this repo.

@MartaVanin
Copy link

hi, sorry for commenting on this very old issue, hope you don't mind.
we bumped into this problem today and I just wanted to add for future reference that probably something broke between pluto 0.18.0 and 0.19.0 (which was released before you opened this issue, so I reckon this was what you were using). If you downgrade pluto to 0.18.0 the parse_file function works, so that's a quick workaround.

@ccoffrin
Copy link
Member

Thanks @MartaVanin. Can you document a MWE so that this issue can be reproduced?

@MartaVanin
Copy link

MartaVanin commented Apr 17, 2023

yes, using Julia 1.8, if I run the following in a Pluto 0.18.0 notebook it works, while it fails on the latest Pluto (v0.19.24)

begin
    using PowerModels # automatically install latest, see https://github.com/fonsp/Pluto.jl/wiki/%F0%9F%8E%81-Package-management
    test_file = joinpath(dirname(dirname(pathof(PowerModels))), "test/data/matpower/case5.m")
    f = parse_matpower(test_file)
end

I can open an issue on Pluto and @ you there if you like

@ccoffrin
Copy link
Member

ccoffrin commented Sep 10, 2023

Report from @ChrisRackauckas on how to reproduce,

import PowerModels
file_name = "../../benchmarks/OptimizationFrameworks/opf_data/pglib_opf_case5_pjm.m"
data = PowerModels.parse_file(file_name)

works, but

import PowerModels
file_name = "../../benchmarks/OptimizationFrameworks/opf_data/pglib_opf_case5_pjm.m"
data = PowerModels.parse_file(file_name)

fails

The issue is related to Memento's stream being closed prematurely.

@ccoffrin
Copy link
Member

Related issue, JunoLab/Weave.jl#442

#886 does not appear to fix the issue.

ChrisRackauckas added a commit to ChrisRackauckas/PowerModels.jl that referenced this issue Sep 11, 2023
It doesn't seem to make a difference, other than fixes lanl-ansi#830
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants