ITADN

Unable to compile: could not find `tensor` in `ort`

#63ClosedRaj2032 创建于 2026-01-18
dependenciesfixedquestion
R
Raj2032commented
### Search before asking - [x] I have searched the Ultralytics [issues](https://github.com/ultralytics/PROJECT_NAME/issues) and [discussions](https://github.com/orgs/ultralytics/discussions) and found no similar questions. ### Question This is my `Cargo.toml` file: ```toml [dependencies] ultralytics-inference = {git = "https://github.com/ultralytics/inference.git"} ``` And this is my code inside `main.rs`: ```rs use ultralytics_inference::{YOLOModel, InferenceConfig}; fn main() { // Load your custom NCNN model (auto-detects format) let mut model = YOLOModel::load("custom_ncnn_model/").unwrap(); // Configure exactly like Python predict params let mut config = InferenceConfig::default(); config.conf = 0.6; // Confidence threshold config.show = true; // Real-time display window config.line_thickness = 2; // Box line thickness config.save = false; // No output saving config.stream = true; // Process video frame-by-frame // Run prediction (handles video streaming + visualization automatically) model.predict_config("video.mp4", config); } ``` When I ran `cargo r` I get this error (eventually): ```cmd | 16 | use ort::tensor::TensorElementType; | ^^^^^^ could not find `tensor` in `ort` For more information about this error, try `rustc --explain E0432`. error: could not compile `ultralytics-inference` (lib) due to 1 previous error ``` I am using (Arch) Linux and here is my rust version: ```cmd rustup 1.28.2 (e4f3ad6f8 2025-04-28) info: This is the version for the rustup toolchain manager, not the rustc compiler. info: The currently active `rustc` version is `rustc 1.92.0 (ded5c06cf 2025-12-08)` ``` ### Additional _No response_
关闭于 2026-01-18 5 条评论