Closed fmannhardt closed 4 years ago
Dear Felix,
My suggestions are like in #131 (seems something is wrong in your installation)
The running-example is among the standard tests that we do before the release, so it's really strange that you find a problem right there
If I execute the script:
from pm4py.objects.log.importer.xes import factory as xes_importer from pm4py.algo.discovery.inductive import factory as inductive_miner from pm4py.algo.conformance.alignments import factory as align_factory from pm4py.util.lp import factory import pulp
log = xes_importer.apply("C:/running-example.xes") net, im, fm = inductive_miner.apply(log) aligned_traces = align_factory.apply(log, net, im, fm) print(aligned_traces) print(factory.DEFAULT_LP_SOLVER_VARIANT) print(pulp.version)
I get
[{'alignment': [('register request', 'register request'), ('>>', None), ('>>', None), ('examine casually', 'examine casually'), ('check ticket', 'check ticket'), ('>>', None), ('decide', 'decide'), ('reinitiate request', 'reinitiate request'), ('>>', None), ('>>', None), ('examine thoroughly', 'examine thoroughly'), ('check ticket', 'check ticket'), ('>>', None), ('decide', 'decide'), ('>>', None), ('pay compensation', 'pay compensation')], 'cost': 7, 'visited_states': 17, 'queued_states': 51, 'traversed_arcs': 51, 'fitness': 1}, {'alignment': [('register request', 'register request'), ('>>', None), ('>>', None), ('check ticket', 'check ticket'), ('examine casually', 'examine casually'), ('>>', None), ('decide', 'decide'), ('>>', None), ('pay compensation', 'pay compensation')], 'cost': 4, 'visited_states': 9, 'queued_states': 28, 'traversed_arcs': 28, 'fitness': 1}, {'alignment': [('register request', 'register request'), ('>>', None), ('>>', None), ('examine thoroughly', 'examine thoroughly'), ('check ticket', 'check ticket'), ('>>', None), ('decide', 'decide'), ('>>', None), ('reject request', 'reject request')], 'cost': 4, 'visited_states': 9, 'queued_states': 27, 'traversed_arcs': 27, 'fitness': 1}, {'alignment': [('register request', 'register request'), ('>>', None), ('>>', None), ('examine casually', 'examine casually'), ('check ticket', 'check ticket'), ('>>', None), ('decide', 'decide'), ('>>', None), ('pay compensation', 'pay compensation')], 'cost': 4, 'visited_states': 9, 'queued_states': 27, 'traversed_arcs': 27, 'fitness': 1}, {'alignment': [('register request', 'register request'), ('>>', None), ('>>', None), ('examine casually', 'examine casually'), ('check ticket', 'check ticket'), ('>>', None), ('decide', 'decide'), ('reinitiate request', 'reinitiate request'), ('>>', None), ('>>', None), ('check ticket', 'check ticket'), ('examine casually', 'examine casually'), ('>>', None), ('decide', 'decide'), ('reinitiate request', 'reinitiate request'), ('>>', None), ('>>', None), ('examine casually', 'examine casually'), ('check ticket', 'check ticket'), ('>>', None), ('decide', 'decide'), ('>>', None), ('reject request', 'reject request')], 'cost': 10, 'visited_states': 25, 'queued_states': 76, 'traversed_arcs': 76, 'fitness': 1}, {'alignment': [('register request', 'register request'), ('>>', None), ('>>', None), ('check ticket', 'check ticket'), ('examine thoroughly', 'examine thoroughly'), ('>>', None), ('decide', 'decide'), ('>>', None), ('reject request', 'reject request')], 'cost': 4, 'visited_states': 9, 'queued_states': 28, 'traversed_arcs': 28, 'fitness': 1}] pulp 2.0
I understand that it may be a dependency issue. However, I think it is quite bad and confusing that it gives a wrong answer in this case instead of crashing or something like this.
I was updating the R port of PM4Py, so I installed PM4Py newly using pip in a miniconda environment as per directions. I also just re-installed it again in a fresh environment to see if there was something installed that cause this. However, the same error occurs. Here the output of the same commands you run:
> reticulate::repl_python()
Python 3.6.9 (C:/Users/felixm/AppData/Local/Continuum/miniconda3/envs/pm4py/python.exe)
Reticulate 1.14 REPL -- A Python interpreter in R.
>>> from pm4py.objects.log.importer.xes import factory as xes_importer
>>> from pm4py.algo.discovery.inductive import factory as inductive_miner
>>> from pm4py.algo.conformance.alignments import factory as align_factory
>>> from pm4py.util.lp import factory
>>> import pulp
>>>
>>> log = xes_importer.apply("C:/running-example.xes")
>>> net, im, fm = inductive_miner.apply(log)
>>> aligned_traces = align_factory.apply(log, net, im, fm)
Exception: trying to apply alignments on a Petri net that is not a relaxed sound workflow net!!
>>> print(aligned_traces)
NameError: name 'aligned_traces' is not defined
>>> print(factory.DEFAULT_LP_SOLVER_VARIANT)
pulp
>>> print(pulp.version)
AttributeError: module 'pulp' has no attribute 'version'
I also downgraded to Python 3.6.9 to see if this changes anything. Ignore the reticulate
part, this is just since I am running the Python session from R. It seems to have issues with pulp.version
; however pulp.VERSION
works and outputs 2.0
Here you get my full environment details:
(pm4py) PS C:\Users\felixm> pip list
Package Version
---------------- -------------------
backcall 0.1.0
certifi 2019.11.28
ciso8601 2.1.2
colorama 0.4.3
cycler 0.10.0
decorator 4.4.1
graphviz 0.13.2
intervaltree 3.0.2
ipython 7.10.2
ipython-genutils 0.2.0
jedi 0.15.1
Jinja2 2.10.3
joblib 0.14.1
kiwisolver 1.1.0
lxml 4.4.2
MarkupSafe 1.1.1
matplotlib 3.1.2
networkx 2.4
numpy 1.17.4
pandas 0.25.3
parso 0.5.2
pickleshare 0.7.5
pip 19.3.1
pm4py 1.2.6
prompt-toolkit 3.0.2
PuLP 2.0
pydotplus 2.0.2
Pygments 2.5.2
pyparsing 2.4.5
python-dateutil 2.8.1
pytz 2019.3
pyvis 0.1.7.0
scikit-learn 0.22
scipy 1.4.0
setuptools 42.0.2.post20191203
six 1.13.0
sklearn 0.0
sortedcontainers 2.1.0
traitlets 4.3.3
wcwidth 0.1.7
wheel 0.33.6
wincertstore 0.2
(pm4py) PS C:\Users\felixm> conda list
# packages in environment at C:\Users\felixm\AppData\Local\Continuum\miniconda3\envs\pm4py:
#
# Name Version Build Channel
backcall 0.1.0 pypi_0 pypi
ca-certificates 2019.11.27 0
certifi 2019.11.28 py36_0
ciso8601 2.1.2 pypi_0 pypi
colorama 0.4.3 pypi_0 pypi
cycler 0.10.0 pypi_0 pypi
decorator 4.4.1 pypi_0 pypi
intervaltree 3.0.2 pypi_0 pypi
ipython 7.10.2 pypi_0 pypi
ipython-genutils 0.2.0 pypi_0 pypi
jedi 0.15.1 pypi_0 pypi
jinja2 2.10.3 pypi_0 pypi
joblib 0.14.1 pypi_0 pypi
kiwisolver 1.1.0 pypi_0 pypi
lxml 4.4.2 pypi_0 pypi
markupsafe 1.1.1 pypi_0 pypi
matplotlib 3.1.2 pypi_0 pypi
networkx 2.4 pypi_0 pypi
numpy 1.17.4 pypi_0 pypi
openssl 1.1.1d he774522_3
pandas 0.25.3 pypi_0 pypi
parso 0.5.2 pypi_0 pypi
pickleshare 0.7.5 pypi_0 pypi
pip 19.3.1 py36_0
pm4py 1.2.6 pypi_0 pypi
prompt-toolkit 3.0.2 pypi_0 pypi
pulp 2.0 pypi_0 pypi
pydotplus 2.0.2 pypi_0 pypi
pygments 2.5.2 pypi_0 pypi
pyparsing 2.4.5 pypi_0 pypi
python 3.6.9 h5500b2f_0
python-dateutil 2.8.1 pypi_0 pypi
python-graphviz 0.13.2 pypi_0 pypi
pytz 2019.3 pypi_0 pypi
pyvis 0.1.7.0 pypi_0 pypi
scikit-learn 0.22 pypi_0 pypi
scipy 1.4.0 pypi_0 pypi
setuptools 42.0.2 py36_0
six 1.13.0 pypi_0 pypi
sklearn 0.0 pypi_0 pypi
sortedcontainers 2.1.0 pypi_0 pypi
sqlite 3.30.1 he774522_0
traitlets 4.3.3 pypi_0 pypi
vc 14.1 h0510ff6_4
vs2015_runtime 14.16.27012 hf0eaf9b_1
wcwidth 0.1.7 pypi_0 pypi
wheel 0.33.6 py36_0
wincertstore 0.2 py36h7fe50ca_0
I just tried out the downgrade to:
pip install pulp==1.6.10
that changes nothing both for this bug as well as for https://github.com/pm4py/pm4py-source/issues/131
Understood
I am trying to install Anaconda 3.7 in my workstation (I am testing with vanilla 3.7 and 3.8 right now) just to be able to recreate your problem
Tried your last suggestion:
pip install -U ortools
which solves this issue and also https://github.com/pm4py/pm4py-source/issues/131
Would it be possible to add this to the dependencies, so that it gets installed automatically?
It should be installed automatically
Unfortunately the following requirement instruction does NOT do what is expected to do: ortools; python_version < '3.8' and sys_platform != 'win32'
('win32' seemingly includes both Windows at 32 and 64 bit)
With next hotfix, ortools will probably get in again, however I must admit I am not able to replicate your initial problem with PuLP in Anaconda. That remains a mistery for me
c:\Users\berti\Anaconda3\python.exe test1.py [{'alignment': [('register request', 'register request'), ('>>', None), ('>>', None), ('examine casually', 'examine casually'), ('check ticket', 'check ticket'), ('>>', None), ('decide', 'decide'), ('reinitiate request', 'reinitiate request'), ('>>', None), ('>>', None), ('examine thoroughly', 'examine thoroughly'), ('check ticket', 'check ticket'), ('>>', None), ('decide', 'decide'), ('>>', None), ('pay compensation', 'pay compensation')], 'cost': 7, 'visited_states': 16, 'queued_states': 48, 'traversed_arcs': 48, 'fitness': 1}, {'alignment': [('register request', 'register request'), ('>>', None), ('>>', None), ('check ticket', 'check ticket'), ('examine casually', 'examine casually'), ('>>', None), ('decide', 'decide'), ('>>', None), ('pay compensation', 'pay compensation')], 'cost': 4, 'visited_states': 9, 'queued_states': 28, 'traversed_arcs': 28, 'fitness': 1}, {'alignment': [('register request', 'register request'), ('>>', None), ('>>', None), ('examine thoroughly', 'examine thoroughly'), ('check ticket', 'check ticket'), ('>>', None), ('decide', 'decide'), ('>>', None), ('reject request', 'reject request')], 'cost': 4, 'visited_states': 9, 'queued_states': 27, 'traversed_arcs': 27, 'fitness': 1}, {'alignment': [('register request', 'register request'), ('>>', None), ('>>', None), ('examine casually', 'examine casually'), ('check ticket', 'check ticket'), ('>>', None), ('decide', 'decide'), ('>>', None), ('pay compensation', 'pay compensation')], 'cost': 4, 'visited_states': 9, 'queued_states': 27, 'traversed_arcs': 27, 'fitness': 1}, {'alignment': [('register request', 'register request'), ('>>', None), ('>>', None), ('examine casually', 'examine casually'), ('check ticket', 'check ticket'), ('>>', None), ('decide', 'decide'), ('reinitiate request', 'reinitiate request'), ('>>', None), ('>>', None), ('check ticket', 'check ticket'), ('examine casually', 'examine casually'), ('>>', None), ('decide', 'decide'), ('reinitiate request', 'reinitiate request'), ('>>', None), ('>>', None), ('examine casually', 'examine casually'), ('check ticket', 'check ticket'), ('>>', None), ('decide', 'decide'), ('>>', None), ('reject request', 'reject request')], 'cost': 10, 'visited_states': 25, 'queued_states': 76, 'traversed_arcs': 76, 'fitness': 1}, {'alignment': [('register request', 'register request'), ('>>', None), ('>>', None), ('check ticket', 'check ticket'), ('examine thoroughly', 'examine thoroughly'), ('>>', None), ('decide', 'decide'), ('>>', None), ('reject request', 'reject request')], 'cost': 4, 'visited_states': 9, 'queued_states': 28, 'traversed_arcs': 28, 'fitness': 1}] pulp 2.0
c:\Users\berti\Anaconda3\python.exe Python 3.7.4 (default, Aug 9 2019, 18:34:13) [MSC v.1915 64 bit (AMD64)] :: Anaconda, Inc. on win32
Warning: This Python interpreter is in a conda environment, but the environment has not been activated. Libraries may fail to load. To activate this environment please see https://conda.io/activation
Type "help", "copyright", "credits" or "license" for more information.
import pm4py pm4py.version '1.2.7'
Version: PM4Py 1.2.6 (release) OS: Windows 10 Python: 3.7.4
Running the example code from the alignment documentation results in the error:
Exception: trying to apply alignments on a Petri net that is not a relaxed sound workflow net!!
Steps to reproduce: