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

[bug] Failed to precompile PandaModels on Mac M1 #2417

Closed
5 of 6 tasks
yasirroni opened this issue Oct 9, 2024 · 2 comments
Closed
5 of 6 tasks

[bug] Failed to precompile PandaModels on Mac M1 #2417

yasirroni opened this issue Oct 9, 2024 · 2 comments
Labels

Comments

@yasirroni
Copy link
Contributor

Bug report checklis

  • Searched the issues page for similar reports

  • Read the relevant sections of the documentation

  • Browse the tutorials and tests for usefull code snippets and examples of use

  • Reproduced the issue after updating with pip install --upgrade pandapower (or git pull)

  • Tried basic troubleshooting (if a bug/error) like restarting the interpreter and checking the pythonpath

Reproducible Example

import pandapower as pp


pp.runpm_ac_opf(net)
pp.runpm_ac_opf(net, optimizer="ipopt")

Issue Description and Traceback

Running above code, I got this error

JuliaError: Exception 'Failed to precompile PandaModels [2dbab86a-7cbf-476f-9afe-75ffd3079e7c] to "/Users/macbookair/.julia/compiled/v1.10/PandaModels/jl_eidSz9".' occurred while calling julia code:
using PandaModels

On the other hand, I can run PowerModels directly using julia from Python just fine.

import julia
julia.install(quiet=True)

from matpower import path_matpower_cases

from julia import Main


Main.eval("""
    using PowerModels
    using Ipopt
    using JuMP

    nlp_solver = JuMP.optimizer_with_attributes(Ipopt.Optimizer, "tol"=>1e-6, "print_level"=>0)
""")

func_name = 'case9'
file_path = f"{path_matpower_cases}/{func_name}.m"

Main.eval('solver = optimizer_with_attributes(Ipopt.Optimizer, "tol" => 1e-6)')
result_ac  = Main.eval(f'solve_opf("{file_path}",   ACPPowerModel, solver)')

Expected Behavior

I can Main.eval just fine, PandaModels that relies on that should be able to run just fine.

Installed Versions

  • python version: '2.14.10' * Operating System name/version: MacOs, M1

Label

  • Relevant labels are selected
@yasirroni yasirroni added the bug label Oct 9, 2024
@yasirroni
Copy link
Contributor Author

Turns out, it is because PandaModels requires Cbc, and Cbc requires Cbc-2.10.0. Need some acrobatic as brew didn't support old Cbc.

julia
import Pkg
Pkg.rm("Cbc")
exit()
sudo cd /usr/local/lib
sudo curl -LO https://github.com/coin-or/Cbc/archive/refs/tags/2.10.0.tar.gz
sudo tar -xvzf 2.10.0.tar.gz
cd Cbc-releases-2.10.0
sudo ./configure
make
sudo make install
julia
ENV["JULIA_CBC_LIBRARY_PATH"] = "/usr/local/lib/Cbc-releases-2.10.0/lib"
import Pkg
Pkg.build("Cbc")
using Cbc

@yasirroni
Copy link
Contributor Author

yasirroni commented Oct 10, 2024

Now, the bug became

FAILED test_pandamodels_runpm.py::test_compare_pwl_and_poly - pandapower.auxiliary.OPFNotConverged: PowerModels.jl OPF not converged
FAILED test_pandamodels_runpm.py::test_without_ext_grid - pandapower.auxiliary.OPFNotConverged: PowerModels.jl OPF not converged
FAILED test_pandamodels_runpm.py::test_storage_opt - KeyError: 'bus_dc'
FAILED test_pandamodels_runpm.py::test_runpm_multi_vstab - KeyError: 'bus_dc'
FAILED test_pandamodels_runpm.py::test_runpm_qflex_and_multi_qflex - KeyError: 'bus_dc'

The error of bus_dc might be related to #2413. I will close this and track it there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant