pykeio / ort

Fast ML inference & training for Rust with ONNX Runtime
https://ort.pyke.io/
Apache License 2.0
786 stars 91 forks source link

The requested API version [18] is not available, only API versions [1, 16] are supported in this build. #229

Closed Anush008 closed 2 months ago

Anush008 commented 2 months ago

Hey.

I was happily using ort to build https://github.com/Anush008/bm42-rs. Now, I am getting the following failures.

   Compiling ort v2.0.0-rc.3
   Compiling bm42 v0.0.0-alpha-rc.1 (/Users/anush/Desktop/bm42-rs)
    Finished dev [unoptimized + debuginfo] target(s) in 2.32s
     Running `target/debug/bm42 main.rs`
The requested API version [18] is not available, only API versions [1, 16] are supported in this build. Current ORT Version is: 1.16.3
thread 'main' panicked at /Users/anush/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ort-2.0.0-rc.3/src/lib.rs:214:25:
assertion failed: !api.is_null()
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
decahedron1 commented 2 months ago

What operating system are you using? Were you using a previous version of ort before upgrading to 2.0.0-rc.3?

Anush008 commented 2 months ago

MacOS Silicon. I was on 2.0.0-rc.2 a few hours ago.

decahedron1 commented 2 months ago

Do you have pkg-config installed? rc3 just added support for pkg-config, it could be picking up an older version if you have that configured. Check if pkg-config --modversion libonnxruntime is returning 1.16.3.

Anush008 commented 2 months ago

Check if pkg-config --modversion libonnxruntime is returning 1.16.3.

Yes. Thanks, Carson. To double-check, I ran tests on https://github.com/Anush008/bm42-rs's CI. They're working fine. It was my machine. Thanks again.

Anush008 commented 2 months ago

Also FYI @decahedron1, I've built https://github.com/Anush008/bm42-js, that uses NAPI-rs bindings.

Successfully builds for the following platforms

https://github.com/Anush008/bm42-js?tab=readme-ov-file#platform-support

Thanks a lot for ort.

altunenes commented 1 month ago

This error appeared to me too. OS: Windows. I installed the onnx via pip.

I solved the issue with the following (inspired by the comment about pkg-config ):

set ORT_STRATEGY=system
set ORT_LIB_LOCATION=C:\Python311\Lib\site-packages\onnxruntime\capi