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

Assert Failed when Initializing Environment #119

Open
Rorical opened this issue Mar 7, 2023 · 1 comment
Open

Assert Failed when Initializing Environment #119

Rorical opened this issue Mar 7, 2023 · 1 comment

Comments

@Rorical
Copy link

Rorical commented Mar 7, 2023

I've tested it successfully on my computer but after I moved it to another machine with WinServer 2022 I got the following error.

DEBUG: onnxruntime::environment: Environment not yet initialized, creating a new one.
thread 'main' panicked at 'assertion failed: `(left != right)`
  left: `0x0`,
 right: `0x0`', C:\Users\Administrator\.cargo\registry\src\github.com-1ecc6299db9ec823\onnxruntime-0.0.14\src\lib.rs:180:5
stack backtrace:
   0: std::panicking::begin_panic_handler
             at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library\std\src\panicking.rs:575
   1: core::panicking::panic_fmt
             at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library\core\src\panicking.rs:64
   2: core::fmt::Arguments::new_v1
             at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library\core\src\fmt\mod.rs:398
   3: core::panicking::assert_failed_inner
             at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library\core\src\panicking.rs:245
   4: core::panicking::assert_failed<ptr_mut$<onnxruntime_sys::OrtApi>,ptr_mut$<onnxruntime_sys::OrtApi> >
             at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483\library\core\src\panicking.rs:199
   5: onnxruntime::g_ort
             at C:\Users\Administrator\.cargo\registry\src\github.com-1ecc6299db9ec823\onnxruntime-0.0.14\src\lib.rs:180
   6: onnxruntime::environment::Environment::new
             at C:\Users\Administrator\.cargo\registry\src\github.com-1ecc6299db9ec823\onnxruntime-0.0.14\src\environment.rs:105
   7: onnxruntime::environment::EnvBuilder::build
             at C:\Users\Administrator\.cargo\registry\src\github.com-1ecc6299db9ec823\onnxruntime-0.0.14\src\environment.rs:234

which indicates that this assert failed:

fn g_ort() -> sys::OrtApi {
    let mut api_ref = G_ORT_API
        .lock()
        .expect("Failed to acquire lock: another thread panicked?");
    let api_ref_mut: &mut *mut sys::OrtApi = api_ref.get_mut();
    let api_ptr_mut: *mut sys::OrtApi = *api_ref_mut;

    assert_ne!(api_ptr_mut, std::ptr::null_mut());

    unsafe { *api_ptr_mut }
}

I have no experience with the onnx runtime lib so I was wondering if is that system related or if some dependencies are missing. Any help is appreciated.

@Rorical
Copy link
Author

Rorical commented May 10, 2023

I just noticed that this project is unmaintained and switched to ORT, which is based on this project. The README says that the program will depend on the default windows onnx runtime in the system32 folder, and this may vary on different devices. So the best way is to include onnx runtime lib in distribution.

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