microsoft / onnxruntime

ONNX Runtime: cross-platform, high performance ML inferencing and training accelerator
https://onnxruntime.ai
MIT License
13.96k stars 2.82k forks source link

[Training] ImportError: cannot import name 'PropagateCastOpsStrategy' from 'onnxruntime.capi._pybind_state' #21233

Open srijanie03 opened 1 month ago

srijanie03 commented 1 month ago

Describe the issue

I had onnxruntime.training working correctly on Windows x64. Out of nowhere, I get this error message: image

The build was completed correctly. I have double-checked the msvcp140.dll and "vcruntime140.dll" files. I have updated vs2015_runtime, and have the latest package of vc++ running. What could be causing this sudden issue?

To reproduce

import onnxruntime.training

Urgency

Very urgent

ONNX Runtime Installation

Built from Source

ONNX Runtime Version or Commit ID

1.18.1

PyTorch Version

2.4.0

Execution Provider

Default CPU

Execution Provider Library Version

No response

baijumeswani commented 1 month ago

This typically happens when you have both onnxruntime as well as onnxruntime-training installed in the same env.

To resolve, uninstall all onnxruntime packages

pip uninstall -y onnxruntime onnxruntime-training-cpu

Confirm that you have no onnxruntime packages installed (use pip freeze to check any package with the prefix onnxruntime-).

And then, reinstall only onnxruntime-training-cpu.

srijanie03 commented 1 month ago

Would I need to do a build from the start, or can I use the wheel file generated during the previous build and install onnxruntime-training as I did previously with:

python -m pip install build/Windows/RelWithDebInfo/RelWithDebInfo/dist/onnxruntime_training-1.19.0+cpu-cp312-cp312-win_amd64.whl

srijanie03 commented 1 month ago

It seems to be working, thank you! I just continued with the original build - uninstalled all and installed only onnxruntime-training again.

Any reason why the error popped up all of a sudden? Why was it working okay earlier with both libraries coexisting?

xadupre commented 1 month ago

onnxruntime-training contains everything onnxruntime has but it is released on the smaller set of os and versions.

github-actions[bot] commented 2 weeks ago

This issue has been automatically marked as stale due to inactivity and will be closed in 30 days if no further activity occurs. If further support is needed, please provide an update and/or more details.