Reputation: 4431
I am unable to unload the tidyverse namespaces after using dbplyr.
Did I find a bug in dbplyr? Does it unload correctly?
library(tidyverse)
con <- DBI::dbConnect(RSQLite::SQLite(), ":memory:")
copy_to(con, mtcars)
DBI::dbDisconnect(con)
unloadNamespace("tidylog")
unloadNamespace("tidyr")
unloadNamespace("purrr")
unloadNamespace("tidyverse")
unloadNamespace("ggplot2")
unloadNamespace("readr")
unloadNamespace("dbplyr")
unloadNamespace("dplyr")
unloadNamespace("tibble")
unloadNamespace("stringr")
unloadNamespace("forcats")
unloadNamespace("magrittr")
library(tidyverse)
results in:
Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) :
cyclic namespace dependency detected when loading ‘dplyr’, already loading ‘dbplyr’, ‘dplyr’, ‘ggplot2’
Upvotes: 2
Views: 65
Reputation: 3535
Note an answer per se, but a simpler version of your example.
The relationship between dplyr
and dbplyr
is definitely confusing. For example, copy_to()
is reexported by dplyr
, but other functions (e.g., copy_inline()
) are not. Some aspects of dbplyr
suggest it's a behind-the-scenes package that users aren't meant to think about, but sometimes users need to call it (e.g., to get window_order()
and window_frame()
).
library(dplyr)
#>
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#>
#> filter, lag
#> The following objects are masked from 'package:base':
#>
#> intersect, setdiff, setequal, union
con <- DBI::dbConnect(RSQLite::SQLite(), ":memory:")
copy_to(con, mtcars)
DBI::dbDisconnect(con)
unloadNamespace("dbplyr")
unloadNamespace("dplyr")
library(dplyr)
#> Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) :
#> cyclic namespace dependency detected when loading 'dplyr', already loading 'dbplyr', 'dplyr'
#>
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#>
#> filter, lag
#> The following objects are masked from 'package:base':
#>
#> intersect, setdiff, setequal, union
Created on 2024-12-29 with reprex v2.1.1
Upvotes: 1