I ran the example (semi-definite relaxation of AC-OPF) on my Mac (M2) and Linux Mint (Ubuntu 20.04), respectively. However, I got the same running problem.
I can make sure that the PATH of julia and python interpreter are set correctly. My python script name is pandamodel_test.py, where I have the following codes:
import pandapower as pp
import pandapower.networks as nw
net = nw.example_simple()
pp.runpm(net, pm_model="SDPWRMPowerModel", pm_solver="ipopt", pm_nl_solver="juniper")
I first ran $python pandamodel_test.py. However, the log information says "Currently, PyJulia does not fully
support such Python interpreter" and suggests me to use the command $python-jl PATH/TO/YOUR/SCRIPT.py. I followed its suggestion and run $python-jl pandamodel_test.py. Then, I got the error.
(base) myName@myName-MacBook-Air pandapowerVVO % python pandamodel_test.py
no costs are given - overall generated power is minimized
Traceback (most recent call last):
File "/Users/myName/PycharmProjects/pandapowerVVO/pandamodel_test.py", line 5, in <module>
pp.runpm(net, pm_model="SDPWRMPowerModel", pm_solver="ipopt", pm_nl_solver="juniper")
File "/Users/myName/.julia/conda/3/x86_64/lib/python3.10/site-packages/pandapower/runpm.py", line 103, in runpm
_runpm(net, delete_buffer_file=delete_buffer_file, pm_file_path=pm_file_path, pdm_dev_mode=pdm_dev_mode)
File "/Users/myName/.julia/conda/3/x86_64/lib/python3.10/site-packages/pandapower/opf/run_pandamodels.py", line 35, in _runpm
result_pm = _call_pandamodels(buffer_file, net._options["julia_file"], pdm_dev_mode)
File "/Users/myName/.julia/conda/3/x86_64/lib/python3.10/site-packages/pandapower/opf/run_pandamodels.py", line 58, in _call_pandamodels
from julia import Main
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 672, in _load_unlocked
File "<frozen importlib._bootstrap>", line 632, in _load_backward_compatible
File "/Users/myName/.julia/conda/3/x86_64/lib/python3.10/site-packages/julia/core.py", line 247, in load_module
JuliaMainModule(self, fullname))
File "/Users/myName/.julia/conda/3/x86_64/lib/python3.10/site-packages/julia/core.py", line 149, in __init__
self._julia = loader.julia
File "/Users/myName/.julia/conda/3/x86_64/lib/python3.10/site-packages/julia/core.py", line 239, in julia
self.__class__.julia = julia = Julia()
File "/Users/myName/.julia/conda/3/x86_64/lib/python3.10/site-packages/julia/core.py", line 489, in __init__
raise UnsupportedPythonError(jlinfo)
julia.core.UnsupportedPythonError: It seems your Julia and PyJulia setup are not supported.
Julia executable:
julia
Python interpreter and libpython used by PyCall.jl:
/Users/myName/.julia/conda/3/x86_64/bin/python
/Users/myName/.julia/conda/3/x86_64/lib/libpython3.10.dylib
Python interpreter used to import PyJulia and its libpython.
/Users/myName/.julia/conda/3/x86_64/bin/python
/Users/myName/.julia/conda/3/x86_64/lib/libpython3.10.dylib
Your Python interpreter "/Users/myName/.julia/conda/3/x86_64/bin/python"
is statically linked to libpython. Currently, PyJulia does not fully
support such Python interpreter.
The easiest workaround is to pass `compiled_modules=False` to `Julia`
constructor. To do so, first *reboot* your Python REPL (if this happened
inside an interactive session) and then evaluate:
>>> from julia.api import Julia
>>> jl = Julia(compiled_modules=False)
Another workaround is to run your Python script with `python-jl`
command bundled in PyJulia. You can simply do:
$ python-jl PATH/TO/YOUR/SCRIPT.py
See `python-jl --help` for more information.
For more information, see:
https://pyjulia.readthedocs.io/en/latest/troubleshooting.html
(base) myName@myName-MacBook-Air pandapowerVVO % python-jl pandamodel_test.py
no costs are given - overall generated power is minimized
[info | PowerModels]: Suppressing information and warning messages for the rest of this session. Use the Memento package for more fine-grained control of logging.
Traceback (most recent call last):
File "/Users/myName/.julia/conda/3/x86_64/lib/python3.10/site-packages/julia/pseudo_python_cli.py", line 308, in main
python(**vars(ns))
File "/Users/myName/.julia/conda/3/x86_64/lib/python3.10/site-packages/julia/pseudo_python_cli.py", line 59, in python
scope = runpy.run_path(script, run_name="__main__")
File "/Users/myName/.julia/conda/3/x86_64/lib/python3.10/runpy.py", line 289, in run_path
return _run_module_code(code, init_globals, run_name,
File "/Users/myName/.julia/conda/3/x86_64/lib/python3.10/runpy.py", line 96, in _run_module_code
_run_code(code, mod_globals, init_globals,
File "/Users/myName/.julia/conda/3/x86_64/lib/python3.10/runpy.py", line 86, in _run_code
exec(code, run_globals)
File "pandamodel_test.py", line 5, in <module>
pp.runpm(net, pm_model="SDPWRMPowerModel", pm_solver="ipopt", pm_nl_solver="juniper")
File "/Users/myName/.julia/conda/3/x86_64/lib/python3.10/site-packages/pandapower/runpm.py", line 103, in runpm
_runpm(net, delete_buffer_file=delete_buffer_file, pm_file_path=pm_file_path, pdm_dev_mode=pdm_dev_mode)
File "/Users/myName/.julia/conda/3/x86_64/lib/python3.10/site-packages/pandapower/opf/run_pandamodels.py", line 35, in _runpm
result_pm = _call_pandamodels(buffer_file, net._options["julia_file"], pdm_dev_mode)
File "/Users/myName/.julia/conda/3/x86_64/lib/python3.10/site-packages/pandapower/opf/run_pandamodels.py", line 99, in _call_pandamodels
result_pm = Main.eval(julia_file + "(buffer_file)")
File "/Users/myName/.julia/conda/3/x86_64/lib/python3.10/site-packages/julia/core.py", line 627, in eval
ans = self._call(src)
File "/Users/myName/.julia/conda/3/x86_64/lib/python3.10/site-packages/julia/core.py", line 555, in _call
self.check_exception(src)
File "/Users/myName/.julia/conda/3/x86_64/lib/python3.10/site-packages/julia/core.py", line 609, in check_exception
raise JuliaError(u'Exception \'{}\' occurred while calling julia code:\n{}'
julia.core.JuliaError: Exception 'MathOptInterface.UnsupportedConstraint{MathOptInterface.VectorAffineFunction{Float64}, MathOptInterface.SecondOrderCone}: `MathOptInterface.VectorAffineFunction{Float64}`-in-`MathOptInterface.SecondOrderCone` constraint is not supported by the model.' occurred while calling julia code:
run_powermodels_opf(buffer_file)
I wish I can get you feedback since I have been strugelling in this issue for some days. I also wish to get your suggestion for the version of python, julia, pyjulia, and pandapwer, which you used in your devlopment.