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

Empty solution error description #305

Open
pawelru opened this issue Mar 9, 2023 · 10 comments
Open

Empty solution error description #305

pawelru opened this issue Mar 9, 2023 · 10 comments
Labels
bug an unexpected problem or unintended behavior

Comments

@pawelru
Copy link
Contributor

pawelru commented Mar 9, 2023

r$> pkgdepends::new_pkg_installation_proposal(c("cran/dm@1.0.0", "cran/dplyr@1.0.9")) %>% {.$solve(); .$show_solution()}
Error: 
! Could not solve package dependencies:

Type .Last.error to see the more details.

This is for lpSolve_5.6.17. If I do upgrade to the newest version 5.6.18 I even got a red error:

r$> pkgdepends::new_pkg_installation_proposal(c("cran/dm@1.0.0", "cran/dplyr@1.0.9")) %>% {.$solve(); .$show_solution()}
Error in .C("lpslink", direction = as.integer(direction), x.count = as.integer(x.count),  : 
  Incorrect number of arguments (29), expecting 28 for 'lpslink'
@gaborcsardi
Copy link
Member

The first one seems like a bug indeed. I cannot reproduce the second one, maybe you didn't restart R after the installation?

@gaborcsardi gaborcsardi added the bug an unexpected problem or unintended behavior label Mar 9, 2023
@gaborcsardi
Copy link
Member

If you use a new library, then you'll see the real reason:

p <- pkgdepends::new_pkg_installation_proposal(c("cran/dm@1.0.0", "cran/dplyr@1.0.9"), config = list(library = tempfile()))
ℹ Creating library directory:  /var/folders/ph/fpcmzfd16rgbbk8mxvy9m2_h0000gn/T//RtmpMsCIiD/fileaa583ad9ccc9p$solve()
❯ p$get_solution()
<pkg_solution>
+ result: FAILED
+ refs:
  - cran/dm@1.0.0
  - cran/dplyr@1.0.9
+ constraints (165):
  - select dm exactly once
  - select dplyr exactly once
  - select DBI at most once
  - select Matrix at most once
  - select R6 at most once
  - select backports at most once
  - select cachem at most once
  - select cli at most once
  - select cpp11 at most once
  - select fansi at most once
  ...
x failures:
* cran/dm@1.0.0: Can't install dependency tidyr (>= 1.0.0)
* tidyr: Can't install dependency dplyr (>= 1.0.10)
* dplyr: Conflicts with cran/dplyr@1.0.9

@pawelru
Copy link
Contributor Author

pawelru commented Mar 11, 2023

Thank you. After session restart my red error is gone. Adding config arg also solved blank report issue but I guess this ticket is still valid as we want to have it without that arg specified.

@pawelru
Copy link
Contributor Author

pawelru commented Mar 11, 2023

I actually have one more use case of a blank failure report and I got it with tempfile() as you suggested.

r$> temp_desc <- desc::desc("!new")

r$> temp_desc$set_dep("dm", "Imports")

r$> temp_desc$set_dep("dplyr", "Imports")

r$> temp_desc$set_remotes(c("cran/dm@1.0.0", "cran/dplyr@1.0.9"))

r$> temp_desc
Package: {{ Package }}
Title: {{ Title }}
Version: 1.0.0
Authors@R (parsed):
    * Jo Doe <jodoe@dom.ain> [aut, cre]
Maintainer: {{ Maintainer }}
Description: {{ Description }}
License: {{ License }}
URL: {{ URL }}
BugReports: {{ BugReports }}
Imports:
    dm,
    dplyr
Remotes:
    cran/dm@1.0.0,
    cran/dplyr@1.0.9
Encoding: UTF-8

r$> temp_desc_path <- tempfile()

r$> temp_desc$write(temp_desc_path)

r$> x <- pkgdepends::new_pkg_deps(temp_desc_path, config = list(library = tempfile()))

r$> x$solve()

r$> x$get_solution()
<pkg_solution>
+ result: FAILED
+ refs:
  - local::/var/folders/m1/hrz0h_ls7gz57rc80tnj41t80000gp/T//Rtmp0cwFMJ/fileaffd42c31262
+ constraints (166):
  - select {{ Package }} exactly once
  - select dm at most once
  - select dplyr at most once
  - select DBI at most once
  - select Matrix at most once
  - select R6 at most once
  - select backports at most once
  - select cachem at most once
  - select cli at most once
  - select cpp11 at most once
  ...
x failures:

Above works perfectly fine without failures - you would just need to comment-out one of the imports.

Do you have any idea how to make it work?

@gaborcsardi
Copy link
Member

These are the same versions as above, no? So the error is the same, tidyr needs dplyr 1.0.10:

* cran/dm@1.0.0: Can't install dependency tidyr (>= 1.0.0)
* tidyr: Can't install dependency dplyr (>= 1.0.10)
* dplyr: Conflicts with cran/dplyr@1.0.9

@pawelru
Copy link
Contributor Author

pawelru commented Mar 11, 2023

Yes. Those are the same references and after your last comment I know the reason. I just reused it to give you another example of a erroneous behavior - this time using also library = tempfile() as you suggested.

@pawelru
Copy link
Contributor Author

pawelru commented Mar 24, 2023

Hi @gaborcsardi is there any plans to attack this bad guy? It's sort of relevant for my project as it's hard to interpret empty error reports.

@gaborcsardi
Copy link
Member

Reprex:

temp_desc <- desc::desc("!new")
temp_desc$set_dep("dm", "Imports")
temp_desc$set_dep("dplyr", "Imports")
temp_desc$set_remotes(c("cran/dm@1.0.0", "cran/dplyr@1.0.9"))
temp_desc_path <- tempfile()
temp_desc$write(temp_desc_path)
x <- pkgdepends::new_pkg_deps(temp_desc_path, config = list(library = tempfile()))
x$solve()
x$get_solution()

gaborcsardi added a commit that referenced this issue Mar 26, 2023
This currently happens if no direct ref can be installed
because of conflicting dependencies. E.g. in #305.
Hopefully we can do better soon.
@gaborcsardi
Copy link
Member

With b37d08e this now reports:

x failures:
* local::/var/folders/ph/fpcmzfd16rgbbk8mxvy9m2_h0000gn/T//RtmpVhwlCY/file26cf53f5773c: dependency conflict

@pawelru
Copy link
Contributor Author

pawelru commented Mar 27, 2023

Thank you @gaborcsardi. I do confirm that using @main I can see now "dependency conflict" error message instead of the empty one. I agree with your commit message that hopefully this can be improved soon as I think that the package itself is definitely able to point to the right root-cause of the conflict. Therefore I would like to keep this ticket open.

For anyone else looking at this ticket. I managed to find out sort of workaround solution to put a vector of refs read from package description as opposed to single reference to the package itself. Using reprex above:

temp_desc <- desc::desc("!new")
temp_desc$set_dep("dm", "Imports")
temp_desc$set_dep("dplyr", "Imports")
temp_desc$set_remotes(c("cran/dm@1.0.0", "cran/dplyr@1.0.9"))
temp_desc_path <- tempfile()
temp_desc$write(temp_desc_path)
x <- pkgdepends::new_pkg_deps(temp_desc_path, config = list(library = tempfile()))
x$solve()
x$get_solution()

x2 <- pkgdepends::new_pkg_deps(temp_desc$get_remotes(), config = list(library = tempfile()))
x2$solve()
x2$get_solution()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug an unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests

2 participants