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

ImportError: cannot import name 'Digraph' from 'graphviz.dot' #282

Closed
johannesmols opened this issue Nov 10, 2021 · 1 comment
Closed

ImportError: cannot import name 'Digraph' from 'graphviz.dot' #282

johannesmols opened this issue Nov 10, 2021 · 1 comment

Comments

@johannesmols
Copy link

I'm getting the following error when trying to use pm4py.

Traceback (most recent call last):
  File "C:/Users/johan/source/repos/miner/src/main.py", line 10, in <module>
    from miner import Miner
  File "C:\Users\johan\source\repos\miner\src\miner.py", line 11, in <module>
    from pm4py import format_dataframe
  File "C:\Users\johan\source\repos\miner\venvwin\lib\site-packages\pm4py\__init__.py", line 20, in <module>
    from pm4py import util, objects, statistics, algo, visualization
  File "C:\Users\johan\source\repos\miner\venvwin\lib\site-packages\pm4py\objects\__init__.py", line 17, in <module>
    from pm4py.objects import log, petri_net, transition_system, conversion, process_tree, random_variables, \
  File "C:\Users\johan\source\repos\miner\venvwin\lib\site-packages\pm4py\objects\log\__init__.py", line 17, in <module>
    from pm4py.objects.log import obj, exporter, importer, util
  File "C:\Users\johan\source\repos\miner\venvwin\lib\site-packages\pm4py\objects\log\exporter\__init__.py", line 17, in <module>
    from pm4py.objects.log.exporter import xes
  File "C:\Users\johan\source\repos\miner\venvwin\lib\site-packages\pm4py\objects\log\exporter\xes\__init__.py", line 17, in <module>
    from pm4py.objects.log.exporter.xes import exporter, variants, util
  File "C:\Users\johan\source\repos\miner\venvwin\lib\site-packages\pm4py\objects\log\exporter\xes\exporter.py", line 20, in <module>
    from pm4py.objects.log.exporter.xes.variants import etree_xes_exp, line_by_line
  File "C:\Users\johan\source\repos\miner\venvwin\lib\site-packages\pm4py\objects\log\exporter\xes\variants\__init__.py", line 17, in <module>
    from pm4py.objects.log.exporter.xes.variants import etree_xes_exp, line_by_line
  File "C:\Users\johan\source\repos\miner\venvwin\lib\site-packages\pm4py\objects\log\exporter\xes\variants\etree_xes_exp.py", line 30, in <module>
    from pm4py.objects.log.util import xes as xes_util
  File "C:\Users\johan\source\repos\miner\venvwin\lib\site-packages\pm4py\objects\log\util\__init__.py", line 17, in <module>
    from pm4py.objects.log.util import insert_classifier, log, sampling, \
  File "C:\Users\johan\source\repos\miner\venvwin\lib\site-packages\pm4py\objects\log\util\filtering_utils.py", line 17, in <module>
    from pm4py.statistics.variants.log import get as variants_module
  File "C:\Users\johan\source\repos\miner\venvwin\lib\site-packages\pm4py\statistics\__init__.py", line 17, in <module>
    from pm4py.statistics import traces, attributes, variants, start_activities, end_activities, util, \
  File "C:\Users\johan\source\repos\miner\venvwin\lib\site-packages\pm4py\statistics\concurrent_activities\__init__.py", line 21, in <module>
    from pm4py.statistics.concurrent_activities import pandas
  File "C:\Users\johan\source\repos\miner\venvwin\lib\site-packages\pm4py\statistics\concurrent_activities\pandas\__init__.py", line 17, in <module>
    from pm4py.statistics.concurrent_activities.pandas import get
  File "C:\Users\johan\source\repos\miner\venvwin\lib\site-packages\pm4py\statistics\concurrent_activities\pandas\get.py", line 19, in <module>
    from pm4py.algo.discovery.dfg.adapters.pandas.df_statistics import get_concurrent_events_dataframe
  File "C:\Users\johan\source\repos\miner\venvwin\lib\site-packages\pm4py\algo\__init__.py", line 22, in <module>
    from pm4py.algo import decision_mining
  File "C:\Users\johan\source\repos\miner\venvwin\lib\site-packages\pm4py\algo\decision_mining\__init__.py", line 17, in <module>
    from pm4py.algo.decision_mining import algorithm
  File "C:\Users\johan\source\repos\miner\venvwin\lib\site-packages\pm4py\algo\decision_mining\algorithm.py", line 33, in <module>
    from pm4py.visualization.decisiontree.util import dt_to_string
  File "C:\Users\johan\source\repos\miner\venvwin\lib\site-packages\pm4py\visualization\__init__.py", line 21, in <module>
    from pm4py.visualization import common, dfg, petri_net, process_tree, transition_system, align_table, \
  File "C:\Users\johan\source\repos\miner\venvwin\lib\site-packages\pm4py\visualization\common\__init__.py", line 17, in <module>
    from pm4py.visualization.common import save, utils, gview, visualizer
  File "C:\Users\johan\source\repos\miner\venvwin\lib\site-packages\pm4py\visualization\common\gview.py", line 21, in <module>
    from graphviz.dot import Digraph
ImportError: cannot import name 'Digraph' from 'graphviz.dot' (C:\Users\johan\source\repos\miner\venvwin\lib\site-packages\graphviz\dot.py)

It happens both on Ubuntu 20, and Windows 10, both in Python 3.8 and 3.9. Graphviz is installed on both machines.
I've written the code on another Ubuntu machine and there it works just fine, but trying to run it on a fresh Ubuntu installation or Windows 10, I get this.

Removing the import of format_dataframe which it complains about in the top doesn't change the error, but shows the next line where I import a pm4py package.

I can't find anything about this specific error anywhere, so I'm really running out of options to run my program anywhere.

@johannesmols
Copy link
Author

It turns out that running pip install -U pm4py solves the problem. Those are also the instructions on PyPI, but I was trying to install it from a requirements.txt file.

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

No branches or pull requests

1 participant