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

Errors Building Linfa Clustering and Linfa Reduction #63

Closed
zicklag opened this issue Nov 27, 2020 · 4 comments
Closed

Errors Building Linfa Clustering and Linfa Reduction #63

zicklag opened this issue Nov 27, 2020 · 4 comments

Comments

@zicklag
Copy link

zicklag commented Nov 27, 2020

Hey there, interesting project! I was just getting it installed and found that I couldn't compile the docs for linfa-clustering or linfa-reduction without turning off default-features because of this error:

    Updating crates.io index
error: failed to select a version for `linfa-reduction`.
    ... required by package `nasa-gallery v0.1.0 (/home/zicklag/git/zicklag/nasa-gallery)`
versions that meet the requirements `*` are: 0.2.0

the package `nasa-gallery` depends on `linfa-reduction`, with features: `openblas-src` but `linfa-reduction` does not have these features.


failed to select a version for `linfa-reduction` which could resolve this conflict
@bytesnake
Copy link
Member

bytesnake commented Nov 27, 2020 via email

@zicklag
Copy link
Author

zicklag commented Nov 27, 2020

No problem, I was just messing around and probably won't end up actually using linfa. Also I just discovered that I'm pretty sure the cause is the fact that the default feature depends on a dev-dependency, which doesn't work when included from an outside crate.

@bytesnake
Copy link
Member

uff this is blocked on rust-lang/cargo#7915 for stable builds. I removed the features and the linalg backend is using the system openblas library now exclusively. I will ping again when we managed to transfer ownership

@bytesnake
Copy link
Member

bytesnake commented Nov 29, 2020

everything except linfa-clustering should be published now. Here a small example for PCA:

Cargo.toml

[package]
#...

[dependencies]
ndarray = "0.13"
ndarray-rand = "0.11"
openblas-src = { version = "0.9", default-features = false, features = ["system"] }

linfa = "0.2.1"
linfa-reduction = "0.2.1"  

src/main.rs

use ndarray::Array;
use ndarray_rand::rand_distr::Uniform;
use ndarray_rand::RandomExt;

use linfa::prelude::*;
use linfa_reduction::Pca;

fn main() {
    let data = Array::random((100, 10), Uniform::new(-10., 10f64));
    let dataset = Dataset::from(data.clone());

    let proj_data = Pca::params(2)
        .fit(&dataset)
        .predict(data.view());

    dbg!(&proj_data);
}

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

2 participants