Comments (8)
Very likely. Please see the solution above. You can use Visual Studio debugger to confirm that.
First please install the latest Visual Studio C++ Runtime from https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist?view=msvc-170#latest-microsoft-visual-c-redistributable-version
Then, if you use conda, please also run
conda install conda-forge::vs2015_runtime
from onnxruntime.
Likely it is because recently you upgrade your Visual Studio to 17.10.
Please tell us if you were using conda. If yes, you need to check if you have installed the "vs2015_runtime" package. If still yes, you need to use the following command to get a newer version from conda-forge.
conda install conda-forge::vs2015_runtime
CPython(from python.org) does not have this issue.
You also need to install the latest VC++ runtime from https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist?view=msvc-170. The latest version was released a few weeks ago. If you didn't reinstall it recently, please do so.
from onnxruntime.
If a C/C++ program was built by Visual Studio version X, then at runtime it will require VC++ Runtime version >=X, otherwise it may result undefined behavior. Recently Visual Studio introduced an ABI change for std::mutex in the latest 17.10 release, therefore if you run the new binary with old VC runtime it will crash.
VC runtime is a collection of DLLs. Mainly, it has three pieces:
- Universal CRT, which is a part of Windows 10. Before that, users need to manually install it. It is no longer a concern because most Windows users have upgraded to Windows 10 or 11.
- vcruntime[version].dll, which is the basic Runtime Library for C native code.
- msvcp[version].dll, which is the C++ Standard Library for C++ native code.
In order to get a simple C++ hello world program to run, you need all the three pieces. A C program only needs the top two. For example, python.exe itself is written in C. It doesn't contain any C++ code. So, in order to run python.exe, you need the Universal CRT and vcruntime[version].dll. So, if you open the folder where your python.exe lives, you will find a "vcruntime140.dll" there. The DLL was installed there when installing the python. The DLL is certainly old. Even if you have installed the latest VC Runtime, the old DLL will still get used since it has higher preference(because it is in the same dir as the executable: python.exe). However, it won't cause issue here. You will not find a msvcp140.dll there, since python.exe doesn't depend on that. And the C++ std::mutex change we are talking about is in msvcp140.dll, which is not part of python.
However, if your python is Conda and the python version is bigger than 3.8, I believe you will find msvcp140.dll in your conda's installation dir. I think it is brought by the "vs2015_runtime" package. And you can update the package by running:
conda install conda-forge::vs2015_runtime
Not only python, JDKs usually also have this problem.
from onnxruntime.
To verify if the error("A dynamic link library (DLL) initialization routine failed.") you saw was caused by VC runtime version mismatch, you should check which msvcp140.dll was loaded. As you already have Visual Studio, you can get the information by debugging it there. In Visual Studio, you can open python.exe as a project.
Then right click the project, setup properties.
In the new Windows you can should set "arguments" to the full path of your python script , which should be as simple as just one line: "import onnxruntime".
Then you press "F5" to debug it.
In the debug windows you should be able to see the full path of msvcp140.dll . The log should contain things like:
'python.exe' (Win32): Loaded 'C:\hostedtoolcache\windows\Python\3.12.4\x64\Lib\site-packages\onnxruntime\capi\onnxruntime_pybind11_state.pyd'.
'python.exe' (Win32): Loaded 'C:\Windows\System32\msvcp140.dll'.
Then you find the DLL in File Explorer. Right click it, check its properties.
If the version number begins with 14.40, it's good. Otherwise, delete the DLL if it is not in system32 folder.
from onnxruntime.
Thank you for the detailed comments.
-
Yes, I was using conda. I have updated the "vs2015_runtime" package.
-
It seems like I have the latest release of vc++. I tried to re-install it and this is what I get :
-
I checked the msvcp140.dll file and seems like I have the correct one.
I ran the build again and this time it didn't give me the error as it did before. It says 'build complete' but I still don't see the wheel file. What am I missing?
from onnxruntime.
You need to add one more "\RelWithDebInfo" in the path. Like D:\onnxruntime\build\Windows\RelWithDebInfo\RelWithDebInfo\dist
from onnxruntime.
Found the wheel file, thank you.
from onnxruntime.
ningDeprecationWarning: pytorch_lightning.utilities.distributed.rank_zero_only
has been deprecated in v1.8.1 and will be removed in v2.0.0. You can import it from pytorch_lightning.utilities
instead.
rank_zero_deprecation(
Launching Web UI with arguments: --use-zluda --update-check --skip-ort --disable-safe-unpickle
Traceback (most recent call last):
File "D:\yapay zeka\stable-diffusion-webui-amdgpu\launch.py", line 48, in
main()
File "D:\yapay zeka\stable-diffusion-webui-amdgpu\launch.py", line 44, in main
start()
File "D:\yapay zeka\stable-diffusion-webui-amdgpu\modules\launch_utils.py", line 689, in start
import webui
File "D:\yapay zeka\stable-diffusion-webui-amdgpu\webui.py", line 13, in
initialize.imports()
File "D:\yapay zeka\stable-diffusion-webui-amdgpu\modules\initialize.py", line 35, in imports
from modules import shared_init
File "D:\yapay zeka\stable-diffusion-webui-amdgpu\modules\shared_init.py", line 8, in
from modules.zluda import initialize_zluda
File "D:\yapay zeka\stable-diffusion-webui-amdgpu\modules\zluda.py", line 6, in
import onnxruntime as ort
File "D:\yapay zeka\stable-diffusion-webui-amdgpu\venv\lib\site-packages\onnxruntime_init_.py", line 57, in
raise import_capi_exception
File "D:\yapay zeka\stable-diffusion-webui-amdgpu\venv\lib\site-packages\onnxruntime_init_.py", line 23, in
from onnxruntime.capi._pybind_state import ExecutionMode # noqa: F401
File "D:\yapay zeka\stable-diffusion-webui-amdgpu\venv\lib\site-packages\onnxruntime\capi_pybind_state.py", line 32, in
from .onnxruntime_pybind11_state import * # noqa
ImportError: DLL load failed while importing onnxruntime_pybind11_state: A dynamic link library (DLL) initialization routine failed.
is it same on me? what do i have to do?
from onnxruntime.
Related Issues (20)
- [Build]: cmake', '--build', '/temp/liz/onnxruntime/build/Linux/RelWithDebInfo', '--config', 'RelWithDebInfo', '--', '-j64'] HOT 1
- [Feature Request] Request grid_sample 5D support 🌟 HOT 1
- [Build][Bug] The compiler doesn't support BFLOAT16!!! HOT 2
- [WebGPU] `Error: [WebGPU] Kernel "[MaxPool] /sincnet/pool1d.0/MaxPool" failed. Error: length of specified kernel shapes should be 2 less than length of input dimensions` HOT 2
- Error Instantiating EmbeddingModel with ONNX Model intfloat/multilingual-e5-large HOT 1
- [Documentation] Community blog post contribution HOT 1
- [ARM][CPU] Unit test and onnx_runtime_perf test gives cpuinfo error for new Windows ARM chips HOT 2
- [Feature Request] Mark as negative tests for minimal CUDA build
- New restricted asymmetric quantization mode in QDQ mode with zero_point restricted to either 128 or 0
- Trilu op still not work with INT32 input HOT 2
- [WebNN EP] Support int64 output data type for CoreML backend HOT 1
- [Web] where is the demo of object detection on web HOT 2
- LNK2019: unresolved external symbol OrtGetApiBase HOT 1
- Multi-threaded GPU inferencing failing with whisper-small: Non-zero status code returned while running DecoderMaskedMultiHeadAttention node HOT 4
- TensorRT EP failed to create engine from network. HOT 3
- Custom Op Library does not work for CUDA
- onnxruntime.InferenceSession.run sometimes get stuck, sometimes not HOT 3
- How to do multithreaded infer with onnxruntime
- CUDA provider fallback to CPU is not working when CUDA_PATH environment variable exists
- using TensorRT EP by nuget
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from onnxruntime.