satijalab / seurat

R toolkit for single cell genomics
http://www.satijalab.org/seurat
Other
2.2k stars 893 forks source link

Issue with RunUMAP in Seurat5: Error in py_get_attr(x, name, FALSE) : AttributeError: module 'umap' has no attribute 'pkg_resources' #8802

Closed yojetsharma closed 1 month ago

yojetsharma commented 3 months ago
Restarting R session...

Loading required package: SeuratObject
Loading required package: sp

Attaching package: ‘SeuratObject’

The following object is masked from ‘package:base’:

    intersect

> library(Seurat)
> library(reticulate)
> 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

> library(Matrix)
> Genotype1 <-
+   SCTransform(
+     npcs.genotype[["WT"]], 
+     vst.flavor = "v2",
+     verbose = TRUE,
+     vars.to.regress = c("percent_ribo", "percent_mito"), assay = "RNA"
+   ) %>%
+   RunPCA(npcs = 15, verbose = TRUE) %>%
+   RunUMAP(
+     reduction = "pca",
+     dims = 1:15,
+     verbose = TRUE, assay = "RNA",
+     umap.method = 'umap-learn',
+     metric = 'correlation'
+   ) %>%
+   FindNeighbors(reduction = "pca",
+                 dims = 1:15,
+                 verbose = TRUE) %>%
+   FindClusters(resolution = 0.7, verbose = TRUE)
Running SCTransform on assay: RNA
Running SCTransform on layer: counts.d149npcs
vst.flavor='v2' set. Using model with fixed slope and excluding poisson genes.
Variance stabilizing transformation of count matrix of size 20921 by 1312
Model formula is y ~ log_umi
Get Negative Binomial regression parameters per gene
Using 2000 genes, 1312 cells
Found 13 outliers - those will be ignored in fitting/regularization step

Second step: Get residuals using fitted parameters for 20921 genes
Computing corrected count matrix for 20921 genes
Calculating gene attributes
Wall clock passed: Time difference of 3.627898 secs
Determine variable features
Regressing out percent_ribo, percent_mito
  |============================================================================================================================================| 100%
Centering data matrix
  |============================================================================================================================================| 100%
Set default assay to SCT
PC_ 1 
Positive:  DACH1, LINC01414, NRG3, DLG2, CREB5, HPSE2, NAV3, LINC00461, SYNE2, AC110023.1 
       PTPRZ1, AC096570.1, KCNQ3, FUT9, LINC01551, NAV1, NRCAM, DAB1, AL591519.1, IL1RAPL1 
       NKAIN3, PCDH15, ASPM, CENPF, GLI3, DLGAP1, CDH12, AC091078.1, GALNT13, NRXN3 
Negative:  RMST, GLIS3, ERBB4, CDH6, TPM1, WLS, EPHA7, COL1A2, TRPM3, COLEC12 
       NFIA, BNC2, LINC00472, UNC5C, PCDH7, RBMS3, SEMA3C, RBFOX1, SLIT2, ADGRL3 
       LMX1A, VIM, GNG12-AS1, PCDH9, SAMD4A, SULF1, SLIT3, AKAP12, CALD1, FGFR2 
PC_ 2 
Positive:  COL1A2, COL1A1, CALD1, COL3A1, FN1, DLC1, COL5A1, EDNRA, LUM, TWIST1 
       HMCN1, PRRX1, COL12A1, COL8A1, COL4A1, ITGAV, MMP16, TAGLN, DDR2, TNC 
       LAMB1, EBF1, TGFB2, CDH11, FSTL1, FLRT2, CPED1, KIF26B, CACNA1C, PAPPA 
Negative:  RMST, TRPM3, ERBB4, EPHA7, RBFOX1, GLIS3, LMX1A, TPBG, NEBL, ADGRL3 
       PCDH7, SLIT2, UNC5D, CADPS2, NLGN1, PAX3, LINC00472, AC016152.1, ZNF521, MIR99AHG 
       SAMD5, LINGO2, CTNNA2, AL033504.1, AC092957.1, CDH6, UBE3D, RFX3, EFNA5, PCDH9 
PC_ 3 
Positive:  CENPF, ASPM, TOP2A, CENPE, KIF14, APOLD1, MKI67, TPX2, SGO2, CCNB1 
       ECT2, GAS2L3, HMGB2, NUSAP1, ARL6IP1, DLGAP5, UBE2C, KIF18A, KPNA2, KNL1 
       KIF4A, PIF1, BUB1, KIF20B, GTSE1, TUBB4B, KIF11, G2E3, NUF2, ARHGAP11B 
Negative:  DACH1, LINC01414, KCNT2, PCDH15, IMMP2L, RIMS2, IPO9-AS1, NAV1, EBF1, ADAMTS6 
       GPM6A, NRG3, GLI3, CREB5, SOX5, FAM155A, NKAIN3, GALNT13, SLC44A5, HDAC9 
       PHACTR1, SLC1A3, NRXN3, DLGAP1, ST6GALNAC3, FUT9, GRM8, BMPR1B, BICC1, KCNB2 
PC_ 4 
Positive:  UNC5C, NFIA, BNC2, NR2F2-AS1, SEMA5A, PCDH9, KIF26B, PRKG1, MIR99AHG, AL157778.1 
       ADGRV1, TWIST1, EDNRA, COL3A1, COLEC12, CDH11, TMEM132C, EPHA7, COBLL1, SLIT3 
       PRRX1, LSAMP, ROBO1, ST6GALNAC3, FGFR2, RBMS3, CPED1, RSPO3, ADGRL3, EBF1 
Negative:  TAGLN, MYH9, CCN2, TPM1, ANKRD1, CRIM1, VIM, AC016766.1, TGFB2, ACTN1 
       MAMDC2, MYL9, CCN1, COL11A1, CALD1, PAPPA, ACTB, ITGAV, ACTG1, ANKRD45 
       CLSTN2, ANXA1, DDAH1, NOX4, PLK2, GJA1, LPP, NEAT1, STK38L, RAI14 
PC_ 5 
Positive:  TRPM3, RBFOX1, TMEM132C, OTX2-AS1, NLGN1, ADAMTS18, MECOM, PAX3, GRAMD1B, CLVS1 
       OCA2, LGR5, MIR181A1HG, CACHD1, CADPS2, MIR100HG, EFNA5, UNC5D, ROR1, KIAA1217 
       HMCN1, NRP1, XACT, EDIL3, NAV1, EBF1, MAML3, EDNRA, TMEFF2, AC016152.1 
Negative:  UNC5C, ADGRV1, GRIA1, AKAP12, CDH6, AC105411.1, GPC6, PTPRM, DIAPH3, BRIP1 
       MIR99AHG, MIR924HG, NAV2, FGFR2, ADCY2, RIMS2, DTL, RFC3, POLA1, PRKCA 
       WLS, ATAD2, LINC00472, GUCY1A2, NEGR1, FAT3, MMS22L, PDE4B, CENPK, FRMD3 
Error in py_get_attr(x, name, FALSE) : 
  AttributeError: module 'umap' has no attribute 'pkg_resources'
Run `reticulate::py_last_error()` for details.
> reticulate::py_last_error()

── Python Exception Message ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
AttributeError: module 'umap' has no attribute 'pkg_resources'

── R Traceback ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
     ▆
  1. ├─... %>% FindClusters(resolution = 0.7, verbose = TRUE)
  2. ├─Seurat::FindClusters(., resolution = 0.7, verbose = TRUE)
  3. ├─Seurat::FindNeighbors(., reduction = "pca", dims = 1:15, verbose = TRUE)
  4. ├─Seurat::RunUMAP(...)
  5. └─Seurat:::RunUMAP.Seurat(...)
  6.   ├─Seurat::RunUMAP(...)
  7.   └─Seurat:::RunUMAP.default(...)
  8.     ├─base::numeric_version(x = umap_import$pkg_resources$get_distribution("umap-learn")$version)
  9.     │ └─base::.make_numeric_version(x, strict, .standard_regexps()$valid_numeric_version)
 10.     ├─umap_import$pkg_resources
 11.     └─reticulate:::`$.python.builtin.module`(umap_import, "pkg_resources")
 12.       └─reticulate::py_get_attr(x, name, FALSE)
See `reticulate::py_last_error()$r_trace$full_call` for more details.
> sessionInfo()
R version 4.3.3 (2024-02-29)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 22.04.4 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.10.0 
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.10.0

Random number generation:
 RNG:     L'Ecuyer-CMRG 
 Normal:  Inversion 
 Sample:  Rejection 

locale:
 [1] LC_CTYPE=en_IN.UTF-8       LC_NUMERIC=C               LC_TIME=en_IN.UTF-8        LC_COLLATE=en_IN.UTF-8     LC_MONETARY=en_IN.UTF-8   
 [6] LC_MESSAGES=en_IN.UTF-8    LC_PAPER=en_IN.UTF-8       LC_NAME=C                  LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_IN.UTF-8 LC_IDENTIFICATION=C       

time zone: Asia/Kolkata
tzcode source: system (glibc)

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] Matrix_1.6-5       dplyr_1.1.4        reticulate_1.36.0  Seurat_5.0.3       SeuratObject_5.0.1 sp_2.1-3          

loaded via a namespace (and not attached):
  [1] RColorBrewer_1.1-3          rstudioapi_0.16.0           jsonlite_1.8.8              magrittr_2.0.3              spatstat.utils_3.0-4       
  [6] zlibbioc_1.48.2             vctrs_0.6.5                 ROCR_1.0-11                 DelayedMatrixStats_1.24.0   spatstat.explore_3.2-7     
 [11] RCurl_1.98-1.14             S4Arrays_1.2.1              htmltools_0.5.8.1           SparseArray_1.2.4           sctransform_0.4.1          
 [16] parallelly_1.37.1           KernSmooth_2.23-22          htmlwidgets_1.6.4           ica_1.0-3                   plyr_1.8.9                 
 [21] plotly_4.10.4               zoo_1.8-12                  igraph_2.0.3                mime_0.12                   lifecycle_1.0.4            
 [26] pkgconfig_2.0.3             R6_2.5.1                    fastmap_1.1.1               GenomeInfoDbData_1.2.11     MatrixGenerics_1.14.0      
 [31] fitdistrplus_1.1-11         future_1.33.2               shiny_1.8.1.1               digest_0.6.35               colorspace_2.1-0           
 [36] patchwork_1.2.0             S4Vectors_0.40.2            rprojroot_2.0.4             tensor_1.5                  RSpectra_0.16-1            
 [41] irlba_2.3.5.1               GenomicRanges_1.54.1        progressr_0.14.0            fansi_1.0.6                 spatstat.sparse_3.0-3      
 [46] httr_1.4.7                  polyclip_1.10-6             abind_1.4-5                 compiler_4.3.3              here_1.0.1                 
 [51] withr_3.0.0                 fastDummies_1.7.3           MASS_7.3-60.0.1             rappdirs_0.3.3              DelayedArray_0.28.0        
 [56] tools_4.3.3                 lmtest_0.9-40               httpuv_1.6.15               future.apply_1.11.2         goftest_1.2-3              
 [61] glmGamPoi_1.14.3            glue_1.7.0                  nlme_3.1-164                promises_1.3.0              grid_4.3.3                 
 [66] Rtsne_0.17                  cluster_2.1.6               reshape2_1.4.4              generics_0.1.3              gtable_0.3.4               
 [71] spatstat.data_3.0-4         tidyr_1.3.1                 data.table_1.15.4           utf8_1.2.4                  XVector_0.42.0             
 [76] BiocGenerics_0.48.1         spatstat.geom_3.2-9         RcppAnnoy_0.0.22            ggrepel_0.9.5               RANN_2.6.1                 
 [81] pillar_1.9.0                stringr_1.5.1               spam_2.10-0                 RcppHNSW_0.6.0              later_1.3.2                
 [86] splines_4.3.3               lattice_0.22-6              survival_3.5-8              deldir_2.0-4                tidyselect_1.2.1           
 [91] miniUI_0.1.1.1              pbapply_1.7-2               knitr_1.46                  gridExtra_2.3               IRanges_2.36.0             
 [96] SummarizedExperiment_1.32.0 scattermore_1.2             stats4_4.3.3                xfun_0.43                   Biobase_2.62.0             
[101] matrixStats_1.3.0           stringi_1.8.3               lazyeval_0.2.2              codetools_0.2-18            tibble_3.2.1               
[106] cli_3.6.2                   uwot_0.2.1                  xtable_1.8-4                munsell_0.5.1               Rcpp_1.0.12                
[111] GenomeInfoDb_1.38.8         globals_0.16.3              spatstat.random_3.2-3       png_0.1-8                   parallel_4.3.3             
[116] ggplot2_3.5.0               dotCall64_1.1-1             sparseMatrixStats_1.14.0    bitops_1.0-7                listenv_0.9.1              
[121] viridisLite_0.4.2           scales_1.3.0                ggridges_0.5.6              crayon_1.5.2                leiden_0.4.3.1             
[126] purrr_1.0.2                 rlang_1.1.3                 cowplot_1.1.3
longmanz commented 1 month ago

Hi, Thank you for reporting this. This is a known issue from our end and we will try to fix it as soon as possible. In the meantime, please down-grade the umap-learn package to umap-learn to 0.5.3 (please refer to this post for details).