PAGA_Tree: 'int' object has no attribute 'encode'
I would like to try a method simple and fast like PAGA_tree, but this error reoccured multiple times.
/usr/local/lib/python3.7/site-packages/umap/rp_tree.py:450: NumbaWarning: Compilation is falling back to object mode WITH looplifting enabled because Function "make_euclidean_tree" failed type inference due to: Cannot unify RandomProjectionTreeNode(array(int64, 1d, C), bool, none, none, none, none) and RandomProjectionTreeNode(none, bool, array(float32, 1d, C), float64, RandomProjectionTreeNode(array(int64, 1d, C), bool, none, none, none, none), RandomProjectionTreeNode(array(int64, 1d, C), bool, none, none, none, none)) for '$14.16', defined at /usr/local/lib/python3.7/site-packages/umap/rp_tree.py (457)
File "../../usr/local/lib/python3.7/site-packages/umap/rp_tree.py", line 457:
def make_euclidean_tree(data, indices, rng_state, leaf_size=30):
left_node = make_euclidean_tree(data, left_indices, rng_state, leaf_size)
^
[1] During: resolving callee type: recursive(type(CPUDispatcher(<function make_euclidean_tree at 0x7f9192912f28>))) [2] During: typing of call at /usr/local/lib/python3.7/site-packages/umap/rp_tree.py (457)
File "../../usr/local/lib/python3.7/site-packages/umap/rp_tree.py", line 457:
def make_euclidean_tree(data, indices, rng_state, leaf_size=30):
left_node = make_euclidean_tree(data, left_indices, rng_state, leaf_size)
^
@numba.jit() /usr/local/lib/python3.7/site-packages/numba/compiler.py:725: NumbaWarning: Function "make_euclidean_tree" was compiled in object mode without forceobj=True.
File "../../usr/local/lib/python3.7/site-packages/umap/rp_tree.py", line 451: @numba.jit() def make_euclidean_tree(data, indices, rng_state, leaf_size=30): ^
self.func_ir.loc)) /usr/local/lib/python3.7/site-packages/umap/nndescent.py:92: NumbaPerformanceWarning: The keyword argument 'parallel=True' was specified but no transformation for parallel execution was possible.
el.html#diagnostics for help.on parallel diagnostics, see http://numba.pydata.org/numba-doc/latest/user/parall
File "../../usr/local/lib/python3.7/site-packages/umap/utils.py", line 409: @numba.njit(parallel=True) def build_candidates(current_graph, n_vertices, n_neighbors, max_candidates, rng_state): ^
current_graph, n_vertices, n_neighbors, max_candidates, rng_state /usr/local/lib/python3.7/site-packages/numba/compiler.py:588: NumbaPerformanceWarning: The keyword argument 'parallel=True' was specified but no transformation for parallel execution was possible.
To find out why, try turning on parallel diagnostics, see http://numba.pydata.org/numba-doc/latest/user/parallel.html#diagnostics for help.
File "../../usr/local/lib/python3.7/site-packages/umap/nndescent.py", line 47: @numba.njit(parallel=True) def nn_descent( ^
self.func_ir.loc)) /usr/local/lib/python3.7/site-packages/umap/umap_.py:349: NumbaWarning: Compilation is falling back to object mode WITH looplifting enabled because Function "fuzzy_simplicial_set" failed type inference due to: Untyped global name 'nearest_neighbors': cannot determine Numba type of <class 'function'>
File "../../usr/local/lib/python3.7/site-packages/umap/umap_.py", line 467:
def fuzzy_simplicial_set(
@numba.jit() /usr/local/lib/python3.7/site-packages/numba/compiler.py:725: NumbaWarning: Function "fuzzy_simplicial_set" was compiled in object mode without forceobj=True.
File "../../usr/local/lib/python3.7/site-packages/umap/umap_.py", line 350: @numba.jit() def fuzzy_simplicial_set( ^
self.func_ir.loc)) /usr/local/lib/python3.7/site-packages/rpy2/robjects/pandas2ri.py:62: UserWarning: Error while trying to convert the column "group_id". Fall back to string conversion. The error is: Converting pandas "Category" series to R factor is only possible when categories are strings. % (name, str(e))) Traceback (most recent call last): File "/usr/local/lib/python3.7/site-packages/rpy2/robjects/pandas2ri.py", line 57, in py2rpy_pandasdataframe od[name] = conversion.py2rpy(values) File "/usr/local/lib/python3.7/functools.py", line 824, in wrapper return dispatch(args[0].class)(*args, **kw) File "/usr/local/lib/python3.7/site-packages/rpy2/robjects/pandas2ri.py", line 104, in py2rpy_pandasseries res = py2rpy_categoryseries(obj) File "/usr/local/lib/python3.7/site-packages/rpy2/robjects/pandas2ri.py", line 84, in py2rpy_categoryseries raise ValueError('Converting pandas "Category" series to ' ValueError: Converting pandas "Category" series to R factor is only possible when categories are strings.
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/usr/local/lib/python3.7/site-packages/rpy2/rinterface_lib/sexp.py", line 361, in from_object mv = memoryview(obj) TypeError: memoryview: a bytes-like object is required, not 'Series'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/code/run.py", line 157, in
File "../../usr/local/lib/python3.7/site-packages/umap/rp_tree.py", line 457:
def make_euclidean_tree(data, indices, rng_state, leaf_size=30):
left_node = make_euclidean_tree(data, left_indices, rng_state, leaf_size)
^
[1] During: resolving callee type: recursive(type(CPUDispatcher(<function make_euclidean_tree at 0x7f9192912f28>))) [2] During: typing of call at /usr/local/lib/python3.7/site-packages/umap/rp_tree.py (457)
File "../../usr/local/lib/python3.7/site-packages/umap/rp_tree.py", line 457:
def make_euclidean_tree(data, indices, rng_state, leaf_size=30):
left_node = make_euclidean_tree(data, left_indices, rng_state, leaf_size)
^
@numba.jit() /usr/local/lib/python3.7/site-packages/numba/compiler.py:725: NumbaWarning: Function "make_euclidean_tree" was compiled in object mode without forceobj=True.
File "../../usr/local/lib/python3.7/site-packages/umap/rp_tree.py", line 451: @numba.jit() def make_euclidean_tree(data, indices, rng_state, leaf_size=30): ^
self.func_ir.loc)) /usr/local/lib/python3.7/site-packages/umap/nndescent.py:92: NumbaPerformanceWarning: The keyword argument 'parallel=True' was specified but no transformation for parallel execution was possible.
To find out why, try turning on parallel diagnostics, see http://numba.pydata.org/numba-doc/latest/user/parallel.html#diagnostics for help.
File "../../usr/local/lib/python3.7/site-packages/umap/utils.py", line 409: @numba.njit(parallel=True) def build_candidates(current_graph, n_vertices, n_neighbors, max_candidates, rng_state): ^
current_graph, n_vertices, n_neighbors, max_candidates, rng_state /usr/local/lib/python3.7/site-packages/numba/compiler.py:588: NumbaPerformanceWarning: The keyword argument 'parallel=True' was specified but no transformation for parallel execution was possible.
To find out why, try turning on parallel diagnostics, see http://numba.pydata.org/numba-doc/latest/user/parallel.html#diagnostics for help.
File "../../usr/local/lib/python3.7/site-packages/umap/nndescent.py", line 47: @numba.njit(parallel=True) def nn_descent( ^
self.func_ir.loc)) /usr/local/lib/python3.7/site-packages/umap/umap_.py:349: NumbaWarning: Compilation is falling back to object mode WITH looplifting enabled because Function "fuzzy_simplicial_set" failed type inference due to: Untyped global name 'nearest_neighbors': cannot determine Numba type of <class 'function'>
File "../../usr/local/lib/python3.7/site-packages/umap/umap_.py", line 467:
def fuzzy_simplicial_set(
@numba.jit() /usr/local/lib/python3.7/site-packages/numba/compiler.py:725: NumbaWarning: Function "fuzzy_simplicial_set" was compiled in object mode without forceobj=True.
File "../../usr/local/lib/python3.7/site-packages/umap/umap_.py", line 350: @numba.jit() def fuzzy_simplicial_set( ^
self.func_ir.loc)) /usr/local/lib/python3.7/site-packages/rpy2/robjects/pandas2ri.py:62: UserWarning: Error while trying to convert the column "group_id". Fall back to string conversion. The error is: Converting pandas "Category" series to R factor is only possible when categories are strings. % (name, str(e))) Traceback (most recent call last): File "/usr/local/lib/python3.7/site-packages/rpy2/robjects/pandas2ri.py", line 57, in py2rpy_pandasdataframe od[name] = conversion.py2rpy(values) File "/usr/local/lib/python3.7/functools.py", line 824, in wrapper return dispatch(args[0].class)(*args, **kw) File "/usr/local/lib/python3.7/site-packages/rpy2/robjects/pandas2ri.py", line 104, in py2rpy_pandasseries res = py2rpy_categoryseries(obj) File "/usr/local/lib/python3.7/site-packages/rpy2/robjects/pandas2ri.py", line 84, in py2rpy_categoryseries raise ValueError('Converting pandas "Category" series to ' ValueError: Converting pandas "Category" series to R factor is only possible when categories are strings.
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/usr/local/lib/python3.7/site-packages/rpy2/rinterface_lib/sexp.py", line 361, in from_object mv = memoryview(obj) TypeError: memoryview: a bytes-like object is required, not 'Series'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/code/run.py", line 157, in
And here is my config:
sessionInfo() R version 4.1.0 (2021-05-18) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Ubuntu 20.04.3 LTS
Matrix products: default BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.9.0 LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.9.0
locale:
[1] LC_CTYPE=zh_CN.UTF-8 LC_NUMERIC=C
[3] LC_TIME=zh_CN.UTF-8 LC_COLLATE=zh_CN.UTF-8
[5] LC_MONETARY=zh_CN.UTF-8 LC_MESSAGES=zh_CN.UTF-8
[7] LC_PAPER=zh_CN.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=zh_CN.UTF-8 LC_IDENTIFICATION=C
attached base packages: [1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] shiny_1.6.0 SeuratObject_4.0.2 Seurat_4.0.3
[4] Matrix_1.3-4 forcats_0.5.1 stringr_1.4.0
[7] dplyr_1.0.7 purrr_0.3.4 readr_1.4.0
[10] tidyr_1.1.3 tibble_3.1.2 ggplot2_3.3.5
[13] tidyverse_1.3.1 assertthat_0.2.1 dynutils_1.0.6
[16] dyno_0.1.2 dynwrap_1.2.2 dynplot_1.0.2.9000
[19] dynmethods_1.0.5 dynguidelines_1.0.1 dynfeature_1.0.0.9000
loaded via a namespace (and not attached):
[1] utf8_1.2.1 reticulate_1.20 tidyselect_1.1.1
[4] htmlwidgets_1.5.3 grid_4.1.0 ranger_0.12.1
[7] Rtsne_0.15 munsell_0.5.0 codetools_0.2-18
[10] ica_1.0-2 future_1.21.0 miniUI_0.1.1.1
[13] withr_2.4.2 colorspace_2.0-1 knitr_1.33
[16] rstudioapi_0.13 ROCR_1.0-11 tensor_1.5
[19] shinyWidgets_0.6.0 listenv_0.8.0 labeling_0.4.2
[22] polyclip_1.10-0 bit64_4.0.5 farver_2.1.0
[25] rprojroot_2.0.2 parallelly_1.26.0 vctrs_0.3.8
[28] generics_0.1.0 xfun_0.23 R6_2.5.1
[31] GA_3.2.1 graphlayouts_0.7.1 hdf5r_1.3.4
[34] cachem_1.0.5 spatstat.utils_2.2-0 promises_1.2.0.1
[37] scales_1.1.1 ggraph_2.0.5 lmds_0.1.0
[40] gtable_0.3.0 babelwhale_1.0.2 globals_0.14.0
[43] processx_3.5.2 goftest_1.2-2 tidygraph_1.2.0
[46] rlang_0.4.11 akima_0.6-2.1 splines_4.1.0
[49] lazyeval_0.2.2 hexbin_1.28.2 spatstat.geom_2.1-0
[52] broom_0.7.7 yaml_2.2.1 reshape2_1.4.4
[55] abind_1.4-5 modelr_0.1.8 backports_1.2.1
[58] httpuv_1.6.1 tools_4.1.0 ellipsis_0.3.2
[61] spatstat.core_2.1-2 jquerylib_0.1.4 RColorBrewer_1.1-2
[64] ggridges_0.5.3 Rcpp_1.0.6 plyr_1.8.6
[67] ps_1.6.0 rpart_4.1-15 deldir_0.2-10
[70] pbapply_1.4-3 viridis_0.6.1 cowplot_1.1.1
[73] dynparam_1.0.2 zoo_1.8-9 haven_2.4.1
[76] ggrepel_0.9.1 cluster_2.1.2 fs_1.5.0
[79] magrittr_2.0.1 data.table_1.14.0 scattermore_0.7
[82] carrier_0.1.0 lmtest_0.9-38 reprex_2.0.0
[85] RANN_2.6.1 fitdistrplus_1.1-5 matrixStats_0.59.0
[88] pkgload_1.2.1 shinyjs_2.0.0 hms_1.1.0
[91] patchwork_1.1.1 mime_0.10 xtable_1.8-4
[94] readxl_1.3.1 gridExtra_2.3 testthat_3.0.2
[97] compiler_4.1.0 KernSmooth_2.23-20 crayon_1.4.1
[100] rje_1.10.16 htmltools_0.5.1.1 proxyC_0.2.0
[103] mgcv_1.8-36 later_1.2.0 RcppParallel_5.1.4
[106] lubridate_1.7.10 DBI_1.1.1 tweenr_1.0.2
[109] dbplyr_2.1.1 MASS_7.3-54 cli_2.5.0
[112] parallel_4.1.0 igraph_1.2.6 pkgconfig_2.0.3
[115] sp_1.4-5 plotly_4.9.4 spatstat.sparse_2.0-0
[118] xml2_1.3.2 foreach_1.5.1 bslib_0.2.5.1
[121] rvest_1.0.0 digest_0.6.27 dyndimred_1.0.4
[124] sctransform_0.3.2 RcppAnnoy_0.0.18 spatstat.data_2.1-0
[127] cellranger_1.1.0 leiden_0.3.8 uwot_0.1.10
[130] lifecycle_1.0.0 nlme_3.1-152 jsonlite_1.7.2
[133] desc_1.3.0 viridisLite_0.4.0 fansi_0.5.0
[136] pillar_1.6.1 lattice_0.20-44 fastmap_1.1.0
[139] httr_1.4.2 survival_3.2-11 waldo_0.2.5
[142] glue_1.4.2 remotes_2.4.0 png_0.1-7
[145] iterators_1.0.13 bit_4.0.4 sass_0.4.0
[148] ggforce_0.3.3 stringi_1.6.2 irlba_2.3.3
[151] future.apply_1.7.0
I checked my docker and HDF5R that have already be installed and seems to work well. Is this error given rised by my mistakes, or some outmode package dependencies, or something with python?
Thanks, John Hsiung
@KforKuma,
I read that this error was provoked by warnings thrown by numba compilation and a solution was to add:
import warnings
warnings.filterwarnings('ignore')
in the code. However, the ti method is called through docker containers (in my case), I don't know where I can put that chunk of code since dyno create a new container from the docker image every time the same method is called. Has someone an idea (apart from modifying the method image, which is not straightforward) to solve that issue?