microsoft / Templates-For-Dynamics-365-Supply-Chain-Management-Demand-Forecasting-With-Azure-Machine-Learning

Samples, templates and setup guides in order to run demand forecasting in Azure Machine Learning Service and integrate with Dynamics 365 SCM
MIT License
12 stars 16 forks source link

ImportError: cannot import name 'dataprep_stub' from 'azureml.data._dataprep_helper' (/azureml-envs/azureml_f3f7e6c5fb83d94df23933000bf02da3/lib/python3.8/site-packages/azureml/data/_dataprep_helper.py)_ #12

Open mrizzari opened 9 months ago

mrizzari commented 9 months ago

Hello,

A business consultant reported me that the demand forecasting was failing in FO with a message saying that the pipeline run into an error.

After investigating, i found out this in user_logs/std_log.txt :

_Traceback (most recent call last):
  File "run.py", line 17, in <module>
    from azureml.pipeline.core import Pipeline, PipelineData
  File "/azureml-envs/azureml_f3f7e6c5fb83d94df23933000bf02da3/lib/python3.8/site-packages/azureml/pipeline/core/__init__.py", line 24, in <module>
    from .builder import PipelineStep, PipelineData, StepSequence
  File "/azureml-envs/azureml_f3f7e6c5fb83d94df23933000bf02da3/lib/python3.8/site-packages/azureml/pipeline/core/builder.py", line 17, in <module>
    from azureml.pipeline.core.graph import Graph, Node, InputPortBinding, OutputPortBinding, \
  File "/azureml-envs/azureml_f3f7e6c5fb83d94df23933000bf02da3/lib/python3.8/site-packages/azureml/pipeline/core/graph.py", line 36, in <module>
    from azureml.pipeline.core.pipeline_output_dataset import PipelineOutputAbstractDataset
  File "/azureml-envs/azureml_f3f7e6c5fb83d94df23933000bf02da3/lib/python3.8/site-packages/azureml/pipeline/core/pipeline_output_dataset.py", line 18, in <module>
    from azureml.data._dataprep_helper import dataprep_stub, dataprep
ImportError: cannot import name 'dataprep_stub' from 'azureml.data._dataprep_helper' (/azureml-envs/azureml_f3f7e6c5fb83d94df23933000bf02da3/lib/python3.8/site-packages/azureml/data/_dataprep_helper.py)_

To fix the issue, I had to update the "run.py" script in order to force importing the previous version (1.53) of the azureml-pipeline package. Then, I created a new version of the pipeline by executing the "api_trigger.py" and now, it is ok. I guess there is a breaking change in the new version (1.54) of the package ?

Best regards, Mirko

ThierryCornelis commented 9 months ago

@mrizzari I have the same issue. Can You share the change you did in "run.py"?

mrizzari commented 9 months ago

Hello.

On top of the script, i forced the 1.53.0 version for the three azureml packages. I believe it is really only needed for the azureml-pipeline package but since it worked, i did not investigate further.

import os
os.system(f"pip install azureml-core==1.53.0")
os.system(f"pip install azureml-pipeline==1.53.0")
os.system(f"pip install argparse")
os.system(f"pip install azureml-dataset-runtime[fuse,pandas]==1.53.0")
ThierryCornelis commented 9 months ago

Hello.

On top of the script, i forced the 1.53.0 version for the three azureml packages. I believe it is really only needed for the azureml-pipeline package but since it worked, i did not investigate further.

import os
os.system(f"pip install azureml-core==1.53.0")
os.system(f"pip install azureml-pipeline==1.53.0")
os.system(f"pip install argparse")
os.system(f"pip install azureml-dataset-runtime[fuse,pandas]==1.53.0")

Thank you! Came to the same solution just before your reply. :)

abhijelly commented 9 months ago

@mrizzari I also faced this issue recently - thank you sharing the fix!