intel / openvino-rs

Rust bindings for OpenVINO™
Apache License 2.0
84 stars 24 forks source link

Tricks or advice on finding the OpenVINO install? #77

Closed David-OConnor closed 1 year ago

David-OConnor commented 1 year ago

Error:

Unable to find an OpenVINO installation on your system; build with runtime linking using `--features runtime-linking` or build from source with `OPENVINO_BUILD_DIR`.

Currently running with dynamic linking disabled in Cargo.toml. Windows 11. Have OpenVINO installed with PYPI, and it works on the Python version. Installed the standalone using the ARCHIVES distribution (Which distribution to choose was a bit confusing, but this seemed like a good bet given it supports all the hardware targets), unpacked to C:\Program Files (x86)\Intel\openvino_2023\. I've configured OPENVINO_INSTALL_DIR and OPENVINO_BUILD_DIR to C:\Program Files (x86)\Intel\openvino_2023\runtime\bin\intel64\Release. Is this right? Have been running setupvars.bat each terminal window. Any ideas? Thank you!

abrown commented 1 year ago

I believe that you will want OPENVINO_INSTALL_DIR to be set to C:\Program Files (x86)\Intel\openvino_2023, the top-level directory. And you will probably want to build with the equivalent of --features runtime-linking, IIRC. The openvino-finder crate should be able to find the *.dll then:

https://github.com/intel/openvino-rs/blob/536280acf0c1fe9acf0070607802b54013949220/crates/openvino-finder/src/lib.rs#L32

That file also logs all the paths it checks if you want to troubleshoot what paths have been tried, etc.

David-OConnor commented 1 year ago

Thank you. Unfortunately, it looks like it's still giving the same message. Latest config doing it is as follows:

Error is as above.

How do I check the logs? I didn't see any generated file or printed text to console.

abrown commented 1 year ago

Ah, interesting. Well, here's some thoughts:

David-OConnor commented 1 year ago

Could be it; I appreciate it. Not sure if this error is before or after the previous one, but am now getting this, using the Git dependency:

error: failed to get `openvino` as a dependency of package `face v0.1.0 (C:\Users\david\strike\face2)`

Caused by:
  failed to load source for dependency `openvino`

Caused by:
  Unable to update https://github.com/intel/openvino-rs

Caused by:
  failed to update submodule `crates/upstream`

Caused by:
  failed to update submodule `tools/pot/thirdparty/open_model_zoo`

Caused by:
  path too long: 'C:/Users/david/.cargo/git/checkouts/openvino-rs-c4e388d557d9d335/536280a/crates/openvino-sys/upstream/thirdparty/open_model_zoo/models/intel/formula-recognition-polynomials-handwritten-0001/formula-recognition-polynomials-handwritten-0001-decoder/.gitattributes'; class=Filesystem (30)
PS C:\Users\david\face2>
abrown commented 1 year ago

Windows path lengths... that is annoying. You could try to retrieve the Git repository elsewhere and refer to it with path in your Cargo.toml? For reference, only the top-level upstream submodule is necessary; the child submodules of that repository are not and are just being recursively retrieved by some Cargo default.

David-OConnor commented 1 year ago

Very puzzling, and thank you again. Of note: It compiled using your approach of git clone + path dependency. (No more name length error). But... No env logger errors, and same error message as before. Was worth a shot!

abrown commented 1 year ago

Is the code you're running available somewhere for me to attempt to reproduce? If you send me a GitHub repository and the command that you see the failure on I will try it out. I don't tend to see many issues on Linux, so I'm interested in troubleshooting some of these other platforms (Windows, MacOS).

David-OConnor commented 1 year ago

Appreciate it - Repo with the latest from this discussion: https://github.com/David-OConnor/openvino_rust_test

abrown commented 1 year ago

Ok, I am not able to reproduce this... I did the following:

  1. Downloaded the latest version as an archive to my machine, e.g., from here.
  2. Set things up in a CLI environment:

    C:\...> set OPENVINO_INSTALL_DIR=C:\...\w_openvino_toolkit_windows_2023.1.0.12185.47b736f63ed_x86_64
    C:\...> C:\...\w_openvino_toolkit_windows_2023.1.0.12185.47b736f63ed_x86_64\setupvars.bat
    Warning: Python is not installed. Please install one of Python 3.7 - 3.11 (64-bit) from https://www.python.org/downloads/
    [setupvars.bat] OpenVINO environment initialized
  3. Ran your example successfully:

    C:\...\openvino_rust_test>cargo run
    ...
    warning: unused variable: `core`
    --> src\main.rs:10:9
       |
    10 |     let core = openvino::Core::new(None).expect("to instantiate the OpenVINO library");
       |         ^^^^ help: if this is intentional, prefix it with an underscore: `_core`
       |
       = note: `#[warn(unused_variables)]` on by default
    
    warning: `face` (bin "face") generated 1 warning (run `cargo fix --bin "face"` to apply 1 suggestion)
       Finished dev [unoptimized + debuginfo] target(s) in 16.01s
       Running `target\debug\face.exe`
    OV version: 2023.1.0-12185-9e6b00e51cd-releases/2023/1

Perhaps the missing piece is calling the setupvars.bat script to set up the path for Windows to find the dependent libraries?

David-OConnor commented 1 year ago

Thank you for the help! I appreciate you trying it; helps narrow it down. Of note, that archive you posted is the exact one I'm using.

David-OConnor commented 1 year ago

OK, I think you're onto something with the setupvars.bat. It works if I use the old school cmd prompt, but not if I use powershell...

abrown commented 1 year ago

OK, I think you're onto something with the setupvars.bat. It works if I use the old school cmd prompt, but not if I use powershell...

Ah, weird that you mention that: I vaguely recall running into something like that while working on https://github.com/abrown/install-openvino-action. If PowerShell is something you use frequently maybe opening an issue on the https://github.com/openvinotoolkit/openvino could resolve that?

David-OConnor commented 1 year ago

Thank you! Will open an issue there, since it doesn't seem to be something fixable here. I appreciate it.

Of note in particular: https://github.com/openvinotoolkit/openvino/issues/7475, from 2021