I am trying to run a graph optimization with the ortools library in Python. I have installed the latest version via pip install in a conda environment but still, I get this very unspecific error of a failed import of ortool's pywrapgraph module:
Exception has occurred: ImportError
cannot import name 'pywrapgraph' from 'ortools.graph' (c:\Users\user\AppData\Local\miniconda3\envs\ROME\Lib\site-packages\ortools\graph\__init__.py)
File "D:\automation\optimizeGraphGoogleOR.py", line 3, in <module>
from ortools.graph import pywrapgraph
ImportError: cannot import name 'pywrapgraph' from 'ortools.graph' (c:\Users\user\AppData\Local\miniconda3\envs\ROME\Lib\site-packages\ortools\graph\__init__.py)
I have already tried some other versions, but the error keeps persisting, any clue on how to fix that? Thanks!
I have already tried installing different versions and expected that to fix the issue, but running the command from ortools.graph import pywrapgraph
still results in an error message.
I am trying to run a graph optimization with the ortools library in Python. I have installed the latest version via pip install in a conda environment but still, I get this very unspecific error of a failed import of ortool's pywrapgraph module:
Exception has occurred: ImportError
cannot import name 'pywrapgraph' from 'ortools.graph' (c:\Users\user\AppData\Local\miniconda3\envs\ROME\Lib\site-packages\ortools\graph\__init__.py)
File "D:\automation\optimizeGraphGoogleOR.py", line 3, in <module>
from ortools.graph import pywrapgraph
ImportError: cannot import name 'pywrapgraph' from 'ortools.graph' (c:\Users\user\AppData\Local\miniconda3\envs\ROME\Lib\site-packages\ortools\graph\__init__.py)
I have already tried some other versions, but the error keeps persisting, any clue on how to fix that? Thanks!
I have already tried installing different versions and expected that to fix the issue, but running the command from ortools.graph import pywrapgraph
still results in an error message.
2 Answers
Reset to default 3Changed in release 9.4 and described in the release notes:
https://github/google/or-tools/releases/tag/v9.4
The pywrapgraph
is deprecated and has been removed from recent versions of OR-Tools.
Now to import the new modules you have to use
from ortools.graph.python import min_cost_flow
from ortools.graph.python import max_flow
from ortools.graph.python import linear_sum_assignment