fiberseq / fibertools-rs

Tools for fiberseq data written in rust.
https://fiberseq.github.io/fibertools/fibertools.html
42 stars 5 forks source link

error[E0599]: no function or associated item named `from_xgoost_dump` found for struct `GBDT` in the current scope #39

Closed YueYvetteHao closed 7 months ago

YueYvetteHao commented 7 months ago

Hello, I encountered the following error when installing ft from crates.io:

error[E0599]: no function or associated item named `from_xgoost_dump` found for struct `GBDT` in the current scope
   --> /home/yhao/.cargo/registry/src/index.crates.io-6f17d22bba15001f/fibertools-rs-0.3.7/src/predict_m6a/xgb.rs:24:27
    |
24  |         let model = GBDT::from_xgoost_dump(temp_file_name, "binary:logistic")
    |                           ^^^^^^^^^^^^^^^^
    |                           |
    |                           function or associated item not found in `GBDT`
    |                           help: there is an associated function with a similar name: `from_xgboost_dump`
    |
note: if you're trying to build a new `GBDT` consider using one of the following associated functions:
      GBDT::new
      GBDT::load_model
      GBDT::from_xgboost_dump
      GBDT::from_xgboost_reader
   --> /home/yhao/.cargo/registry/src/index.crates.io-6f17d22bba15001f/gbdt-0.1.3/src/gradient_boost.rs:144:5
    |
144 |       pub fn new(conf: &Config) -> GBDT {
    |       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
729 |       pub fn load_model(filename: &str) -> Result<Self> {
    |       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
749 |       pub fn from_xgboost_dump(model_file: &str, objective: &str) -> Result<Self> {
    |       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
767 | /     pub fn from_xgboost_reader<R>(reader: R, objective: &str) -> Result<Self>
768 | |     where
769 | |         R: std::io::BufRead,
    | |____________________________^

error[E0599]: no function or associated item named `from_xgoost_dump` found for struct `GBDT` in the current scope
   --> /home/yhao/.cargo/registry/src/index.crates.io-6f17d22bba15001f/fibertools-rs-0.3.7/src/fire.rs:48:15
    |
48  |         GBDT::from_xgoost_dump(&model_file, "binary:logistic").expect("failed to load FIRE model");
    |               ^^^^^^^^^^^^^^^^
    |               |
    |               function or associated item not found in `GBDT`
    |               help: there is an associated function with a similar name: `from_xgboost_dump`
    |
note: if you're trying to build a new `GBDT` consider using one of the following associated functions:
      GBDT::new
      GBDT::load_model
      GBDT::from_xgboost_dump
      GBDT::from_xgboost_reader
   --> /home/yhao/.cargo/registry/src/index.crates.io-6f17d22bba15001f/gbdt-0.1.3/src/gradient_boost.rs:144:5
    |
144 |       pub fn new(conf: &Config) -> GBDT {
    |       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
729 |       pub fn load_model(filename: &str) -> Result<Self> {
    |       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
749 |       pub fn from_xgboost_dump(model_file: &str, objective: &str) -> Result<Self> {
    |       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
767 | /     pub fn from_xgboost_reader<R>(reader: R, objective: &str) -> Result<Self>
768 | |     where
769 | |         R: std::io::BufRead,
    | |____________________________^

For more information about this error, try `rustc --explain E0599`.

The error message suggested that "there is an associated function with a similar name: from_xgboost_dump". So I changed from_xgoost_dump to from_xgboost_dump in /src/predict_m6a/xgb.rs and /src/fire.rs. I was able to compile ft after fixing the function name. Am I doing it right? Thanks!

mrvollger commented 7 months ago

Looks like GBDT broke semvar versioning yesterday and changed this function name. I have applied the fix and strickly locked the dependency in v0.3.8 of fibertools. Thanks for sharing this issue! I am going to close, please reopen if something comes up.