Closed weiztech closed 2 years ago
How do you compile your example? Make sure you are linking properly against BLAS/LAPACK library using appropriate linfa feature (maybe 'linfa/intel-mkl-static' in your case, may take several minutes).
@relf I have tried run using feautures command cargo run --features linfa/intel-mkl-system
and got below erorr
error[E0532]: expected tuple struct or tuple variant, found function `Ok`
--> .cargo/registry/src/github.com-1ecc6299db9ec823/intel-mkl-tool-0.2.0+mkl2020.1/src/entry.rs:75:16
|
75 | if let Ok(dir) = std::env::var("OUT_DIR") {
| ^^ not a tuple struct or tuple variant
|
help: consider importing one of these items instead
|
1 | use core::result::Result::Ok;
|
1 | use std::result::Result::Ok;
|
error[E0532]: expected tuple struct or tuple variant, found function `Ok`
--> .cargo/registry/src/github.com-1ecc6299db9ec823/intel-mkl-tool-0.2.0+mkl2020.1/src/entry.rs:81:16
|
81 | if let Ok(lib) = pkg_config::Config::new()
| ^^ not a tuple struct or tuple variant
|
help: consider importing one of these items instead
|
1 | use core::result::Result::Ok;
|
1 | use std::result::Result::Ok;
|
error[E0532]: expected tuple struct or tuple variant, found function `Ok`
--> .cargo/registry/src/github.com-1ecc6299db9ec823/intel-mkl-tool-0.2.0+mkl2020.1/src/entry.rs:105:16
|
105 | if let Ok(path) = mkl_root {
| ^^ not a tuple struct or tuple variant
|
help: consider importing one of these items instead
|
1 | use core::result::Result::Ok;
|
1 | use std::result::Result::Ok;
|
error[E0532]: expected tuple struct or tuple variant, found function `Ok`
--> .cargo/registry/src/github.com-1ecc6299db9ec823/intel-mkl-tool-0.2.0+mkl2020.1/src/entry.rs:177:24
|
177 | if let Ok(line) = line {
| ^^ not a tuple struct or tuple variant
|
help: consider importing one of these items instead
|
1 | use core::result::Result::Ok;
|
1 | use std::result::Result::Ok;
|
error[E0308]: `match` arms have incompatible types
--> .cargo/registry/src/github.com-1ecc6299db9ec823/intel-mkl-tool-0.2.0+mkl2020.1/src/config.rs:15:41
|
15 | #[derive(Debug, Clone, Copy, PartialEq, Display)]
| ^^^^^^^
| |
| expected struct `std::fmt::Error`, found struct `anyhow::Error`
| `match` arms have incompatible types
16 | pub enum LinkType {
17 | #[display(fmt = "static")]
| ------- this is found to be of type `std::result::Result<(), std::fmt::Error>`
18 | Static,
19 | #[display(fmt = "dynamic")]
| ------- this is found to be of type `std::result::Result<(), std::fmt::Error>`
|
= note: expected enum `std::result::Result<_, std::fmt::Error>`
found enum `std::result::Result<_, anyhow::Error>`
= note: this error originates in the derive macro `Display` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0308]: `match` arms have incompatible types
--> .cargo/registry/src/github.com-1ecc6299db9ec823/intel-mkl-tool-0.2.0+mkl2020.1/src/config.rs:23:41
|
23 | #[derive(Debug, Clone, Copy, PartialEq, Display)]
| ^^^^^^^
| |
| expected struct `std::fmt::Error`, found struct `anyhow::Error`
| `match` arms have incompatible types
24 | pub enum Interface {
25 | #[display(fmt = "lp64")]
| ------- this is found to be of type `std::result::Result<(), std::fmt::Error>`
26 | LP64,
27 | #[display(fmt = "ilp64")]
| ------- this is found to be of type `std::result::Result<(), std::fmt::Error>`
|
= note: expected enum `std::result::Result<_, std::fmt::Error>`
found enum `std::result::Result<_, anyhow::Error>`
= note: this error originates in the derive macro `Display` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0308]: `match` arms have incompatible types
--> .cargo/registry/src/github.com-1ecc6299db9ec823/intel-mkl-tool-0.2.0+mkl2020.1/src/config.rs:31:41
|
31 | #[derive(Debug, Clone, Copy, PartialEq, Display)]
| ^^^^^^^
| |
| expected struct `std::fmt::Error`, found struct `anyhow::Error`
| `match` arms have incompatible types
32 | pub enum Threading {
33 | #[display(fmt = "iomp")]
| ------- this is found to be of type `std::result::Result<(), std::fmt::Error>`
34 | OpenMP,
35 | #[display(fmt = "seq")]
| ------- this is found to be of type `std::result::Result<(), std::fmt::Error>`
|
= note: expected enum `std::result::Result<_, std::fmt::Error>`
found enum `std::result::Result<_, anyhow::Error>`
= note: this error originates in the derive macro `Display` (in Nightly builds, run with -Z macro-backtrace for more info)
Some errors have detailed explanations: E0308, E0532.
For more information about an error, try `rustc --explain E0308`.
error: could not compile `intel-mkl-tool` due to 7 previous errors
Looks like your build of got broken by the latest release of anyhow
. The issue was fixed by #182 but that change wasn't released. For now you can try using the latest master instead of the release from crates.io. @bytesnake Can we cut a new release? Even if we don't include all the most recent changes we should release at least #182 and #177, since the build fails without those patches.
hmm it's still not work after I used Linfa master
and use anyhow = "1.0.48"
error[E0599]: the method `fit` exists for struct `LinearRegression`, but its trait bounds were not satisfied
--> src/main.rs:35:45
|
35 | let model = LinearRegression::default().fit(&dataset).unwrap();
| ^^^ method cannot be called on `LinearRegression` due to unsatisfied trait bounds
|
::: .cargo/registry/src/github.com-1ecc6299db9ec823/linfa-linear-0.5.0/src/ols.rs:46:1
|
46 | pub struct LinearRegression {
| ---------------------------
| |
| doesn't satisfy `LinearRegression: Fit<_, _, _>`
| doesn't satisfy `LinearRegression: ParamGuard`
|
= note: the following trait bounds were not satisfied:
`LinearRegression: ParamGuard`
which is required by `LinearRegression: Fit<_, _, _>`
= help: items from traits can only be used if the trait is in scope
help: the following trait is implemented but not in scope; perhaps add a `use` for it:
|
1 | use linfa::traits::Fit;
anyway Thanks for let me know 👍, I think to wait for the new release fix for now.
You need to change every linfa
-related dependency to use git paths. Your dependencies should look something like:
linfa-linear = { git = "https://github.com/rust-ml/linfa" }
linfa = { git = "https://github.com/rust-ml/linfa" }
linfa-datasets = { git = "https://github.com/rust-ml/linfa", features = ["diabetes"] }
Followed above code and got anyhow
version error
Updating crates.io index
error: failed to select a version for `anyhow`.
... required by package `linfa v0.5.0 (https://github.com/rust-ml/linfa#2a530612)`
... which satisfies git dependency `linfa` (locked to 0.5.0) of package `linfa-datasets v0.5.0 (https://github.com/rust-ml/linfa#2a530612)`
... which satisfies git dependency `linfa-datasets` (locked to 0.5.0) of package `rust-ds v0.1.0
versions that meet the requirements `<=1.0.48` are: 1.0.48, 1.0.47, 1.0.45, 1.0.44, 1.0.43, 1.0.42, 1.0.41, 1.0.40, 1.0.39, 1.0.38, 1.0.37, 1.0.36, 1.0.35, 1.0.34, 1.0.33, 1.0.32, 1.0.31, 1.0.30, 1.0.29, 1.0.28, 1.0.27, 1.0.26, 1.0.25, 1.0.24, 1.0.23, 1.0.22, 1.0.21, 1.0.20, 1.0.19, 1.0.18, 1.0.17, 1.0.16, 1.0.15, 1.0.14, 1.0.13, 1.0.12, 1.0.11, 1.0.10, 1.0.9, 1.0.8, 1.0.6, 1.0.5, 1.0.4, 1.0.3, 1.0.2, 1.0.1, 1.0.0
all possible versions conflict with previously selected packages.
previously selected package `anyhow v1.0.51`
... which satisfies dependency `anyhow = "^1.0"` (locked to 1.0.51) of package `argmin v0.4.7`
... which satisfies dependency `argmin = "^0.4.6"` (locked to 0.4.7) of package `linfa-linear v0.5.0 (https://github.com/rust-ml/linfa#2a530612)`
... which satisfies git dependency `linfa-linear` (locked to 0.5.0) of package `rust-ds v0.1.0
failed to select a version for `anyhow` which could resolve this conflict
Try deleting your lockfile and running cargo clean
, then building again.
I have delete lockfile
and run cargo clean
. but still can't fix the erorr
cargo run --features linfa/intel-mkl-system
Updating crates.io index
error: failed to select a version for `anyhow`.
... required by package `linfa v0.5.0 (https://github.com/rust-ml/linfa#2a530612)`
... which satisfies git dependency `linfa` (locked to 0.5.0) of package `linfa-datasets v0.5.0 (https://github.com/rust-ml/linfa#2a530612)`
... which satisfies git dependency `linfa-datasets` (locked to 0.5.0) of package `rust-ds v0.1.0
versions that meet the requirements `<=1.0.48` are: 1.0.48, 1.0.47, 1.0.45, 1.0.44, 1.0.43, 1.0.42, 1.0.41, 1.0.40, 1.0.39, 1.0.38, 1.0.37, 1.0.36, 1.0.35, 1.0.34, 1.0.33, 1.0.32, 1.0.31, 1.0.30, 1.0.29, 1.0.28, 1.0.27, 1.0.26, 1.0.25, 1.0.24, 1.0.23, 1.0.22, 1.0.21, 1.0.20, 1.0.19, 1.0.18, 1.0.17, 1.0.16, 1.0.15, 1.0.14, 1.0.13, 1.0.12, 1.0.11, 1.0.10, 1.0.9, 1.0.8, 1.0.6, 1.0.5, 1.0.4, 1.0.3, 1.0.2, 1.0.1, 1.0.0
all possible versions conflict with previously selected packages.
previously selected package `anyhow v1.0.53`
... which satisfies dependency `anyhow = "^1.0"` (locked to 1.0.53) of package `argmin v0.4.7`
... which satisfies dependency `argmin = "^0.4.6"` (locked to 0.4.7) of package `linfa-linear v0.5.0 (https://github.com/rust-ml/linfa#2a530612)`
... which satisfies git dependency `linfa-linear` (locked to 0.5.0) of package `rust-ds v0.1.0
failed to select a version for `anyhow` which could resolve this conflict
Can you show me your Cargo.toml
and Cargo.lock
?
Ok I reproduced it at my end. The resolver is doing something weird. Add anyhow = "=1.0.47"
to your Cargo.toml and things should work. Not sure the error is only happening outside of CI.
I have added above anyhow
and got new err MKL not found
cargo run --features linfa/intel-mkl-system
error: failed to run custom build command for `intel-mkl-src v0.6.0+mkl2020.1`
Caused by:
process didn't exit successfully: `/target/debug/build/intel-mkl-src-18a43e5407975091/build-script-build` (exit status: 1)
--- stdout
cargo:rerun-if-env-changed=MKL_DYNAMIC_LP64_SEQ_NO_PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG_x86_64-apple-darwin
cargo:rerun-if-env-changed=PKG_CONFIG_x86_64_apple_darwin
cargo:rerun-if-env-changed=HOST_PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG
cargo:rerun-if-env-changed=MKL_DYNAMIC_LP64_SEQ_STATIC
cargo:rerun-if-env-changed=MKL_DYNAMIC_LP64_SEQ_DYNAMIC
cargo:rerun-if-env-changed=PKG_CONFIG_ALL_STATIC
cargo:rerun-if-env-changed=PKG_CONFIG_ALL_DYNAMIC
cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64-apple-darwin
cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64_apple_darwin
cargo:rerun-if-env-changed=HOST_PKG_CONFIG_PATH
cargo:rerun-if-env-changed=PKG_CONFIG_PATH
cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64-apple-darwin
cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64_apple_darwin
cargo:rerun-if-env-changed=HOST_PKG_CONFIG_LIBDIR
cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64-apple-darwin
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_apple_darwin
cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
--- stderr
Error: No MKL found, and download flag is off.
error: build failed
is there any MKL
configuration that I miss ?
Try cargo run --features linfa/intel-mkl-static
. You did linfa/intel-mkl-system
, which searches for a system installation of the Intel BLAS library, which you don't have install. static
will download and build the BLAS library for you statically.
it seems failed on download intel-mkl-tool
and got request Not Found
.
cargo run --features linfa/intel-mkl-static
error: failed to run custom build command for `intel-mkl-src v0.6.0+mkl2020.1`
Caused by:
process didn't exit successfully: `/target/debug/build/intel-mkl-src-ce82ab680f83fbf9/build-script-build` (exit status: 101)
--- stdout
cargo:rerun-if-env-changed=MKL_STATIC_LP64_SEQ_NO_PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG_x86_64-apple-darwin
cargo:rerun-if-env-changed=PKG_CONFIG_x86_64_apple_darwin
cargo:rerun-if-env-changed=HOST_PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG
cargo:rerun-if-env-changed=MKL_STATIC_LP64_SEQ_STATIC
cargo:rerun-if-env-changed=MKL_STATIC_LP64_SEQ_DYNAMIC
cargo:rerun-if-env-changed=PKG_CONFIG_ALL_STATIC
cargo:rerun-if-env-changed=PKG_CONFIG_ALL_DYNAMIC
cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64-apple-darwin
cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64_apple_darwin
cargo:rerun-if-env-changed=HOST_PKG_CONFIG_PATH
cargo:rerun-if-env-changed=PKG_CONFIG_PATH
cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64-apple-darwin
cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64_apple_darwin
cargo:rerun-if-env-changed=HOST_PKG_CONFIG_LIBDIR
cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64-apple-darwin
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_apple_darwin
cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
cargo:warning="Download Intel MKL archive intotarget/debug/build/intel-mkl-src-e6d99e3b4f7c71c2/out"
--- stderr
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Error { description: "HTTP response code said error", code: 22, extra: Some("The requested URL returned error: 404 Not Found") }', .cargo/registry/src/github.com-1ecc6299db9ec823/intel-mkl-tool-0.2.0+mkl2020.1/src/download.rs:37:28
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Turns out intel-mkl-static
doesn't work on MacOS because they didn't package the crate with a prebuilt MacOS library. You either need to install the Intel BLAS library yourself and use intel-mkl-system
or try netlib-static
. Alternatively you can wait for #147 to be resolved for linfa-linear
, which should happen before the next big release. That way you won't need to depend on an external BLAS library.
I'll close this issue, because the relevant problems on our end have been addressed.
I followed LinearRegression example and found err on
cargo run
Code:
Err output:
OS: Mac Catalina v10.15.7 Rust: rustc 1.58.1
I have try
cargo clean
but still can't fix the issue